-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
154 lines (109 loc) · 2.94 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# DLCoal
# Matt Rasmussen
# Copyright 2012
#
# Makefile
#
# install prefix paths
prefix = /usr
# C++ compiler options
CXX = g++
CFLAGS := $(CFLAGS) \
-Wall -fPIC \
-Isrc
#=============================================================================
# optional CFLAGS
# profiling
ifdef PROFILE
CFLAGS := $(CFLAGS) -pg
endif
# debugging
ifdef DEBUG
CFLAGS := $(CFLAGS) -g
else
CFLAGS := $(CFLAGS) -O3
endif
#=============================================================================
# DLCoal files
# package
PKG_VERSION:=$(shell python -c 'import dlcoal; print dlcoal.PROGRAM_VERSION_TEXT')
PKG_NAME=dlcoal
PKG=dist/$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_DIR=dist/$(PKG_NAME)-$(PKG_VERSION)
# program files
SCRIPTS = bin/dlcoal_recon \
bin/dlcoal_sim \
bin/mpr \
bin/view_recon
BINARIES = $(SCRIPTS)
DLCOAL_SRC = \
src/coal.cpp \
src/duploss.cpp \
src/itree.cpp \
src/spidir/birthdeath.cpp \
src/spidir/common.cpp \
src/spidir/logging.cpp \
src/spidir/phylogeny.cpp \
src/spidir/Tree.cpp \
src/spidir/top_prior.cpp \
DLCOAL_OBJS = $(DLCOAL_SRC:.cpp=.o)
LIBS =
# `gsl-config --libs`
#-lgsl -lgslcblas -lm
#=======================
# DLCoal C-library files
LIBDLCOAL = lib/libdlcoal.a
LIBDLCOAL_SHARED_NAME = libdlcoal.so
LIBDLCOAL_SHARED = lib/$(LIBDLCOAL_SHARED_NAME)
LIBDLCOAL_SHARED_INSTALL = $(prefix)/lib/$(LIBDLCOAL_SHARED_NAME)
LIBDLCOAL_OBJS = $(DLCOAL_OBJS)
#=============================================================================
# targets
# default targets
all: $(LIBDLCOAL) $(LIBDLCOAL_SHARED)
#-----------------------------
# DLCOAL C-library
lib: $(LIBDLCOAL) $(LIBDLCOAL_SHARED)
$(LIBDLCOAL): $(LIBDLCOAL_OBJS)
mkdir -p lib
$(AR) -r $(LIBDLCOAL) $(LIBDLCOAL_OBJS)
$(LIBDLCOAL_SHARED): $(LIBDLCOAL_OBJS)
mkdir -p lib
$(CXX) -o $(LIBDLCOAL_SHARED) -shared $(LIBDLCOAL_OBJS) $(LIBS)
#-----------------------------
# packaging
pkg:
python make-pkg.py $(PKG_DIR)
$(PKG):
python make-pkg.py $(PKG_DIR)
#-----------------------------
# install
install: $(BINARIES) $(LIBDLCOAL_SHARED_INSTALL)
mkdir -p $(prefix)/bin
cp $(BINARIES) $(prefix)/bin
echo $(LIBDLCOAL_SHARED_INSTALL)
python setup.py install --prefix=$(prefix)
pylib: $(LIBDLCOAL_SHARED_INSTALL)
python setup.py install --prefix=$(prefix)
$(LIBDLCOAL_SHARED_INSTALL): $(LIBDLCOAL_SHARED)
mkdir -p $(prefix)/lib
cp $(LIBDLCOAL_SHARED) $(LIBDLCOAL_SHARED_INSTALL)
#=============================================================================
# basic rules
$(DLCOAL_OBJS): %.o: %.cpp
$(CXX) -c $(CFLAGS) -o $@ $<
clean:
rm -f $(DLCOAL_OBJS) $(LIBDLCOAL) $(LIBDLCOAL_SHARED)
clean-obj:
rm -f $(DLCOAL_OBJS)
#=============================================================================
# dependencies
dep:
touch Makefile.dep
makedepend -f Makefile.dep -Y src/*.cpp src/*.h
Makefile.dep:
touch Makefile.dep
makedepend -f Makefile.dep -Y src/*.cpp src/*.h
include Makefile.dep
# DO NOT DELETE