-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile-template
39 lines (26 loc) · 951 Bytes
/
makefile-template
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
39
BASENAME = %(modulename)s
LIBNAME = lib$(BASENAME).a
CFLAGS = -O3 -pipe -ffast-math -std=gnu99 -Wall -fomit-frame-pointer -D_GNU_SOURCE
RANLIB = true
PY_VERSION = $(shell python -c 'import sys; sys.stdout.write(sys.version[:3])')
PYTHON = python$(PY_VERSION)
PY_CFLAGS = -Wall -pthread -fno-strict-aliasing -DNDEBUG -Wstrict-prototypes -fPIC -I/usr/include/$(PYTHON)
#SRCS = %(modulename)s.c
SRCS = %(cfilename)s
OBJS = $(SRCS:.c=.o)
.SUFFIXES: .c .o
.PHONY: all clean
.c.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS2) -o $@ $<
$(LIBNAME): $(OBJS)
$(AR) r $(LIBNAME) $(OBJS)
$(RANLIB) $(LIBNAME)
all: $(LIBNAME) $(INCLUDES)
$(CC) $(PY_CFLAGS) $(CFLAGS) $(CPPFLAGS2) -c $(BASENAME).c -o $(BASENAME).o
$(CC) -pthread -shared -Wl,-O1 $(BASENAME).o -o $(BASENAME).so
install: all
mv semanticCore.so /usr/local/lib/$(PYTHON)/dist-packages/
clean:
rm -f *.o *.a *~ *.so
debug:
echo $(BASENAME) ($SRCS) $(LIBNAME) $(INCLUDES)