0
|
1 CC= gcc
|
|
2 CFLAGS= -g -Wall -O2
|
|
3 #LDFLAGS= -Wl,-rpath,\$$ORIGIN/../lib
|
|
4 DFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=0
|
|
5 KNETFILE_O= knetfile.o
|
|
6 LOBJS= bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \
|
|
7 bam_pileup.o bam_lpileup.o bam_md.o razf.o faidx.o bedidx.o \
|
|
8 $(KNETFILE_O) bam_sort.o sam_header.o bam_reheader.o kprobaln.o bam_cat.o
|
|
9 AOBJS= bam_tview.o bam_plcmd.o sam_view.o \
|
|
10 bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \
|
|
11 bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o \
|
|
12 cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o \
|
|
13 bam_tview_curses.o bam_tview_html.o
|
|
14 PROG= samtools
|
|
15 INCLUDES= -I.
|
|
16 SUBDIRS= . bcftools misc
|
|
17 LIBPATH=
|
|
18 LIBCURSES= # -lXCurses
|
|
19
|
|
20 .SUFFIXES:.c .o
|
|
21 .PHONY: all lib
|
|
22
|
|
23 .c.o:
|
|
24 $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
|
|
25
|
|
26 all-recur lib-recur clean-recur cleanlocal-recur install-recur:
|
|
27 @target=`echo $@ | sed s/-recur//`; \
|
|
28 wdir=`pwd`; \
|
|
29 list='$(SUBDIRS)'; for subdir in $$list; do \
|
|
30 cd $$subdir; \
|
|
31 $(MAKE) CC="$(CC)" DFLAGS="$(DFLAGS)" CFLAGS="$(CFLAGS)" \
|
|
32 INCLUDES="$(INCLUDES)" LIBPATH="$(LIBPATH)" $$target || exit 1; \
|
|
33 cd $$wdir; \
|
|
34 done;
|
|
35
|
|
36 all:$(PROG)
|
|
37
|
|
38 .PHONY:all lib clean cleanlocal
|
|
39 .PHONY:all-recur lib-recur clean-recur cleanlocal-recur install-recur
|
|
40
|
|
41 lib:libbam.a
|
|
42
|
|
43 libbam.a:$(LOBJS)
|
|
44 $(AR) -csru $@ $(LOBJS)
|
|
45
|
|
46 samtools:lib-recur $(AOBJS)
|
|
47 $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LDFLAGS) libbam.a -Lbcftools -lbcf $(LIBPATH) $(LIBCURSES) -lm -lz -lpthread
|
|
48
|
|
49 razip:razip.o razf.o $(KNETFILE_O)
|
|
50 $(CC) $(CFLAGS) -o $@ $^ -lz
|
|
51
|
|
52 bgzip:bgzip.o bgzf.o $(KNETFILE_O)
|
|
53 $(CC) $(CFLAGS) -o $@ $^ -lz -lpthread
|
|
54
|
|
55 bgzf.o:bgzf.c bgzf.h
|
|
56 $(CC) -c $(CFLAGS) $(DFLAGS) -DBGZF_CACHE $(INCLUDES) bgzf.c -o $@
|
|
57
|
|
58 razip.o:razf.h
|
|
59 bam.o:bam.h razf.h bam_endian.h kstring.h sam_header.h
|
|
60 sam.o:sam.h bam.h
|
|
61 bam_import.o:bam.h kseq.h khash.h razf.h
|
|
62 bam_pileup.o:bam.h razf.h ksort.h
|
|
63 bam_plcmd.o:bam.h faidx.h bcftools/bcf.h bam2bcf.h
|
|
64 bam_index.o:bam.h khash.h ksort.h razf.h bam_endian.h
|
|
65 bam_lpileup.o:bam.h ksort.h
|
|
66 bam_tview.o:bam.h faidx.h bam_tview.h
|
|
67 bam_tview_curses.o:bam.h faidx.h bam_tview.h
|
|
68 bam_tview_html.o:bam.h faidx.h bam_tview.h
|
|
69 bam_sort.o:bam.h ksort.h razf.h
|
|
70 bam_md.o:bam.h faidx.h
|
|
71 sam_header.o:sam_header.h khash.h
|
|
72 bcf.o:bcftools/bcf.h
|
|
73 bam2bcf.o:bam2bcf.h errmod.h bcftools/bcf.h
|
|
74 bam2bcf_indel.o:bam2bcf.h
|
|
75 errmod.o:errmod.h
|
|
76 phase.o:bam.h khash.h ksort.h
|
|
77 bamtk.o:bam.h
|
|
78
|
|
79 faidx.o:faidx.h razf.h khash.h
|
|
80 faidx_main.o:faidx.h razf.h
|
|
81
|
|
82
|
|
83 libbam.1.dylib-local:$(LOBJS)
|
|
84 libtool -dynamic $(LOBJS) -o libbam.1.dylib -lc -lz
|
|
85
|
|
86 libbam.so.1-local:$(LOBJS)
|
|
87 $(CC) -shared -Wl,-soname,libbam.so -o libbam.so.1 $(LOBJS) -lc -lz
|
|
88
|
|
89 dylib:
|
|
90 @$(MAKE) cleanlocal; \
|
|
91 case `uname` in \
|
|
92 Linux) $(MAKE) CFLAGS="$(CFLAGS) -fPIC" libbam.so.1-local;; \
|
|
93 Darwin) $(MAKE) CFLAGS="$(CFLAGS) -fPIC" libbam.1.dylib-local;; \
|
|
94 *) echo 'Unknown OS';; \
|
|
95 esac
|
|
96
|
|
97
|
|
98 cleanlocal:
|
|
99 rm -fr gmon.out *.o a.out *.exe *.dSYM razip bgzip $(PROG) *~ *.a *.so.* *.so *.dylib
|
|
100
|
|
101 clean:cleanlocal-recur
|