-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
106 lines (82 loc) · 2.87 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# zstd compression is not available by default
# run `make zstd=1` to compile with zstd
# or uncomment the following line
#zstd=1
CC = cc
AR = ar
SVB = thirdparty/streamvbyte
SVBLIB = $(SVB)/libstreamvbyte.a
CPPFLAGS += -I include/ -I $(SVB)/include/
CFLAGS += -g -Wall -O2 -std=c99
LDFLAGS += -lm -lz
ifeq ($(zstd),1)
CFLAGS += -DSLOW5_USE_ZSTD
LDFLAGS += -lzstd
endif
ifeq ($(zstd_local),)
else
CFLAGS += -DSLOW5_USE_ZSTD
CPPFLAGS += -I $(zstd_local)
endif
ifeq ($(slow5_mt),1)
CFLAGS += -DSLOW5_ENABLE_MT
LDFLAGS += -lpthread
endif
BUILD_DIR = lib
STATICLIB = $(BUILD_DIR)/libslow5.a
SHAREDLIB = $(BUILD_DIR)/libslow5.so
OBJ = $(BUILD_DIR)/slow5.o \
$(BUILD_DIR)/slow5_idx.o \
$(BUILD_DIR)/slow5_misc.o \
$(BUILD_DIR)/slow5_press.o \
$(BUILD_DIR)/slow5_mt.o \
PREFIX = /usr/local
VERSION = `git describe --tags`
SLOW5_H = include/slow5/slow5.h include/slow5/klib/khash.h include/slow5/klib/kvec.h include/slow5/slow5_defs.h include/slow5/slow5_error.h include/slow5/slow5_press.h
.PHONY: clean distclean test install uninstall slow5lib
#libslow5
slow5lib: $(SHAREDLIB) $(STATICLIB)
$(STATICLIB): $(OBJ) $(SVBLIB)
cp $(SVBLIB) $@
$(AR) rcs $@ $(OBJ)
$(SHAREDLIB): $(OBJ) $(SVBLIB)
$(CC) $(CFLAGS) -shared $^ -o $@ $(LDFLAGS)
$(SVBLIB):
$(MAKE) -C $(SVB) no_simd=$(no_simd) libstreamvbyte.a
$(BUILD_DIR)/slow5.o: src/slow5.c src/slow5_extra.h src/slow5_idx.h src/slow5_misc.h src/klib/ksort.h src/slow5_byte.h $(SLOW5_H)
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@
$(BUILD_DIR)/slow5_idx.o: src/slow5_idx.c src/slow5_idx.h src/slow5_extra.h src/slow5_misc.h src/slow5_byte.h $(SLOW5_H)
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@
$(BUILD_DIR)/slow5_misc.o: src/slow5_misc.c src/slow5_misc.h include/slow5/slow5_error.h
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@
$(BUILD_DIR)/slow5_press.o: src/slow5_press.c include/slow5/slow5_press.h src/slow5_misc.h include/slow5/slow5_error.h
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@
$(BUILD_DIR)/slow5_mt.o: src/slow5_mt.c include/slow5/slow5_mt.h $(SLOW5_H)
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -fpic -o $@
clean:
rm -rf $(OBJ) $(STATICLIB) $(SHAREDLIB) $(SHAREDLIBV)
$(MAKE) -C $(SVB) clean
# Delete all gitignored files (but not directories)
distclean: clean
git clean -f -X
rm -rf $(BUILD_DIR)/* autom4te.cache
test: slow5lib
$(MAKE) -C test clean
$(MAKE) -C test zstd=$(zstd)
./test/test.sh
pyslow5:
$(MAKE) clean
rm -rf *.so python/pyslow5.cpp python/pyslow5.c build/lib.* build/temp.* build/bdist.* sdist pyslow5.egg-info dist
python3 setup.py build
cp build/lib.*/*.so ./
python3 < python/example.py
rm -rf .eggs/
python3 setup.py sdist
test-prep: slow5lib
gcc test/make_blow5.c -Isrc src/slow5.c src/slow5_press.c -lm -lz src/slow5_idx.c src/slow5_misc.c -o test/bin/make_blow5 -g
./test/bin/make_blow5
valgrind: slow5lib
$(MAKE) -C test zstd=$(zstd)
./test/test.sh mem
examples: slow5lib
./examples/build.sh