forked from ANGSD/angsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (64 loc) · 1.99 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
CC ?= gcc
CXX ?= g++
LIBS = -lz -lm -lbz2 -llzma -lpthread -lcurl
# Adjust $(HTSSRC) to point to your top-level htslib directory
ifdef HTSSRC
$(info HTSSRC defined)
CPPFLAGS += -I$(realpath $(HTSSRC))
LIBS := $(realpath $(HTSSRC))/libhts.a $(LIBS)
else
$(info HTSSRC not defined, assuming systemwide installation)
LIBS += -lhts
endif
#modied from htslib makefile
FLAGS = $(CPPFLAGS) -O3 $(LDFLAGS)
CFLAGS := $(FLAGS) $(CFLAGS)
CXXFLAGS := $(FLAGS) $(CXXFLAGS)
CSRC = $(wildcard *.c)
CXXSRC = $(wildcard *.cpp)
OBJ = $(CSRC:.c=.o) $(CXXSRC:.cpp=.o)
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
INSTALL = install
INSTALL_DIR = $(INSTALL) -dm0755
INSTALL_PROGRAM = $(INSTALL) -Dm0755
PROGRAMS = angsd
all: $(PROGRAMS) misc
BAMDIR=""
BDIR=$(realpath $(BAMDIR))
PACKAGE_VERSION = 0.929
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 ANGSD_VERSION "$(PACKAGE_VERSION)"' > $@
.PHONY: all clean install install-all install-misc misc test
misc: analysisFunction.o bfgs.o prep_sites.o
$(MAKE) -C misc HTSSRC=$(realpath $(HTSSRC))
-include $(OBJ:.o=.d)
%.o: %.c
$(CC) -c $(CFLAGS) $*.c
$(CC) -MM $(CFLAGS) $*.c >$*.d
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $*.cpp
$(CXX) -MM $(CXXFLAGS) $*.cpp >$*.d
angsd: version.h $(OBJ)
$(CXX) $(FLAGS) -o angsd *.o $(LIBS)
testclean:
rm -rf test/sfstest/output test/tajima/output test/*.log version.h test/temp.txt
clean: testclean
rm -f *.o *.d $(PROGRAMS) version.h *~
$(MAKE) -C misc clean
test:
echo "Only subset of analyses is being tested"
cd test;./testAll.sh ../angsd $(BDIR)
force:
install: all
$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) $(PROGRAMS) $(DESTDIR)$(bindir)
$(MAKE) -C misc HTSSRC=$(realpath $(HTSSRC)) install
install-misc: misc
$(MAKE) -C misc HTSSRC=$(realpath $(HTSSRC)) install-misc
install-all: install install-misc