-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
54 lines (41 loc) · 981 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
# Sub directories containing source code, except for the main programs
SUBDIRS := src
#
# Set libraries, paths, flags and options
#
#Basic flags every build needs
LIBS = -lz
CFLAGS ?= -O3 -std=c99 -fsigned-char -D_FILE_OFFSET_BITS=64 -g
LDFLAGS ?=
CC ?= gcc
LIBS=-lpthread -lz
# If HTSDIR is not set, default to system-wide htslib
ifndef HTSDIR
HTS_LIB=-lhts
HTS_INCLUDE=
else
HTS_LIB = $(HTSDIR)/libhts.a
HTS_INCLUDE = -I$(HTSDIR)/
endif
# Main programs to build
PROGRAM = bri
.PHONY: all
all: $(PROGRAM)
#
# Source files
#
# Find the source files by searching subdirectories
C_SRC := $(foreach dir, $(SUBDIRS), $(wildcard $(dir)/*.c))
# Automatically generated object names
C_OBJ = $(C_SRC:.c=.o)
.c.o:
$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $(HTS_INCLUDE) -fPIC $<
bri: $(C_OBJ)
$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(HTS_INCLUDE) -fPIC $(C_OBJ) $(HTS_LIB) $(LIBS)
.PHONY: test
test: $(TEST_PROGRAM)
./$(TEST_PROGRAM)
.PHONY: clean
clean:
rm -f $(PROGRAM) src/*.o