forked from lh3/samtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (88 loc) · 3.22 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
107
108
109
110
111
# The default version string in bam.h and bcftools/bcf.h can be overriden directly
# make VERSION="-DVERSION='\\\"my-version\\\"'"
# or using the git-stamp rule
# make git-stamp
VERSION=
CC= gcc
CFLAGS= -g -Wall $(VERSION) -O2
#LDFLAGS= -Wl,-rpath,\$$ORIGIN/../lib
DFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=1
KNETFILE_O= knetfile.o
LOBJS= bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \
bam_pileup.o bam_lpileup.o bam_md.o razf.o faidx.o bedidx.o \
$(KNETFILE_O) bam_sort.o sam_header.o bam_reheader.o kprobaln.o bam_cat.o
AOBJS= bam_tview.o bam_plcmd.o sam_view.o \
bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \
bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o \
cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o \
bam_tview_curses.o bam_tview_html.o
PROG= samtools
INCLUDES= -I.
SUBDIRS= . bcftools misc
LIBPATH=
LIBCURSES= -lcurses # -lXCurses
.SUFFIXES:.c .o
.PHONY: all lib
.c.o:
$(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
all-recur lib-recur clean-recur cleanlocal-recur install-recur:
@target=`echo $@ | sed s/-recur//`; \
wdir=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
cd $$subdir; \
$(MAKE) CC="$(CC)" DFLAGS="$(DFLAGS)" CFLAGS="$(CFLAGS)" \
INCLUDES="$(INCLUDES)" LIBPATH="$(LIBPATH)" $$target || exit 1; \
cd $$wdir; \
done;
all:$(PROG)
git-stamp:
make VERSION="-DVERSION='\\\"`git describe --always --dirty`\\\"'"
.PHONY:all lib clean cleanlocal
.PHONY:all-recur lib-recur clean-recur cleanlocal-recur install-recur
lib:libbam.a
libbam.a:$(LOBJS)
$(AR) -csru $@ $(LOBJS)
samtools:lib-recur $(AOBJS)
$(CC) $(CFLAGS) -o $@ $(AOBJS) $(LDFLAGS) libbam.a -Lbcftools -lbcf $(LIBPATH) $(LIBCURSES) -lm -lz -lpthread
razip:razip.o razf.o $(KNETFILE_O)
$(CC) $(CFLAGS) -o $@ $^ -lz
bgzip:bgzip.o bgzf.o $(KNETFILE_O)
$(CC) $(CFLAGS) -o $@ $^ -lz -lpthread
bgzf.o:bgzf.c bgzf.h
$(CC) -c $(CFLAGS) $(DFLAGS) -DBGZF_CACHE $(INCLUDES) bgzf.c -o $@
razip.o:razf.h
bam.o:bam.h razf.h bam_endian.h kstring.h sam_header.h
sam.o:sam.h bam.h
bam_import.o:bam.h kseq.h khash.h razf.h
bam_pileup.o:bam.h razf.h ksort.h
bam_plcmd.o:bam.h faidx.h bcftools/bcf.h bam2bcf.h
bam_index.o:bam.h khash.h ksort.h razf.h bam_endian.h
bam_lpileup.o:bam.h ksort.h
bam_tview.o:bam.h faidx.h bam_tview.h
bam_tview_curses.o:bam.h faidx.h bam_tview.h
bam_tview_html.o:bam.h faidx.h bam_tview.h
bam_sort.o:bam.h ksort.h razf.h
bam_md.o:bam.h faidx.h
sam_header.o:sam_header.h khash.h
bcf.o:bcftools/bcf.h
bam2bcf.o:bam2bcf.h errmod.h bcftools/bcf.h
bam2bcf_indel.o:bam2bcf.h
errmod.o:errmod.h
phase.o:bam.h khash.h ksort.h
bamtk.o:bam.h
faidx.o:faidx.h razf.h khash.h
faidx_main.o:faidx.h razf.h
libbam.1.dylib-local:$(LOBJS)
libtool -dynamic $(LOBJS) -o libbam.1.dylib -lc -lz
libbam.so.1-local:$(LOBJS)
$(CC) -shared -Wl,-soname,libbam.so -o libbam.so.1 $(LOBJS) -lc -lz
dylib:
@$(MAKE) cleanlocal; \
case `uname` in \
Linux) $(MAKE) CFLAGS="$(CFLAGS) -fPIC" libbam.so.1-local;; \
Darwin) $(MAKE) CFLAGS="$(CFLAGS) -fPIC" libbam.1.dylib-local;; \
*) echo 'Unknown OS';; \
esac
cleanlocal:
rm -fr gmon.out *.o a.out *.exe *.dSYM razip bgzip $(PROG) *~ *.a *.so.* *.so *.dylib
clean:cleanlocal-recur