forked from samtools/bcftools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (73 loc) · 2.72 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
PROG= bcftools
TEST_PROG= test/test-rbuf
all: $(PROG) $(TEST_PROG)
# Adjust $(HTSDIR) to point to your top-level htslib directory
HTSDIR = ../htslib
include $(HTSDIR)/htslib.mk
HTSLIB = $(HTSDIR)/libhts.a
CC= gcc
CFLAGS= -g -Wall -Wc++-compat -O2
DFLAGS=
OBJS= main.o vcfindex.o tabix.o \
vcfstats.o vcfisec.o vcfmerge.o vcfquery.o vcffilter.o filter.o vcfsom.o \
vcfnorm.o vcfgtcheck.o vcfview.o vcfannotate.o vcfroh.o vcfconcat.o \
vcfcall.o mcall.o vcmp.o \
ccall.o em.o prob1.o kmin.o # the original samtools calling
INCLUDES= -I. -I$(HTSDIR)
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
mandir = $(prefix)/share/man
man1dir = $(mandir)/man1
INSTALL = install -p
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
all:$(PROG) plugins
# See htslib/Makefile
PACKAGE_VERSION = 0.0.1
ifneq "$(wildcard .git)" ""
PACKAGE_VERSION := $(shell git describe --always --dirty)
version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force))
endif
version.h:
echo '#define BCFTOOLS_VERSION "$(PACKAGE_VERSION)"' > $@
.SUFFIXES:.c .o
.PHONY:all clean clean-all distclean install lib tags test testclean force plugins
force:
%.o: %.c $(HTSDIR)/htslib/vcf.h $(HTSDIR)/htslib/synced_bcf_reader.h
$(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
test: $(PROG) plugins test/test-rbuf
./test/test.pl
PLUGINC = $(foreach dir, plugins, $(wildcard $(dir)/*.c))
PLUGINS = $(PLUGINC:.c=.so)
plugins: $(PLUGINS)
%.so: %.c version.h version.c config.c config.h vcfannotate.c $(HTSDIR)/libhts.so
$(CC) $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ config.c version.c $< -L$(HTSDIR) -lhts
main.o: version.h $(HTSDIR)/version.h bcftools.h
vcfcall.o: vcfcall.c call.h mcall.c prob1.h $(HTSDIR)/htslib/kfunc.h bcftools.h
mcall.o ccall.o: call.h vcmp.h bcftools.h
vcffilter.o: bcftools.h filter.h
vcfsubset.o: bcftools.h filter.h
vcfnorm.o: bcftools.h rbuf.h
vcffilter.o: bcftools.h rbuf.h
vcfroh.o: bcftools.h rbuf.h
vcfannotate.o: bcftools.h vcmp.h $(HTSDIR)/htslib/kseq.h
vcfconcat.o: bcftools.h
test/test-rbuf.o: rbuf.h test/test-rbuf.c
test/test-rbuf: test/test-rbuf.o
$(CC) $(CFLAGS) -o $@ -lm -ldl $<
bcftools: $(HTSLIB) $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(HTSLIB) -lpthread -lz -lm -ldl
install: $(PROG)
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
$(INSTALL_PROGRAM) $(PROG) plot-vcfstats vcfutils.pl $(DESTDIR)$(bindir)
$(INSTALL_DATA) bcftools.1 $(DESTDIR)$(man1dir)
clean: testclean
rm -fr gmon.out *.o a.out *.dSYM *~ $(PROG) version.h plugins/*.so
testclean:
rm -fr test/*.o test/*~ $(TEST_PROG)
distclean: clean
-rm -f TAGS
clean-all: clean clean-htslib
tags:
ctags -f TAGS *.[ch] plugins/*.[ch]