forked from waynebhayes/SANA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·267 lines (226 loc) · 8.82 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
ARCH=$(shell uname -a | awk '{if(/CYGWIN/){V="CYGWIN"}else if(/Darwin/){V="Darwin"}else if(/Linux/){V="Linux"}}END{if(V){print V;exit}else{print "unknown OS" > "/dev/stderr"; exit 1}}')
ARCH_FLAGS=$(shell ($(GCC) -v 2>&1; uname -a) | awk '/CYGWIN/{print "-U__STRICT_ANSI__"}')
MY_CC = g++
CXXFLAGS = -I "src/utils" "-DLIBWAYNE=1" -Wall -std=c++11 -pthread $(ARCH_FLAGS) #-pg -fno-inline
MAIN = sana
#you can give these on Make's command line, eg "SPARSE=1" or "FLOAT=1" or "MULTI=1"
#all can be mixed and matched except FLOAT and MULTI
#These should be listed roughly in order of how fast they run (fastest first, with the empty extension "sana" assumed fastest)
ifeq ($(MPI), 1)
CC = mpicxx
CXXFLAGS := $(CXXFLAGS) -DMULTI_MPI #-Bstatic for some versions of gcc
MAIN := $(MAIN).mpi
else
CC = $(MY_CC)
endif
ifeq ($(STATIC), 1)
CXXFLAGS := $(CXXFLAGS) -static #-Bstatic for some versions of gcc
MAIN := $(MAIN).static
endif
ifeq ($(CORES), 1)
CXXFLAGS := $(CXXFLAGS) -DCORES
MAIN := $(MAIN).cores
endif
ifeq ($(SPARSE), 1)
CXXFLAGS := $(CXXFLAGS) -DSPARSE
MAIN := $(MAIN).sparse
endif
ifeq ($(GDB), 1)
CXXFLAGS := $(CXXFLAGS) -ggdb
MAIN := $(MAIN).gdb
else
CXXFLAGS := $(CXXFLAGS) -O3 # always turn on optimization if not debugging
endif
## Below here are not "normal" pairwise SANA executables
ifeq ($(MULTI), 1)
CXXFLAGS := $(CXXFLAGS) -DMULTI_PAIRWISE
MAIN := $(MAIN).multi
endif
ifeq ($(FLOAT), 1)
CXXFLAGS := $(CXXFLAGS) -DFLOAT_WEIGHTS
MAIN := $(MAIN).float
endif
######## THIS ONE MUST BE LAST to ensure "MAIN=error" when an incompatible combination occurs ##################
ifeq ($(MULTI), 1)
ifeq ($(FLOAT), 1)
ERROR="SANA cannot currently use FLOAT in MULTI-alignments"
MAIN=error
endif
ifeq ($(CORES), 1)
ERROR="SANA cannot currently compute CORES in MULTI-alignments"
MAIN=error
endif
endif
INCLUDES =
LFLAGS =
LIBS =
METHODS_SRC = \
src/methods/SANA.cpp \
src/methods/HillClimbing.cpp \
src/methods/Method.cpp \
src/methods/NoneMethod.cpp \
src/methods/RandomAligner.cpp
UTILS_SRC = \
src/utils/NormalDistribution.cpp \
src/utils/templateUtils.cpp \
src/utils/Timer.cpp \
src/utils/utils.cpp \
src/utils/FileIO.cpp \
src/utils/randomSeed.cpp \
src/utils/LinearRegression.cpp \
src/utils/computeGraphlets.cpp \
src/utils/ComputeGraphletsWrapper.cpp \
src/utils/Matrix.cpp \
src/utils/Stats.cpp \
src/utils/Misc.cpp \
src/utils/SANAversion.cpp
ARGUMENTS_SRC = \
src/arguments/ArgumentParser.cpp \
src/arguments/modeSelector.cpp \
src/arguments/measureSelector.cpp \
src/arguments/MethodSelector.cpp \
src/arguments/GraphLoader.cpp \
src/arguments/SupportedArguments.cpp
MEASURES_SRCS = \
src/measures/EdgeCorrectness.cpp \
src/measures/EdgeDifference.cpp \
src/measures/EdgeRatio.cpp \
src/measures/MultiEdgeCorrectness.cpp \
src/measures/ExternalWeightedEdgeConservation.cpp \
src/measures/NetGO.cpp \
src/measures/InducedConservedStructure.cpp \
src/measures/InvalidMeasure.cpp \
src/measures/LargestCommonConnectedSubgraph.cpp \
src/measures/Measure.cpp \
src/measures/MeasureCombination.cpp \
src/measures/NodeCorrectness.cpp \
src/measures/SymmetricSubstructureScore.cpp \
src/measures/SymmetricEdgeCoverage.cpp \
src/measures/SquaredEdgeScore.cpp \
src/measures/EdgeExposure.cpp \
src/measures/WeightedEdgeConservation.cpp \
src/measures/JaccardSimilarityScore.cpp \
src/measures/MultiS3.cpp \
src/measures/CoreScore.cpp \
src/measures/localMeasures/EdgeCount.cpp \
src/measures/localMeasures/EdgeDensity.cpp \
src/measures/localMeasures/ExternalSimMatrix.cpp \
src/measures/localMeasures/GenericLocalMeasure.cpp \
src/measures/localMeasures/GoSimilarity.cpp \
src/measures/localMeasures/Graphlet.cpp \
src/measures/localMeasures/GraphletLGraal.cpp \
src/measures/localMeasures/Importance.cpp \
src/measures/localMeasures/LocalMeasure.cpp \
src/measures/localMeasures/NodeCount.cpp \
src/measures/localMeasures/NodeDensity.cpp \
src/measures/localMeasures/Sequence.cpp \
src/measures/localMeasures/GraphletCosine.cpp \
src/measures/localMeasures/GraphletNorm.cpp
METHOD_WRAPPERS_SRC = \
src/methods/wrappers/WrappedMethod.cpp \
src/methods/wrappers/HubAlignWrapper.cpp \
src/methods/wrappers/LGraalWrapper.cpp \
src/methods/wrappers/NETALWrapper.cpp \
src/methods/wrappers/MIGRAALWrapper.cpp \
src/methods/wrappers/GHOSTWrapper.cpp \
src/methods/wrappers/PISwapWrapper.cpp \
src/methods/wrappers/OptNetAlignWrapper.cpp \
src/methods/wrappers/SPINALWrapper.cpp \
src/methods/wrappers/GREATWrapper.cpp \
src/methods/wrappers/NATALIEWrapper.cpp \
src/methods/wrappers/GEDEVOWrapper.cpp \
src/methods/wrappers/MagnaWrapper.cpp \
src/methods/wrappers/WAVEWrapper.cpp \
src/methods/wrappers/PINALOGWrapper.cpp \
src/methods/wrappers/SANAPISWAPWrapper.cpp \
src/methods/wrappers/CytoGEDEVOWrapper.cpp
GOLDILOCKSMETHODS_SRC = \
src/goldilocksmethods/Ameur.cpp \
src/goldilocksmethods/IteratedAmeur.cpp \
src/goldilocksmethods/LinearRegressionModern.cpp \
src/goldilocksmethods/LinearRegressionVintage.cpp \
src/goldilocksmethods/PBadBinarySearch.cpp \
src/goldilocksmethods/GoldilocksMethod.cpp \
src/goldilocksmethods/goldilocksUtils.cpp \
src/goldilocksmethods/StatisticalTest.cpp \
src/goldilocksmethods/IteratedLinearRegression.cpp
MODES_SRC = \
src/modes/AlphaEstimation.cpp \
src/modes/Experiment.cpp \
src/modes/ParameterEstimation.cpp \
src/modes/NormalMode.cpp \
src/modes/CreateShadow.cpp \
src/modes/DebugMode.cpp \
src/modes/ClusterMode.cpp \
src/modes/AnalysisMode.cpp \
src/modes/SimilarityMode.cpp
OTHER_SRC = \
src/Graph.cpp \
src/Alignment.cpp \
src/complementaryProteins.cpp \
src/main.cpp \
src/Report.cpp
SRCS = $(METHODS_SRC) $(OTHER_SRC) $(UTILS_SRC) $(MEASURES_SRCS) $(METHOD_WRAPPERS_SRC) $(GOLDILOCKSMETHODS_SRC) $(ARGUMENTS_SRC) $(MODES_SRC)
OBJDIR = _objs
OBJS = $(addprefix $(OBJDIR)/, $(SRCS:.cpp=.o))
.PHONY: depend clean test test_all regression_test
all: parallel NetGO argumentCSV $(MAIN)
ifeq ($(MAIN), error)
error:
echo "ERROR: $(ERROR)">&2; exit 1
else
$(MAIN): $(OBJS)
$(CC) $(CXXFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
endif
#.c.o:
# $(CC) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
#$(OBJDIR)/%.o: %.c
# $(CC) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CC) -c $(INCLUDES) -o $@ $< $(CXXFLAGS)
# TEST_SRC is anything that ends in _UT (unit test)
TEST_SRC = $(wildcard test/*_UT.cpp)
# TEST_DEPENDS is all the OBJS without main and Gtest
_MAIN_OBJ = $(OBJDIR)/src/main.o
TEST_DEPENDS = $(filter-out $(_MAIN_OBJ), $(OBJS))
GTEST_OBJS = test/gtest/gtest-main.o test/gtest/gtest-all.o
TEST_OBJS = $(addprefix $(OBJDIR)/, $(TEST_SRC:.cpp=.o))
TEST_MAIN = unit_test
TEST_CXXFLAGS = $(CXXFLAGS) -lpthread # add pthread for Gtest
regression_test:
./regressionTest.sh
argumentCSV:
(cd src/arguments; ./create-csv.sh)
test_all: $(TEST_OBJS) $(GTEST_OBJS) $(TEST_DEPENDS)
$(CC) $(TEST_CXXFLAGS) $(INCLUDES) -o $(OBJDIR)/$(TEST_MAIN) $(TEST_OBJS) $(GTEST_OBJS) $(TEST_DEPENDS) $(LFLAGS) $(LIBS)
./$(OBJDIR)/$(TEST_MAIN)
test: $(OBJDIR)/test/$(tg).o $(GTEST_OBJS) $(TEST_DEPENDS)
$(CC) $(TEST_CXXFLAGS) $(INCLUDES) -o $(OBJDIR)/$(tg) $(OBJDIR)/test/$(tg).o $(GTEST_OBJS) $(TEST_DEPENDS) $(LFLAGS) $(LIBS)
./$(OBJDIR)/$(tg)
$(GTEST_OBJS):
cd test/gtest && make
clean: #clear_cache
$(RM) -rf cache* # mostly for pBad
$(RM) -rf $(OBJDIR)/src $(MAIN).exe $(MAIN)
$(RM) -f src/arguments/argumentTable.csv src/utils/SANAversion.cpp
$(RM) -f *.exe.stackdump core.[0-9]* # core dumps on CYGWIN + Unix, respectively
clear_cache:
rm -rf autogenerated
rm -rf matrices/autogenerated
rm -rf tmp
rm -rf networks/*/autogenerated
rm -rf cache_pbad
depend: $(SRCS)
makedepend $(INCLUDES) $^
# Here is the targets for making the wrappedAlgorithms
optnetalign:
cd wrappedAlgorithms/OptNetAlign/src; $(MAKE) optnetalignubuntu; chmod +x optnetalign; cp optnetalign ../
NetGO: /dev/null # always make
git submodule init
git submodule update
(cd NetGO && git checkout master && (git pull || exit 0)) # don't let network connectivity cause failure
parallel: src/parallel.c
gcc -o parallel src/parallel.c
src/utils/SANAversion.cpp: .git/HEAD .git/index Makefile
echo "const char *SANAversion = \"Version$(shell git show -s '--format=%d %H %ci') Compiled with gcc/g++ \" __VERSION__;" > $@