1 # This file is part of libDAI - http://www.libdai.org/
3 # libDAI is licensed under the terms of the GNU General Public License version
4 # 2, or (at your option) any later version. libDAI is distributed without any
5 # warranty. See the file COPYING for more details.
7 # Copyright (C) 2006-2010 Joris Mooij [joris dot mooij at libdai dot org]
8 # Copyright (C) 2006-2007 Radboud University Nijmegen, The Netherlands
11 # Load the platform independent build configuration file
14 # Load the local configuration from Makefile.conf
17 # Set version and date
18 DAI_VERSION
="git HEAD"
19 DAI_DATE
="February 4, 2010 - or later"
21 # Directories of libDAI sources
22 # Location libDAI headers
24 # Location of libDAI source files
26 # Destination directory of libDAI library
29 # Set final compiler flags
31 CCFLAGS
:=$(CCFLAGS
) $(CCDEBUGFLAGS
)
33 CCFLAGS
:=$(CCFLAGS
) $(CCNODEBUGFLAGS
)
36 # Define build targets
37 TARGETS
=tests utils lib examples testregression testem
39 TARGETS
:=$(TARGETS
) doc
42 TARGETS
:=$(TARGETS
) matlabs
43 # Specify the same C++ compiler and flags to mex
45 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#'$(CCFLAGS)'
47 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#"$(CCFLAGS)"
50 MEXFLAGS
:=$(MEXFLAGS
) -largeArrayDims
52 MEXFLAGS
:=$(MEXFLAGS
) -DSMALLMEM
56 # Define conditional build targets
57 OBJECTS
:=exactinf
$(OE
) evidence
$(OE
) emalg
$(OE
)
59 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_BP
60 OBJECTS
:=$(OBJECTS
) bp
$(OE
)
63 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_FBP
64 OBJECTS
:=$(OBJECTS
) fbp
$(OE
)
67 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_TRWBP
68 OBJECTS
:=$(OBJECTS
) trwbp
$(OE
)
71 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MF
72 OBJECTS
:=$(OBJECTS
) mf
$(OE
)
75 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_HAK
76 OBJECTS
:=$(OBJECTS
) hak
$(OE
)
79 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_LC
80 OBJECTS
:=$(OBJECTS
) lc
$(OE
)
83 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_TREEEP
84 OBJECTS
:=$(OBJECTS
) treeep
$(OE
)
87 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_JTREE
88 OBJECTS
:=$(OBJECTS
) jtree
$(OE
)
91 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MR
92 OBJECTS
:=$(OBJECTS
) mr
$(OE
)
95 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_GIBBS
96 OBJECTS
:=$(OBJECTS
) gibbs
$(OE
)
99 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_CBP
100 OBJECTS
:=$(OBJECTS
) bbp
$(OE
) cbp
$(OE
) bp_dual
$(OE
)
103 # Define standard libDAI header dependencies
104 HEADERS
=$(INC
)/bipgraph.h
$(INC
)/graph.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
106 # Setup final command for C++ compiler and MEX
107 ifneq ($(OS
),WINDOWS
)
108 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
) $(CCLIB
)
110 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
)
111 LIBS
:=$(LIBS
) $(CCLIB
)
113 MEX
:=$(MEX
) $(CCLIB
) $(CCINC
) $(MEXFLAGS
)
121 examples
: examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_permute
$(EE
) examples
/example_sprinkler
$(EE
) examples
/example_sprinkler_gibbs
$(EE
) examples
/example_sprinkler_em
$(EE
)
123 matlabs
: matlab
/dai
$(ME
) matlab
/dai_readfg
$(ME
) matlab
/dai_writefg
$(ME
) matlab
/dai_potstrength
$(ME
)
125 tests
: tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
127 utils
: utils
/createfg
$(EE
) utils
/fg2dot
$(EE
) utils
/fginfo
$(EE
)
129 lib
: $(LIB
)/libdai
$(LE
)
135 bipgraph
$(OE
) : $(SRC
)/bipgraph.
cpp $(HEADERS
)
136 $(CC
) -c
$(SRC
)/bipgraph.
cpp
138 graph
$(OE
) : $(SRC
)/graph.
cpp $(HEADERS
)
139 $(CC
) -c
$(SRC
)/graph.
cpp
141 varset
$(OE
) : $(SRC
/varset.
cpp $(HEADERS
)
142 $(CC
) -c
$(SRC
)/varset.
cpp
144 daialg
$(OE
) : $(SRC
)/daialg.
cpp $(HEADERS
)
145 $(CC
) -c
$(SRC
)/daialg.
cpp
147 exactinf
$(OE
) : $(SRC
)/exactinf.
cpp $(INC
)/exactinf.h
$(HEADERS
)
148 $(CC
) -c
$(SRC
)/exactinf.
cpp
150 bp
$(OE
) : $(SRC
)/bp.
cpp $(INC
)/bp.h
$(HEADERS
)
151 $(CC
) -c
$(SRC
)/bp.
cpp
153 fbp
$(OE
) : $(SRC
)/fbp.
cpp $(INC
)/fbp.h
$(HEADERS
)
154 $(CC
) -c
$(SRC
)/fbp.
cpp
156 trwbp
$(OE
) : $(SRC
)/trwbp.
cpp $(INC
)/trwbp.h
$(HEADERS
)
157 $(CC
) -c
$(SRC
)/trwbp.
cpp
159 bp_dual
$(OE
) : $(SRC
)/bp_dual.
cpp $(INC
)/bp_dual.h
$(HEADERS
)
160 $(CC
) -c
$(SRC
)/bp_dual.
cpp
162 bbp
$(OE
) : $(SRC
)/bbp.
cpp $(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
163 $(CC
) -c
$(SRC
)/bbp.
cpp
165 cbp
$(OE
) : $(SRC
)/cbp.
cpp $(INC
)/cbp.h
$(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
166 $(CC
) -c
$(SRC
)/cbp.
cpp
168 lc
$(OE
) : $(SRC
)/lc.
cpp $(INC
)/lc.h
$(HEADERS
)
169 $(CC
) -c
$(SRC
)/lc.
cpp
171 mf
$(OE
) : $(SRC
)/mf.
cpp $(INC
)/mf.h
$(HEADERS
)
172 $(CC
) -c
$(SRC
)/mf.
cpp
174 factor
$(OE
) : $(SRC
)/factor.
cpp $(INC
)/factor.h
$(HEADERS
)
175 $(CC
) -c
$(SRC
)/factor.
cpp
177 factorgraph
$(OE
) : $(SRC
)/factorgraph.
cpp $(INC
)/factorgraph.h
$(HEADERS
)
178 $(CC
) -c
$(SRC
)/factorgraph.
cpp
180 util
$(OE
) : $(SRC
)/util.
cpp $(INC
)/util.h
$(HEADERS
)
181 $(CC
) -c
$(SRC
)/util.
cpp
183 regiongraph
$(OE
) : $(SRC
)/regiongraph.
cpp $(INC
)/regiongraph.h
$(HEADERS
)
184 $(CC
) -c
$(SRC
)/regiongraph.
cpp
186 hak
$(OE
) : $(SRC
)/hak.
cpp $(INC
)/hak.h
$(HEADERS
) $(INC
)/regiongraph.h
187 $(CC
) -c
$(SRC
)/hak.
cpp
189 clustergraph
$(OE
) : $(SRC
)/clustergraph.
cpp $(INC
)/clustergraph.h
$(HEADERS
)
190 $(CC
) -c
$(SRC
)/clustergraph.
cpp
192 jtree
$(OE
) : $(SRC
)/jtree.
cpp $(INC
)/jtree.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
193 $(CC
) -c
$(SRC
)/jtree.
cpp
195 treeep
$(OE
) : $(SRC
)/treeep.
cpp $(INC
)/treeep.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
$(INC
)/jtree.h
196 $(CC
) -c
$(SRC
)/treeep.
cpp
198 weightedgraph
$(OE
) : $(SRC
)/weightedgraph.
cpp $(INC
)/weightedgraph.h
$(HEADERS
)
199 $(CC
) -c
$(SRC
)/weightedgraph.
cpp
201 mr
$(OE
) : $(SRC
)/mr.
cpp $(INC
)/mr.h
$(HEADERS
)
202 $(CC
) -c
$(SRC
)/mr.
cpp
204 gibbs
$(OE
) : $(SRC
)/gibbs.
cpp $(INC
)/gibbs.h
$(HEADERS
)
205 $(CC
) -c
$(SRC
)/gibbs.
cpp
207 evidence
$(OE
) : $(SRC
)/evidence.
cpp $(INC
)/evidence.h
$(HEADERS
)
208 $(CC
) -c
$(SRC
)/evidence.
cpp
210 emalg
$(OE
) : $(SRC
)/emalg.
cpp $(INC
)/emalg.h
$(INC
)/evidence.h
$(HEADERS
)
211 $(CC
) -c
$(SRC
)/emalg.
cpp
213 properties
$(OE
) : $(SRC
)/properties.
cpp $(HEADERS
)
214 $(CC
) -c
$(SRC
)/properties.
cpp
216 exceptions
$(OE
) : $(SRC
)/exceptions.
cpp $(HEADERS
)
217 $(CC
) -c
$(SRC
)/exceptions.
cpp
219 alldai
$(OE
) : $(SRC
)/alldai.
cpp $(HEADERS
)
220 $(CC
) -c
$(SRC
)/alldai.
cpp
226 examples
/example
$(EE
) : examples
/example.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
227 $(CC
) $(CCO
)examples
/example
$(EE
) examples
/example.
cpp $(LIBS
)
229 examples
/example_bipgraph
$(EE
) : examples
/example_bipgraph.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
230 $(CC
) $(CCO
)examples
/example_bipgraph
$(EE
) examples
/example_bipgraph.
cpp $(LIBS
)
232 examples
/example_varset
$(EE
) : examples
/example_varset.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
233 $(CC
) $(CCO
)examples
/example_varset
$(EE
) examples
/example_varset.
cpp $(LIBS
)
235 examples
/example_permute
$(EE
) : examples
/example_permute.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
236 $(CC
) $(CCO
)examples
/example_permute
$(EE
) examples
/example_permute.
cpp $(LIBS
)
238 examples
/example_sprinkler
$(EE
) : examples
/example_sprinkler.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
239 $(CC
) $(CCO
)examples
/example_sprinkler
$(EE
) examples
/example_sprinkler.
cpp $(LIBS
)
241 examples
/example_sprinkler_gibbs
$(EE
) : examples
/example_sprinkler_gibbs.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
242 $(CC
) $(CCO
)examples
/example_sprinkler_gibbs
$(EE
) examples
/example_sprinkler_gibbs.
cpp $(LIBS
)
244 examples
/example_sprinkler_em
$(EE
) : examples
/example_sprinkler_em.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
245 $(CC
) $(CCO
)examples
/example_sprinkler_em
$(EE
) examples
/example_sprinkler_em.
cpp $(LIBS
)
251 tests
/testdai
$(EE
) : tests
/testdai.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
252 $(CC
) $(CCO
)tests
/testdai
$(EE
) tests
/testdai.
cpp $(LIBS
) $(BOOSTLIBS
)
253 tests
/testem
/testem
$(EE
) : tests
/testem
/testem.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
254 $(CC
) $(CCO
)$@
$< $(LIBS
) $(BOOSTLIBS
)
256 tests
/testbbp
$(EE
) : tests
/testbbp.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
257 $(CC
) $(CCO
)tests
/testbbp
$(EE
) tests
/testbbp.
cpp $(LIBS
)
263 matlab
/dai
$(ME
) : $(SRC
)/matlab
/dai.
cpp $(HEADERS
) matlab
$(OE
) $(LIB
)/libdai
$(LE
)
264 $(MEX
) -o matlab
/dai
$(SRC
)/matlab
/dai.
cpp matlab
$(OE
) $(LIB
)/libdai
$(LE
)
266 matlab
/dai_readfg
$(ME
) : $(SRC
)/matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
267 $(MEX
) -o matlab
/dai_readfg
$(SRC
)/matlab
/dai_readfg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
269 matlab
/dai_writefg
$(ME
) : $(SRC
)/matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
270 $(MEX
) -o matlab
/dai_writefg
$(SRC
)/matlab
/dai_writefg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
272 matlab
/dai_potstrength
$(ME
) : $(SRC
)/matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
$(OE
) exceptions
$(OE
)
273 $(MEX
) -o matlab
/dai_potstrength
$(SRC
)/matlab
/dai_potstrength.
cpp matlab
$(OE
) exceptions
$(OE
)
275 matlab
$(OE
) : $(SRC
)/matlab
/matlab.
cpp $(INC
)/matlab
/matlab.h
$(HEADERS
)
276 $(MEX
) -c
$(SRC
)/matlab
/matlab.
cpp
282 utils
/createfg
$(EE
) : utils
/createfg.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
283 $(CC
) $(CCO
)utils
/createfg
$(EE
) utils
/createfg.
cpp $(LIBS
) $(BOOSTLIBS
)
285 utils
/fg2dot
$(EE
) : utils
/fg2dot.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
286 $(CC
) $(CCO
)utils
/fg2dot
$(EE
) utils
/fg2dot.
cpp $(LIBS
)
288 utils
/fginfo
$(EE
) : utils
/fginfo.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
289 $(CC
) $(CCO
)utils
/fginfo
$(EE
) utils
/fginfo.
cpp $(LIBS
)
295 OBJECTS
:=bipgraph
$(OE
) graph
$(OE
) varset
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factor
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
297 ifneq ($(OS
),WINDOWS
)
298 $(LIB
)/libdai
$(LE
) : $(OBJECTS
)
300 ar rcus
$(LIB
)/libdai
$(LE
) $(OBJECTS
)
302 $(LIB
)/libdai
$(LE
) : $(OBJECTS
)
304 lib
/out
:$(LIB
)/libdai
$(LE
) $(OBJECTS
)
311 testregression
: tests
/testdai
$(EE
)
312 @echo Starting regression
test...this can take a minute or so
!
313 ifneq ($(OS
),WINDOWS
)
314 cd tests
&& .
/testregression
&& cd ..
316 cd tests
&& testregression.bat
&& cd ..
319 testem
: tests
/testem
/testem
$(EE
)
320 @echo Starting EM tests
321 ifneq ($(OS
),WINDOWS
)
322 cd tests
/testem
&& .
/runtests
&& cd ..
/..
324 cd tests
\testem
&& runtests
&& cd ..\..
331 doc
: $(INC
)/*.h
$(SRC
)/*.
cpp examples
/*.
cpp doxygen.conf
334 README
: doc scripts
/makeREADME
335 DAI_VERSION
=$(DAI_VERSION
) DAI_DATE
=$(DAI_DATE
) scripts
/makeREADME
338 etags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
339 ctags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
345 ifneq ($(OS
),WINDOWS
)
350 -rm examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_permute
$(EE
) examples
/example_sprinkler
$(EE
) examples
/example_sprinkler_gibbs
$(EE
) examples
/example_sprinkler_em
$(EE
)
351 -rm tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
352 -rm utils
/fg2dot
$(EE
) utils
/createfg
$(EE
) utils
/fginfo
$(EE
)
366 -del tests
\testdai
$(EE
)
367 -del tests
\testbbp
$(EE
)
368 -del tests
\testem
\testem
$(EE
)
371 -del tests
\testem\
*.pdb
372 -del tests
\testem\
*.ilk
376 -del
$(LIB
)\libdai
$(LE
)