-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
74 lines (57 loc) · 1.49 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
CC = gcc
CFLAGS = -W -Wall -finline-functions -fPIC -std=gnu99 -Wno-unused-result -O3
CLIB = -lz -lm -llzma -lbz2 -lcurl
CF_OPTIMIZE = 1
OS := $(shell uname)
ifeq ($(OS), Darwin)
CFLAGS += -Wno-unused-function
endif
INCLUDE = include
########################
### different modes ####
########################
PROG = dupsifter
.PHONY : profile debug build
build: exportcf $(PROG)
profile: CF_OPTIMIZE := 0
profile: CFLAGS += -pg
profile: CFLAGS := $(filter-out -O3,$(CFLAGS))
profile: build
debug: CF_OPTIMIZE := 0
debug: CFLAGS += -g
debug: CFLAGS := $(filter-out -O3,$(CFLAGS))
debug: build
exportcf:
$(eval export CF_OPTIMIZE)
#####################
##### libraries #####
#####################
LHTSLIB_DIR = htslib-1.15.1
LHTSLIB_INCLUDE = $(LHTSLIB_DIR)/htslib
LHTSLIB = $(LHTSLIB_DIR)/libhts.a
$(LHTSLIB) :
make -C $(LHTSLIB_DIR) libhts.a
# Main program
LIBS = $(LHTSLIB)
dupsifter: $(LIBS) dupsifter.o
$(CC) $(CFLAGS) dupsifter.o -o $@ -I$(LHTSLIB_INCLUDE) $(LIBS) $(CLIB)
dupsifter.o: dupsifter.c
$(CC) -c $(CFLAGS) dupsifter.c -o $@ -I$(LHTSLIB_INCLUDE)
# Clean
.PHONY: clean
clean:
rm -f dupsifter dupsifter.o
purge: clean
make -C $(LHTSLIB_DIR) clean
## clean to make a release zip
.PHONY: release
release:
rm -rf release-source.zip dupsifter-release
git clone . dupsifter-release
make -C dupsifter-release cleanse
zip -r release-source.zip dupsifter-release
rm -rf dupsifter-release
# removes git history, for release internal use
cleanse : purge
rm -f **/*.o .gitignore
rm -rf .git