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