-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
38 lines (28 loc) · 828 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
LIBNAME =iwi
LIBSUFFIX =.so
# common prefix
INCS =-I/usr/local/include -I/usr/include -I../luajit-2.0/src -I../libgeohash/include
LIBSDIR =-L/usr/local/lib -L/usr/lib -L../luajit-2.0/src/ -L../libgeohash/build/lib
# basic setup
CC =gcc
LIBS =$(LIBSDIR) -lm -lgeohash
OPTS =-O3 -Wall
LIBOPT =-c
CFLAGS =$(LIBOPT) $(OPTS) $(INCS) -fPIC
CFLAGS_LIB =-shared $(OPTS) $(LIBS) $(INCS)
.PHONY: all release clean debug
all: $(LIBNAME)$(LIBSUFFIX) $(LIBNAME).o clean_obj
$(LIBNAME)$(LIBSUFFIX): $(LIBNAME).o
$(CC) -o $@ $^ $(CFLAGS_LIB)
$(LIBNAME).o: $(LIBNAME).c
$(CC) -o $@ $^ $(CFLAGS)
release: $(LIBNAME)$(LIBSUFFIX) clean_obj
$(if $(shell which strip), strip $<)
$(if $(shell which upx), upx --best $<)
clean:
\rm -f *.o *.dll *.so
clean_obj:
[ -f $(LIBNAME).o ] && \rm $(LIBNAME).o
debug: CC += -DDEBUG
debug: all