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-2009 Joris Mooij [joris dot mooij at libdai dot org]
8 # Copyright (C) 2006-2007 Radboud University Nijmegen, The Netherlands
11 # Load the local configuration from Makefile.conf
14 # Set version and date
15 DAI_VERSION
="git HEAD"
16 DAI_DATE
="November 16, 2009 - or later"
18 # Directories of libDAI sources
19 # Location libDAI headers
21 # Location of libDAI source files
23 # Destination directory of libDAI library
26 # Set final compiler flags
28 CCFLAGS
:=$(CCFLAGS
) $(CCDEBUGFLAGS
)
30 CCFLAGS
:=$(CCFLAGS
) $(CCNODEBUGFLAGS
)
33 # Define build targets
34 TARGETS
=tests utils lib examples testregression testem
36 TARGETS
:=$(TARGETS
) doc
39 TARGETS
:=$(TARGETS
) matlabs
40 # Specify the same C++ compiler and flags to mex
42 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#'$(CCFLAGS)'
44 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#"$(CCFLAGS)"
47 MEXFLAGS
:=$(MEXFLAGS
) -largeArrayDims
49 MEXFLAGS
:=$(MEXFLAGS
) -DSMALLMEM
53 # Define conditional build targets
54 OBJECTS
:=exactinf
$(OE
) evidence
$(OE
) emalg
$(OE
)
56 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_BP
57 OBJECTS
:=$(OBJECTS
) bp
$(OE
)
60 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_FBP
61 OBJECTS
:=$(OBJECTS
) fbp
$(OE
)
64 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MF
65 OBJECTS
:=$(OBJECTS
) mf
$(OE
)
68 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_HAK
69 OBJECTS
:=$(OBJECTS
) hak
$(OE
)
72 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_LC
73 OBJECTS
:=$(OBJECTS
) lc
$(OE
)
76 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_TREEEP
77 OBJECTS
:=$(OBJECTS
) treeep
$(OE
)
80 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_JTREE
81 OBJECTS
:=$(OBJECTS
) jtree
$(OE
)
84 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MR
85 OBJECTS
:=$(OBJECTS
) mr
$(OE
)
88 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_GIBBS
89 OBJECTS
:=$(OBJECTS
) gibbs
$(OE
)
92 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_CBP
93 OBJECTS
:=$(OBJECTS
) bbp
$(OE
) cbp
$(OE
) bp_dual
$(OE
)
96 # Define standard libDAI header dependencies
97 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
99 # Setup final command for C++ compiler and MEX
100 ifneq ($(OS
),WINDOWS
)
101 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
) $(CCLIB
)
103 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
)
104 LIBS
:=$(LIBS
) $(CCLIB
)
106 MEX
:=$(MEX
) $(CCLIB
) $(CCINC
) $(MEXFLAGS
)
114 examples
: examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_permute
$(EE
) examples
/example_sprinkler
$(EE
)
116 matlabs
: matlab
/dai
$(ME
) matlab
/dai_readfg
$(ME
) matlab
/dai_writefg
$(ME
) matlab
/dai_potstrength
$(ME
)
118 tests
: tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
120 utils
: utils
/createfg
$(EE
) utils
/fg2dot
$(EE
) utils
/fginfo
$(EE
)
122 lib
: $(LIB
)/libdai
$(LE
)
128 bipgraph
$(OE
) : $(SRC
)/bipgraph.
cpp $(HEADERS
)
129 $(CC
) -c
$(SRC
)/bipgraph.
cpp
131 varset
$(OE
) : $(SRC
/varset.
cpp $(HEADERS
)
132 $(CC
) -c
$(SRC
)/varset.
cpp
134 daialg
$(OE
) : $(SRC
)/daialg.
cpp $(HEADERS
)
135 $(CC
) -c
$(SRC
)/daialg.
cpp
137 exactinf
$(OE
) : $(SRC
)/exactinf.
cpp $(INC
)/exactinf.h
$(HEADERS
)
138 $(CC
) -c
$(SRC
)/exactinf.
cpp
140 bp
$(OE
) : $(SRC
)/bp.
cpp $(INC
)/bp.h
$(HEADERS
)
141 $(CC
) -c
$(SRC
)/bp.
cpp
143 fbp
$(OE
) : $(SRC
)/fbp.
cpp $(INC
)/fbp.h
$(HEADERS
)
144 $(CC
) -c
$(SRC
)/fbp.
cpp
146 bp_dual
$(OE
) : $(SRC
)/bp_dual.
cpp $(INC
)/bp_dual.h
$(HEADERS
)
147 $(CC
) -c
$(SRC
)/bp_dual.
cpp
149 bbp
$(OE
) : $(SRC
)/bbp.
cpp $(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
150 $(CC
) -c
$(SRC
)/bbp.
cpp
152 cbp
$(OE
) : $(SRC
)/cbp.
cpp $(INC
)/cbp.h
$(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
153 $(CC
) -c
$(SRC
)/cbp.
cpp
155 lc
$(OE
) : $(SRC
)/lc.
cpp $(INC
)/lc.h
$(HEADERS
)
156 $(CC
) -c
$(SRC
)/lc.
cpp
158 mf
$(OE
) : $(SRC
)/mf.
cpp $(INC
)/mf.h
$(HEADERS
)
159 $(CC
) -c
$(SRC
)/mf.
cpp
161 factorgraph
$(OE
) : $(SRC
)/factorgraph.
cpp $(INC
)/factorgraph.h
$(HEADERS
)
162 $(CC
) -c
$(SRC
)/factorgraph.
cpp
164 util
$(OE
) : $(SRC
)/util.
cpp $(INC
)/util.h
$(HEADERS
)
165 $(CC
) -c
$(SRC
)/util.
cpp
167 regiongraph
$(OE
) : $(SRC
)/regiongraph.
cpp $(INC
)/regiongraph.h
$(HEADERS
)
168 $(CC
) -c
$(SRC
)/regiongraph.
cpp
170 hak
$(OE
) : $(SRC
)/hak.
cpp $(INC
)/hak.h
$(HEADERS
) $(INC
)/regiongraph.h
171 $(CC
) -c
$(SRC
)/hak.
cpp
173 clustergraph
$(OE
) : $(SRC
)/clustergraph.
cpp $(INC
)/clustergraph.h
$(HEADERS
)
174 $(CC
) -c
$(SRC
)/clustergraph.
cpp
176 jtree
$(OE
) : $(SRC
)/jtree.
cpp $(INC
)/jtree.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
177 $(CC
) -c
$(SRC
)/jtree.
cpp
179 treeep
$(OE
) : $(SRC
)/treeep.
cpp $(INC
)/treeep.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
$(INC
)/jtree.h
180 $(CC
) -c
$(SRC
)/treeep.
cpp
182 weightedgraph
$(OE
) : $(SRC
)/weightedgraph.
cpp $(INC
)/weightedgraph.h
$(HEADERS
)
183 $(CC
) -c
$(SRC
)/weightedgraph.
cpp
185 mr
$(OE
) : $(SRC
)/mr.
cpp $(INC
)/mr.h
$(HEADERS
)
186 $(CC
) -c
$(SRC
)/mr.
cpp
188 gibbs
$(OE
) : $(SRC
)/gibbs.
cpp $(INC
)/gibbs.h
$(HEADERS
)
189 $(CC
) -c
$(SRC
)/gibbs.
cpp
191 evidence
$(OE
) : $(SRC
)/evidence.
cpp $(INC
)/evidence.h
$(HEADERS
)
192 $(CC
) -c
$(SRC
)/evidence.
cpp
194 emalg
$(OE
) : $(SRC
)/emalg.
cpp $(INC
)/emalg.h
$(INC
)/evidence.h
$(HEADERS
)
195 $(CC
) -c
$(SRC
)/emalg.
cpp
197 properties
$(OE
) : $(SRC
)/properties.
cpp $(HEADERS
)
198 $(CC
) -c
$(SRC
)/properties.
cpp
200 exceptions
$(OE
) : $(SRC
)/exceptions.
cpp $(HEADERS
)
201 $(CC
) -c
$(SRC
)/exceptions.
cpp
203 alldai
$(OE
) : $(SRC
)/alldai.
cpp $(HEADERS
)
204 $(CC
) -c
$(SRC
)/alldai.
cpp
210 examples
/example
$(EE
) : examples
/example.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
211 $(CC
) $(CCO
)examples
/example
$(EE
) examples
/example.
cpp $(LIBS
)
213 examples
/example_bipgraph
$(EE
) : examples
/example_bipgraph.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
214 $(CC
) $(CCO
)examples
/example_bipgraph
$(EE
) examples
/example_bipgraph.
cpp $(LIBS
)
216 examples
/example_varset
$(EE
) : examples
/example_varset.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
217 $(CC
) $(CCO
)examples
/example_varset
$(EE
) examples
/example_varset.
cpp $(LIBS
)
219 examples
/example_permute
$(EE
) : examples
/example_permute.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
220 $(CC
) $(CCO
)examples
/example_permute
$(EE
) examples
/example_permute.
cpp $(LIBS
)
222 examples
/example_sprinkler
$(EE
) : examples
/example_sprinkler.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
223 $(CC
) $(CCO
)examples
/example_sprinkler
$(EE
) examples
/example_sprinkler.
cpp $(LIBS
)
229 tests
/testdai
$(EE
) : tests
/testdai.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
230 $(CC
) $(CCO
)tests
/testdai
$(EE
) tests
/testdai.
cpp $(LIBS
) $(BOOSTLIBS
)
231 tests
/testem
/testem
$(EE
) : tests
/testem
/testem.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
232 $(CC
) $(CCO
)$@
$< $(LIBS
) $(BOOSTLIBS
)
234 tests
/testbbp
$(EE
) : tests
/testbbp.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
235 $(CC
) $(CCO
)tests
/testbbp
$(EE
) tests
/testbbp.
cpp $(LIBS
)
241 matlab
/dai
$(ME
) : $(SRC
)/matlab
/dai.
cpp $(HEADERS
) matlab
$(OE
) $(LIB
)/libdai
$(LE
)
242 $(MEX
) -o matlab
/dai
$(SRC
)/matlab
/dai.
cpp matlab
$(OE
) $(LIB
)/libdai
$(LE
)
244 matlab
/dai_readfg
$(ME
) : $(SRC
)/matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
245 $(MEX
) -o matlab
/dai_readfg
$(SRC
)/matlab
/dai_readfg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
247 matlab
/dai_writefg
$(ME
) : $(SRC
)/matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
248 $(MEX
) -o matlab
/dai_writefg
$(SRC
)/matlab
/dai_writefg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
) bipgraph
$(OE
)
250 matlab
/dai_potstrength
$(ME
) : $(SRC
)/matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
$(OE
) exceptions
$(OE
)
251 $(MEX
) -o matlab
/dai_potstrength
$(SRC
)/matlab
/dai_potstrength.
cpp matlab
$(OE
) exceptions
$(OE
)
253 matlab
$(OE
) : $(SRC
)/matlab
/matlab.
cpp $(INC
)/matlab
/matlab.h
$(HEADERS
)
254 $(MEX
) -c
$(SRC
)/matlab
/matlab.
cpp
260 utils
/createfg
$(EE
) : utils
/createfg.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
261 $(CC
) $(CCO
)utils
/createfg
$(EE
) utils
/createfg.
cpp $(LIBS
) $(BOOSTLIBS
)
263 utils
/fg2dot
$(EE
) : utils
/fg2dot.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
264 $(CC
) $(CCO
)utils
/fg2dot
$(EE
) utils
/fg2dot.
cpp $(LIBS
)
266 utils
/fginfo
$(EE
) : utils
/fginfo.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
267 $(CC
) $(CCO
)utils
/fginfo
$(EE
) utils
/fginfo.
cpp $(LIBS
)
273 ifneq ($(OS
),WINDOWS
)
274 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) varset
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
276 ar rcus
$(LIB
)/libdai
$(LE
) bipgraph
$(OE
) varset
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
278 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) varset
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
280 lib
/out
:$(LIB
)/libdai
$(LE
) bipgraph
$(OE
) varset
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
287 testregression
: tests
/testdai
$(EE
)
288 @echo Starting regression
test...this can take a minute or so
!
289 ifneq ($(OS
),WINDOWS
)
290 cd tests
&& .
/testregression
&& cd ..
292 cd tests
&& testregression.bat
&& cd ..
295 testem
: tests
/testem
/testem
$(EE
)
296 @echo Starting EM tests
297 ifneq ($(OS
),WINDOWS
)
298 cd tests
/testem
&& .
/runtests
&& cd ..
/..
300 cd tests
\testem
&& runtests
&& cd ..\..
307 doc
: $(INC
)/*.h
$(SRC
)/*.
cpp examples
/*.
cpp doxygen.conf
309 # DAI_VERSION=$(DAI_VERSION) DAI_DATE=$(DAI_DATE) scripts/makeREADME
312 etags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
313 ctags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
319 ifneq ($(OS
),WINDOWS
)
324 -rm examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_permute
$(EE
) examples
/example_sprinkler
$(EE
)
325 -rm tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
326 -rm utils
/fg2dot
$(EE
) utils
/createfg
$(EE
) utils
/fginfo
$(EE
)
340 -del tests
\testdai
$(EE
)
341 -del tests
\testbbp
$(EE
)
342 -del tests
\testem
\testem
$(EE
)
345 -del tests
\testem\
*.pdb
346 -del tests
\testem\
*.ilk
350 -del
$(LIB
)\libdai
$(LE
)