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 # Directories of libDAI sources
15 # Location libDAI headers
17 # Location of libDAI source files
19 # Destination directory of libDAI library
22 # Set final compiler flags
24 CCFLAGS
:=$(CCFLAGS
) $(CCDEBUGFLAGS
)
26 CCFLAGS
:=$(CCFLAGS
) $(CCNODEBUGFLAGS
)
29 # Define build targets
30 TARGETS
=tests utils lib examples testregression testem
32 TARGETS
:=$(TARGETS
) doc
35 TARGETS
:=$(TARGETS
) matlabs
36 # Specify the same C++ compiler and flags to mex
38 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#'$(CCFLAGS)'
40 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#"$(CCFLAGS)"
43 MEXFLAGS
:=$(MEXFLAGS
) -largeArrayDims
45 MEXFLAGS
:=$(MEXFLAGS
) -DSMALLMEM
49 # Define conditional build targets
50 OBJECTS
:=exactinf
$(OE
) evidence
$(OE
) emalg
$(OE
)
52 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_BP
53 OBJECTS
:=$(OBJECTS
) bp
$(OE
)
56 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MF
57 OBJECTS
:=$(OBJECTS
) mf
$(OE
)
60 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_HAK
61 OBJECTS
:=$(OBJECTS
) hak
$(OE
)
64 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_LC
65 OBJECTS
:=$(OBJECTS
) lc
$(OE
)
68 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_TREEEP
69 OBJECTS
:=$(OBJECTS
) treeep
$(OE
)
72 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_JTREE
73 OBJECTS
:=$(OBJECTS
) jtree
$(OE
)
76 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MR
77 OBJECTS
:=$(OBJECTS
) mr
$(OE
)
80 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_GIBBS
81 OBJECTS
:=$(OBJECTS
) gibbs
$(OE
)
84 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_CBP
85 OBJECTS
:=$(OBJECTS
) bbp
$(OE
) cbp
$(OE
) bp_dual
$(OE
)
88 # Define standard libDAI header dependencies
89 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
91 # Setup final command for C++ compiler and MEX
93 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
) $(CCLIB
)
95 CC
:=$(CC
) $(CCINC
) $(CCFLAGS
)
96 LIBS
:=$(LIBS
) $(CCLIB
)
98 MEX
:=$(MEX
) $(CCLIB
) $(CCINC
) $(MEXFLAGS
)
106 examples
: examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_permute
$(EE
) examples
/example_sprinkler
$(EE
)
108 matlabs
: matlab
/dai
$(ME
) matlab
/dai_readfg
$(ME
) matlab
/dai_writefg
$(ME
) matlab
/dai_potstrength
$(ME
)
110 tests
: tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
112 utils
: utils
/createfg
$(EE
) utils
/fg2dot
$(EE
) utils
/fginfo
$(EE
)
114 lib
: $(LIB
)/libdai
$(LE
)
120 bipgraph
$(OE
) : $(SRC
)/bipgraph.
cpp $(HEADERS
)
121 $(CC
) -c
$(SRC
)/bipgraph.
cpp
123 daialg
$(OE
) : $(SRC
)/daialg.
cpp $(HEADERS
)
124 $(CC
) -c
$(SRC
)/daialg.
cpp
126 exactinf
$(OE
) : $(SRC
)/exactinf.
cpp $(INC
)/exactinf.h
$(HEADERS
)
127 $(CC
) -c
$(SRC
)/exactinf.
cpp
129 bp
$(OE
) : $(SRC
)/bp.
cpp $(INC
)/bp.h
$(HEADERS
)
130 $(CC
) -c
$(SRC
)/bp.
cpp
132 bp_dual
$(OE
) : $(SRC
)/bp_dual.
cpp $(INC
)/bp_dual.h
$(HEADERS
)
133 $(CC
) -c
$(SRC
)/bp_dual.
cpp
135 bbp
$(OE
) : $(SRC
)/bbp.
cpp $(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
136 $(CC
) -c
$(SRC
)/bbp.
cpp
138 cbp
$(OE
) : $(SRC
)/cbp.
cpp $(INC
)/cbp.h
$(INC
)/bbp.h
$(INC
)/bp_dual.h
$(HEADERS
)
139 $(CC
) -c
$(SRC
)/cbp.
cpp
141 lc
$(OE
) : $(SRC
)/lc.
cpp $(INC
)/lc.h
$(HEADERS
)
142 $(CC
) -c
$(SRC
)/lc.
cpp
144 mf
$(OE
) : $(SRC
)/mf.
cpp $(INC
)/mf.h
$(HEADERS
)
145 $(CC
) -c
$(SRC
)/mf.
cpp
147 factorgraph
$(OE
) : $(SRC
)/factorgraph.
cpp $(INC
)/factorgraph.h
$(HEADERS
)
148 $(CC
) -c
$(SRC
)/factorgraph.
cpp
150 util
$(OE
) : $(SRC
)/util.
cpp $(INC
)/util.h
$(HEADERS
)
151 $(CC
) -c
$(SRC
)/util.
cpp
153 regiongraph
$(OE
) : $(SRC
)/regiongraph.
cpp $(INC
)/regiongraph.h
$(HEADERS
)
154 $(CC
) -c
$(SRC
)/regiongraph.
cpp
156 hak
$(OE
) : $(SRC
)/hak.
cpp $(INC
)/hak.h
$(HEADERS
) $(INC
)/regiongraph.h
157 $(CC
) -c
$(SRC
)/hak.
cpp
159 clustergraph
$(OE
) : $(SRC
)/clustergraph.
cpp $(INC
)/clustergraph.h
$(HEADERS
)
160 $(CC
) -c
$(SRC
)/clustergraph.
cpp
162 jtree
$(OE
) : $(SRC
)/jtree.
cpp $(INC
)/jtree.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
163 $(CC
) -c
$(SRC
)/jtree.
cpp
165 treeep
$(OE
) : $(SRC
)/treeep.
cpp $(INC
)/treeep.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
$(INC
)/jtree.h
166 $(CC
) -c
$(SRC
)/treeep.
cpp
168 weightedgraph
$(OE
) : $(SRC
)/weightedgraph.
cpp $(INC
)/weightedgraph.h
$(HEADERS
)
169 $(CC
) -c
$(SRC
)/weightedgraph.
cpp
171 mr
$(OE
) : $(SRC
)/mr.
cpp $(INC
)/mr.h
$(HEADERS
)
172 $(CC
) -c
$(SRC
)/mr.
cpp
174 gibbs
$(OE
) : $(SRC
)/gibbs.
cpp $(INC
)/gibbs.h
$(HEADERS
)
175 $(CC
) -c
$(SRC
)/gibbs.
cpp
177 evidence
$(OE
) : $(SRC
)/evidence.
cpp $(INC
)/evidence.h
$(HEADERS
)
178 $(CC
) -c
$(SRC
)/evidence.
cpp
180 emalg
$(OE
) : $(SRC
)/emalg.
cpp $(INC
)/emalg.h
$(INC
)/evidence.h
$(HEADERS
)
181 $(CC
) -c
$(SRC
)/emalg.
cpp
183 properties
$(OE
) : $(SRC
)/properties.
cpp $(HEADERS
)
184 $(CC
) -c
$(SRC
)/properties.
cpp
186 exceptions
$(OE
) : $(SRC
)/exceptions.
cpp $(HEADERS
)
187 $(CC
) -c
$(SRC
)/exceptions.
cpp
189 alldai
$(OE
) : $(SRC
)/alldai.
cpp $(HEADERS
)
190 $(CC
) -c
$(SRC
)/alldai.
cpp
196 examples
/example
$(EE
) : examples
/example.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
197 $(CC
) $(CCO
)examples
/example
$(EE
) examples
/example.
cpp $(LIBS
)
199 examples
/example_bipgraph
$(EE
) : examples
/example_bipgraph.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
200 $(CC
) $(CCO
)examples
/example_bipgraph
$(EE
) examples
/example_bipgraph.
cpp $(LIBS
)
202 examples
/example_varset
$(EE
) : examples
/example_varset.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
203 $(CC
) $(CCO
)examples
/example_varset
$(EE
) examples
/example_varset.
cpp $(LIBS
)
205 examples
/example_permute
$(EE
) : examples
/example_permute.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
206 $(CC
) $(CCO
)examples
/example_permute
$(EE
) examples
/example_permute.
cpp $(LIBS
)
208 examples
/example_sprinkler
$(EE
) : examples
/example_sprinkler.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
209 $(CC
) $(CCO
)examples
/example_sprinkler
$(EE
) examples
/example_sprinkler.
cpp $(LIBS
)
215 tests
/testdai
$(EE
) : tests
/testdai.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
216 $(CC
) $(CCO
)tests
/testdai
$(EE
) tests
/testdai.
cpp $(LIBS
) $(BOOSTLIBS
)
217 tests
/testem
/testem
$(EE
) : tests
/testem
/testem.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
218 $(CC
) $(CCO
)$@
$< $(LIBS
) $(BOOSTLIBS
)
220 tests
/testbbp
$(EE
) : tests
/testbbp.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
221 $(CC
) $(CCO
)tests
/testbbp
$(EE
) tests
/testbbp.
cpp $(LIBS
)
227 matlab
/dai
$(ME
) : $(SRC
)/matlab
/dai.
cpp $(HEADERS
) matlab
$(OE
) $(LIB
)/libdai
$(LE
)
228 $(MEX
) -o matlab
/dai
$(SRC
)/matlab
/dai.
cpp matlab
$(OE
) $(LIB
)/libdai
$(LE
)
230 matlab
/dai_readfg
$(ME
) : $(SRC
)/matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
231 $(MEX
) -o matlab
/dai_readfg
$(SRC
)/matlab
/dai_readfg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
233 matlab
/dai_writefg
$(ME
) : $(SRC
)/matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
234 $(MEX
) -o matlab
/dai_writefg
$(SRC
)/matlab
/dai_writefg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
236 matlab
/dai_potstrength
$(ME
) : $(SRC
)/matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
$(OE
) exceptions
$(OE
)
237 $(MEX
) -o matlab
/dai_potstrength
$(SRC
)/matlab
/dai_potstrength.
cpp matlab
$(OE
) exceptions
$(OE
)
239 matlab
$(OE
) : $(SRC
)/matlab
/matlab.
cpp $(INC
)/matlab
/matlab.h
$(HEADERS
)
240 $(MEX
) -c
$(SRC
)/matlab
/matlab.
cpp
246 utils
/createfg
$(EE
) : utils
/createfg.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
247 $(CC
) $(CCO
)utils
/createfg
$(EE
) utils
/createfg.
cpp $(LIBS
) $(BOOSTLIBS
)
249 utils
/fg2dot
$(EE
) : utils
/fg2dot.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
250 $(CC
) $(CCO
)utils
/fg2dot
$(EE
) utils
/fg2dot.
cpp $(LIBS
)
252 utils
/fginfo
$(EE
) : utils
/fginfo.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
253 $(CC
) $(CCO
)utils
/fginfo
$(EE
) utils
/fginfo.
cpp $(LIBS
)
259 ifneq ($(OS
),WINDOWS
)
260 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
262 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
)
264 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
266 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
)
273 testregression
: tests
/testdai
$(EE
)
274 @echo Starting regression
test...this can take a minute or so
!
275 ifneq ($(OS
),WINDOWS
)
276 cd tests
&& .
/testregression
&& cd ..
278 cd tests
&& testregression.bat
&& cd ..
281 testem
: tests
/testem
/testem
$(EE
)
282 @echo Starting EM tests
283 ifneq ($(OS
),WINDOWS
)
284 cd tests
/testem
&& .
/runtests
&& cd ..
/..
286 cd tests
\testem
&& runtests
&& cd ..\..
293 doc
: $(INC
)/*.h
$(SRC
)/*.
cpp examples
/*.
cpp doxygen.conf
297 etags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
298 ctags src
/*.
cpp include/dai
/*.h tests
/*.
cpp utils
/*.
cpp
304 ifneq ($(OS
),WINDOWS
)
309 -rm examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_permute
$(EE
) examples
/example_sprinkler
$(EE
)
310 -rm tests
/testdai
$(EE
) tests
/testem
/testem
$(EE
) tests
/testbbp
$(EE
)
311 -rm utils
/fg2dot
$(EE
) utils
/createfg
$(EE
) utils
/fginfo
$(EE
)
317 -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
)