forked from x86-64/seekgzip
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
40 lines (31 loc) · 1 KB
/
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
39
40
CC=gcc
SWIG=swig
PYTHON=python
LDFLAGS=-lz
CFLAGS=-O3 -march=native -mtune=native
USR_BIN_TARGETS=seekgzip
USR_LIB_TARGETS=libseekgzip.so
USR_INC_TARGETS=seekgzip.h
PHONY_TARGETS=.python
TARGETS=$(USR_BIN_TARGETS) $(USR_LIB_TARGETS) $(PHONY_TARGETS)
all: $(TARGETS)
clean:
rm -rf $(TARGETS)
rm -rf export_python.cpp
install:
mkdir -p $(DESTDIR)/usr/bin/ $(DESTDIR)/usr/lib/ $(DESTDIR)/usr/include/seekgzip/
cp $(USR_BIN_TARGETS) $(DESTDIR)/usr/bin/
cp $(USR_LIB_TARGETS) $(DESTDIR)/usr/lib/
cp $(USR_INC_TARGETS) $(DESTDIR)/usr/include/seekgzip/
test -f .python && $(PYTHON) setup.py install || exit 0
seekgzip: seekgzip.c main.c
$(CC) $(CFLAGS) -o $@ seekgzip.c main.c $(LDFLAGS)
libseekgzip.so: seekgzip.c
$(CC) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $<
.python: swig.i export_cpp.h export_cpp.cpp setup.py
$(SWIG) -c++ -python -o export_python.cpp swig.i
$(PYTHON) setup.py build
touch $@
test:
test -f .python && $(PYTHON) setup.py install || exit 0
test -f .python && $(PYTHON) test.py || exit 0