1 # Copyright (C) 2006-2009 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
5 # This file is part of libDAI.
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.
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.
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
22 # Load the local configuration from Makefile.conf
25 # Directories of libDAI sources
26 # Location libDAI headers
28 # Location of libDAI source files
30 # Destination directory of libDAI library
33 # Define build targets
34 TARGETS
=tests utils lib examples testregression testem
36 TARGETS
:=$(TARGETS
) doc
39 TARGETS
:=$(TARGETS
) matlabs
41 MEXFLAGS
:=$(MEXFLAGS
) -largeArrayDims
43 MEXFLAGS
:=$(MEXFLAGS
) -DSMALLMEM
47 # Define conditional build targets
48 OBJECTS
:=exactinf
$(OE
) evidence
$(OE
) emalg
$(OE
)
50 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_BP
51 OBJECTS
:=$(OBJECTS
) bp
$(OE
)
54 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MF
55 OBJECTS
:=$(OBJECTS
) mf
$(OE
)
58 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_HAK
59 OBJECTS
:=$(OBJECTS
) hak
$(OE
)
62 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_LC
63 OBJECTS
:=$(OBJECTS
) lc
$(OE
)
66 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_TREEEP
67 OBJECTS
:=$(OBJECTS
) treeep
$(OE
)
70 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_JTREE
71 OBJECTS
:=$(OBJECTS
) jtree
$(OE
)
74 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MR
75 OBJECTS
:=$(OBJECTS
) mr
$(OE
)
78 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_GIBBS
79 OBJECTS
:=$(OBJECTS
) gibbs
$(OE
)
82 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_CBP
83 OBJECTS
:=$(OBJECTS
) bbp
$(OE
) cbp
$(OE
) bp_dual
$(OE
)
87 # Define standard libDAI header dependencies
88 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
$(INC
)/util.h
90 # Setup final command for C++ compiler and MEX
92 CCFLAGS
:=$(CCFLAGS
) $(CCDEBUGFLAGS
)
95 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
) $(CCLIB
)
97 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
)
98 LIBS
:=$(LIBS
) $(CCLIB
)
100 MEX
:=$(MEX
) $(CCLIB
) $(CCINC
) $(MEXFLAGS
)
108 examples
: examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_sprinkler
$(EE
)
110 matlabs
: matlab
/dai
$(ME
) matlab
/dai_readfg
$(ME
) matlab
/dai_writefg
$(ME
) matlab
/dai_potstrength
$(ME
)
112 tests
: tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
114 utils
: utils
/createfg
$(EE
) utils
/fg2dot
$(EE
) utils
/fginfo
$(EE
)
116 lib
: $(LIB
)/libdai
$(LE
)
122 bipgraph
$(OE
) : $(SRC
)/bipgraph.
cpp $(HEADERS
)
123 $(CC
) -c
$(SRC
)/bipgraph.
cpp
125 daialg
$(OE
) : $(SRC
)/daialg.
cpp $(HEADERS
)
126 $(CC
) -c
$(SRC
)/daialg.
cpp
128 exactinf
$(OE
) : $(SRC
)/exactinf.
cpp $(INC
)/exactinf.h
$(HEADERS
)
129 $(CC
) -c
$(SRC
)/exactinf.
cpp
131 bp
$(OE
) : $(SRC
)/bp.
cpp $(INC
)/bp.h
$(HEADERS
)
132 $(CC
) -c
$(SRC
)/bp.
cpp
134 bp_dual
$(OE
) : $(SRC
)/bp_dual.
cpp $(INC
)/bp_dual.h
$(HEADERS
)
135 $(CC
) -c
$(SRC
)/bp_dual.
cpp
137 bbp
$(OE
) : $(SRC
)/bbp.
cpp $(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
138 $(CC
) -c
$(SRC
)/bbp.
cpp
140 cbp
$(OE
) : $(SRC
)/cbp.
cpp $(INC
)/cbp.h
$(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
141 $(CC
) -c
$(SRC
)/cbp.
cpp
143 lc
$(OE
) : $(SRC
)/lc.
cpp $(INC
)/lc.h
$(HEADERS
)
144 $(CC
) -c
$(SRC
)/lc.
cpp
146 mf
$(OE
) : $(SRC
)/mf.
cpp $(INC
)/mf.h
$(HEADERS
)
147 $(CC
) -c
$(SRC
)/mf.
cpp
149 factorgraph
$(OE
) : $(SRC
)/factorgraph.
cpp $(INC
)/factorgraph.h
$(HEADERS
)
150 $(CC
) -c
$(SRC
)/factorgraph.
cpp
152 util
$(OE
) : $(SRC
)/util.
cpp $(INC
)/util.h
$(HEADERS
)
153 $(CC
) -c
$(SRC
)/util.
cpp
155 regiongraph
$(OE
) : $(SRC
)/regiongraph.
cpp $(INC
)/regiongraph.h
$(HEADERS
)
156 $(CC
) -c
$(SRC
)/regiongraph.
cpp
158 hak
$(OE
) : $(SRC
)/hak.
cpp $(INC
)/hak.h
$(HEADERS
) $(INC
)/regiongraph.h
159 $(CC
) -c
$(SRC
)/hak.
cpp
161 clustergraph
$(OE
) : $(SRC
)/clustergraph.
cpp $(INC
)/clustergraph.h
$(HEADERS
)
162 $(CC
) -c
$(SRC
)/clustergraph.
cpp
164 jtree
$(OE
) : $(SRC
)/jtree.
cpp $(INC
)/jtree.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
165 $(CC
) -c
$(SRC
)/jtree.
cpp
167 treeep
$(OE
) : $(SRC
)/treeep.
cpp $(INC
)/treeep.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
$(INC
)/jtree.h
168 $(CC
) -c
$(SRC
)/treeep.
cpp
170 weightedgraph
$(OE
) : $(SRC
)/weightedgraph.
cpp $(INC
)/weightedgraph.h
$(HEADERS
)
171 $(CC
) -c
$(SRC
)/weightedgraph.
cpp
173 mr
$(OE
) : $(SRC
)/mr.
cpp $(INC
)/mr.h
$(HEADERS
)
174 $(CC
) -c
$(SRC
)/mr.
cpp
176 gibbs
$(OE
) : $(SRC
)/gibbs.
cpp $(INC
)/gibbs.h
$(HEADERS
)
177 $(CC
) -c
$(SRC
)/gibbs.
cpp
179 evidence
$(OE
) : $(SRC
)/evidence.
cpp $(INC
)/evidence.h
$(HEADERS
)
180 $(CC
) -c
$(SRC
)/evidence.
cpp
182 emalg
$(OE
) : $(SRC
)/emalg.
cpp $(INC
)/emalg.h
$(INC
)/evidence.h
$(HEADERS
)
183 $(CC
) -c
$(SRC
)/emalg.
cpp
185 properties
$(OE
) : $(SRC
)/properties.
cpp $(HEADERS
)
186 $(CC
) -c
$(SRC
)/properties.
cpp
188 exceptions
$(OE
) : $(SRC
)/exceptions.
cpp $(HEADERS
)
189 $(CC
) -c
$(SRC
)/exceptions.
cpp
191 alldai
$(OE
) : $(SRC
)/alldai.
cpp $(HEADERS
)
192 $(CC
) -c
$(SRC
)/alldai.
cpp
198 examples
/example
$(EE
) : examples
/example.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
199 $(CC
) $(CCO
)examples
/example
$(EE
) examples
/example.
cpp $(LIBS
)
201 examples
/example_bipgraph
$(EE
) : examples
/example_bipgraph.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
202 $(CC
) $(CCO
)examples
/example_bipgraph
$(EE
) examples
/example_bipgraph.
cpp $(LIBS
)
204 examples
/example_varset
$(EE
) : examples
/example_varset.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
205 $(CC
) $(CCO
)examples
/example_varset
$(EE
) examples
/example_varset.
cpp $(LIBS
)
207 examples
/example_sprinkler
$(EE
) : examples
/example_sprinkler.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
208 $(CC
) $(CCO
)examples
/example_sprinkler
$(EE
) examples
/example_sprinkler.
cpp $(LIBS
)
214 tests
/testdai
$(EE
) : tests
/testdai.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
215 $(CC
) $(CCO
)tests
/testdai
$(EE
) tests
/testdai.
cpp $(LIBS
) $(BOOSTLIBS
)
216 tests
/testem
/testem
$(EE
) : tests
/testem
/testem.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
217 $(CC
) $(CCO
)$@
$< $(LIBS
) $(BOOSTLIBS
)
219 tests
/testbbp
$(EE
) : tests
/testbbp.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
220 $(CC
) $(CCO
)tests
/testbbp
$(EE
) tests
/testbbp.
cpp $(LIBS
)
226 matlab
/dai
$(ME
) : $(SRC
)/matlab
/dai.
cpp $(HEADERS
) matlab
$(OE
) $(LIB
)/libdai
$(LE
)
227 $(MEX
) -o matlab
/dai
$(SRC
)/matlab
/dai.
cpp matlab
$(OE
) $(LIB
)/libdai
$(LE
)
229 matlab
/dai_readfg
$(ME
) : $(SRC
)/matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
230 $(MEX
) -o matlab
/dai_readfg
$(SRC
)/matlab
/dai_readfg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
232 matlab
/dai_writefg
$(ME
) : $(SRC
)/matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
233 $(MEX
) -o matlab
/dai_writefg
$(SRC
)/matlab
/dai_writefg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
235 matlab
/dai_potstrength
$(ME
) : $(SRC
)/matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
$(OE
) exceptions
$(OE
)
236 $(MEX
) -o matlab
/dai_potstrength
$(SRC
)/matlab
/dai_potstrength.
cpp matlab
$(OE
) exceptions
$(OE
)
238 matlab
$(OE
) : $(SRC
)/matlab
/matlab.
cpp $(INC
)/matlab
/matlab.h
$(HEADERS
)
239 $(MEX
) -c
$(SRC
)/matlab
/matlab.
cpp
245 utils
/createfg
$(EE
) : utils
/createfg.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
246 $(CC
) $(CCO
)utils
/createfg
$(EE
) utils
/createfg.
cpp $(LIBS
) $(BOOSTLIBS
)
248 utils
/fg2dot
$(EE
) : utils
/fg2dot.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
249 $(CC
) $(CCO
)utils
/fg2dot
$(EE
) utils
/fg2dot.
cpp $(LIBS
)
251 utils
/fginfo
$(EE
) : utils
/fginfo.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
252 $(CC
) $(CCO
)utils
/fginfo
$(EE
) utils
/fginfo.
cpp $(LIBS
)
258 ifneq ($(OS
),WINDOWS
)
259 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
261 ar rcus
$(LIB
)/libdai
$(LE
) bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
263 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
265 lib
/out
:$(LIB
)/libdai
$(LE
) bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
272 testregression
: tests
/testdai
$(EE
)
273 @echo Starting regression
test...this can take a minute or so
!
274 ifneq ($(OS
),WINDOWS
)
275 cd tests
&& .
/testregression
&& cd ..
277 cd tests
&& testregression.bat
&& cd ..
280 testem
: tests
/testem
/testem
$(EE
)
281 @echo Starting EM tests
282 ifneq ($(OS
),WINDOWS
)
283 cd tests
/testem
&& .
/runtests
&& cd ..
/..
285 cd tests
\testem
&& runtests
&& cd ..\..
292 doc
: $(INC
)/*.h
$(SRC
)/*.
cpp examples
/*.
cpp doxygen.conf
296 etags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
297 ctags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
303 ifneq ($(OS
),WINDOWS
)
308 -rm examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_sprinkler
$(EE
)
309 -rm tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
310 -rm utils
/fg2dot
$(EE
) utils
/createfg
$(EE
) utils
/fginfo
$(EE
)
316 -del
*$(OE
) *.ilk
*.pdb
*$(EE
) matlab\
*$(ME
) examples\
*$(EE
) examples\
*.ilk examples\
*.pdb tests
\testdai
$(EE
) tests
\testem
\testem
$(EE
) tests\
*.pdb tests\
*.ilk utils\
*$(EE
) utils\
*.pdb utils\
*.ilk
$(LIB
)\libdai
$(LE
)