e2790d494e59d54df6e7e77ed0b1bc943e6f4b16
[libdai.git] / Makefile.shared
1 # Copyright (C) 2006-2008 Joris Mooij [joris dot mooij at tuebingen dot mpg dot de]
2 # Radboud University Nijmegen, The Netherlands /
3 # Max Planck Institute for Biological Cybernetics, Germany
4 #
5 # This file is part of libDAI.
6 #
7 # libDAI is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # libDAI is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with libDAI; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
21
22 ifdef DEBUG
23 CCFLAGS:=$(CCFLAGS) $(CCDEBUGFLAGS)
24 endif
25 ifdef WINDOWS
26 CCFLAGS:=$(CCFLAGS) -DWINDOWS
27 endif
28 ifdef WITH_MATLAB
29 TARGETS:=$(TARGETS) matlabs
30 ifdef DEBUG
31 MEXFLAGS:=$(MEXFLAGS) $(CCDEBUGFLAGS)
32 endif
33 ifdef NEW_MATLAB
34 MEXFLAGS:=$(MEXFLAGS) -largeArrayDims
35 else
36 MEXFLAGS:=$(MEXFLAGS) -DSMALLMEM
37 endif
38 endif
39
40
41 OBJECTS:=exactinf$(OE)
42 ifdef WITH_BP
43 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_BP
44 OBJECTS:=$(OBJECTS) bp$(OE)
45 endif
46 ifdef WITH_MF
47 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_MF
48 OBJECTS:=$(OBJECTS) mf$(OE)
49 endif
50 ifdef WITH_HAK
51 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_HAK
52 OBJECTS:=$(OBJECTS) hak$(OE)
53 endif
54 ifdef WITH_LC
55 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_LC
56 OBJECTS:=$(OBJECTS) lc$(OE)
57 endif
58 ifdef WITH_TREEEP
59 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_TREEEP
60 OBJECTS:=$(OBJECTS) treeep$(OE)
61 endif
62 ifdef WITH_JTREE
63 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_JTREE
64 OBJECTS:=$(OBJECTS) jtree$(OE)
65 endif
66 ifdef WITH_MR
67 CCFLAGS:=$(CCFLAGS) -DDAI_WITH_MR
68 OBJECTS:=$(OBJECTS) mr$(OE)
69 endif
70
71
72 HEADERS=$(INC)/bipgraph.h $(INC)/index.h $(INC)/var.h $(INC)/factor.h $(INC)/varset.h $(INC)/smallset.h $(INC)/prob.h $(INC)/daialg.h $(INC)/properties.h $(INC)/alldai.h $(INC)/enum.h $(INC)/exceptions.h
73
74
75 all : $(TARGETS)
76
77 examples : examples/example$(EE) examples/example_bipgraph$(EE) examples/example_varset$(EE)
78
79 matlabs : matlab/dai$(ME) matlab/dai_readfg$(ME) matlab/dai_writefg$(ME) matlab/dai_potstrength$(ME)
80
81 tests : tests/testdai$(EE)
82
83 utils : utils/createfg$(EE) utils/fg2dot$(EE) utils/fginfo$(EE)
84
85
86 bipgraph$(OE) : $(SRC)/bipgraph.cpp $(HEADERS)
87 $(CC) $(CCFLAGS) -c $(SRC)/bipgraph.cpp
88
89 daialg$(OE) : $(SRC)/daialg.cpp $(HEADERS)
90 $(CC) $(CCFLAGS) -c $(SRC)/daialg.cpp
91
92 exactinf$(OE) : $(SRC)/exactinf.cpp $(INC)/exactinf.h $(HEADERS)
93 $(CC) $(CCFLAGS) -c $(SRC)/exactinf.cpp
94
95 bp$(OE) : $(SRC)/bp.cpp $(INC)/bp.h $(HEADERS)
96 $(CC) $(CCFLAGS) -c $(SRC)/bp.cpp
97
98 lc$(OE) : $(SRC)/lc.cpp $(INC)/lc.h $(HEADERS)
99 $(CC) $(CCFLAGS) -c $(SRC)/lc.cpp
100
101 mf$(OE) : $(SRC)/mf.cpp $(INC)/mf.h $(HEADERS)
102 $(CC) $(CCFLAGS) -c $(SRC)/mf.cpp
103
104 factorgraph$(OE) : $(SRC)/factorgraph.cpp $(INC)/factorgraph.h $(HEADERS)
105 $(CC) $(CCFLAGS) -c $(SRC)/factorgraph.cpp
106
107 util$(OE) : $(SRC)/util.cpp $(INC)/util.h $(HEADERS)
108 $(CC) $(CCFLAGS) -c $(SRC)/util.cpp
109
110 regiongraph$(OE) : $(SRC)/regiongraph.cpp $(INC)/regiongraph.h $(HEADERS)
111 $(CC) $(CCFLAGS) -c $(SRC)/regiongraph.cpp
112
113 hak$(OE) : $(SRC)/hak.cpp $(INC)/hak.h $(HEADERS) $(INC)/regiongraph.h
114 $(CC) $(CCFLAGS) -c $(SRC)/hak.cpp
115
116 clustergraph$(OE) : $(SRC)/clustergraph.cpp $(INC)/clustergraph.h $(HEADERS)
117 $(CC) $(CCFLAGS) -c $(SRC)/clustergraph.cpp
118
119 jtree$(OE) : $(SRC)/jtree.cpp $(INC)/jtree.h $(HEADERS) $(INC)/weightedgraph.h $(INC)/clustergraph.h $(INC)/regiongraph.h
120 $(CC) $(CCFLAGS) -c $(SRC)/jtree.cpp
121
122 treeep$(OE) : $(SRC)/treeep.cpp $(INC)/treeep.h $(HEADERS) $(INC)/weightedgraph.h $(INC)/clustergraph.h $(INC)/regiongraph.h $(INC)/jtree.h
123 $(CC) $(CCFLAGS) -c $(SRC)/treeep.cpp
124
125 weightedgraph$(OE) : $(SRC)/weightedgraph.cpp $(INC)/weightedgraph.h $(HEADERS)
126 $(CC) $(CCFLAGS) -c $(SRC)/weightedgraph.cpp
127
128 mr$(OE) : $(SRC)/mr.cpp $(INC)/mr.h $(HEADERS)
129 $(CC) $(CCFLAGS) -c $(SRC)/mr.cpp
130
131 properties$(OE) : $(SRC)/properties.cpp $(HEADERS)
132 $(CC) $(CCFLAGS) -c $(SRC)/properties.cpp
133
134 exceptions$(OE) : $(SRC)/exceptions.cpp $(HEADERS)
135 $(CC) $(CCFLAGS) -c $(SRC)/exceptions.cpp
136
137 alldai$(OE) : $(SRC)/alldai.cpp $(HEADERS)
138 $(CC) $(CCFLAGS) -c $(SRC)/alldai.cpp
139
140
141 # EXAMPLES
142 ###########
143
144 examples/example$(EE) : examples/example.cpp $(HEADERS) $(LIB)/libdai$(LE)
145 $(CC) $(CCFLAGS) $(CCO)examples/example$(EE) examples/example.cpp $(LIBS)
146
147 examples/example_bipgraph$(EE) : examples/example_bipgraph.cpp $(HEADERS) $(LIB)/libdai$(LE)
148 $(CC) $(CCFLAGS) $(CCO)examples/example_bipgraph$(EE) examples/example_bipgraph.cpp $(LIBS)
149
150 examples/example_varset$(EE) : examples/example_varset.cpp $(HEADERS) $(LIB)/libdai$(LE)
151 $(CC) $(CCFLAGS) $(CCO)examples/example_varset$(EE) examples/example_varset.cpp $(LIBS)
152
153
154 # TESTS
155 ########
156
157 tests/testdai$(EE) : tests/testdai.cpp $(HEADERS) $(LIB)/libdai$(LE)
158 $(CC) $(CCFLAGS) $(CCO)tests/testdai$(EE) tests/testdai.cpp $(LIBS) $(BOOSTLIBS)
159
160
161 # MATLAB INTERFACE
162 ###################
163
164 matlab/dai$(ME) : $(SRC)/matlab/dai.cpp $(HEADERS) matlab$(OE) $(LIB)/libdai$(LE)
165 $(MEX) $(MEXFLAGS) -o matlab/dai $(SRC)/matlab/dai.cpp matlab$(OE) $(LIB)/libdai$(LE)
166
167 matlab/dai_readfg$(ME) : $(SRC)/matlab/dai_readfg.cpp $(HEADERS) factorgraph$(OE) matlab$(OE) exceptions$(OE)
168 $(MEX) $(MEXFLAGS) -o matlab/dai_readfg $(SRC)/matlab/dai_readfg.cpp factorgraph$(OE) matlab$(OE) exceptions$(OE)
169
170 matlab/dai_writefg$(ME) : $(SRC)/matlab/dai_writefg.cpp $(HEADERS) factorgraph$(OE) matlab$(OE) exceptions$(OE)
171 $(MEX) $(MEXFLAGS) -o matlab/dai_writefg $(SRC)/matlab/dai_writefg.cpp factorgraph$(OE) matlab$(OE) exceptions$(OE)
172
173 matlab/dai_potstrength$(ME) : $(SRC)/matlab/dai_potstrength.cpp $(HEADERS) matlab$(OE) exceptions$(OE)
174 $(MEX) $(MEXFLAGS) -o matlab/dai_potstrength $(SRC)/matlab/dai_potstrength.cpp matlab$(OE) exceptions$(OE)
175
176 matlab$(OE) : $(SRC)/matlab/matlab.cpp $(INC)/matlab/matlab.h $(HEADERS)
177 $(MEX) $(MEXFLAGS) -c $(SRC)/matlab/matlab.cpp
178
179
180 # UTILS
181 ########
182
183 utils/createfg$(EE) : utils/createfg.cpp $(HEADERS) $(LIB)/libdai$(LE)
184 $(CC) $(CCFLAGS) $(CCO)utils/createfg$(EE) utils/createfg.cpp $(LIBS) $(BOOSTLIBS)
185
186 utils/fg2dot$(EE) : utils/fg2dot.cpp $(HEADERS) $(LIB)/libdai$(LE)
187 $(CC) $(CCFLAGS) $(CCO)utils/fg2dot$(EE) utils/fg2dot.cpp $(LIBS)
188
189 utils/fginfo$(EE) : utils/fginfo.cpp $(HEADERS) $(LIB)/libdai$(LE)
190 $(CC) $(CCFLAGS) $(CCO)utils/fginfo$(EE) utils/fginfo.cpp $(LIBS)