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
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 # Enable/disable various approximate inference methods
30 # Build with debug info?
32 # Build matlab interface?
34 # New/old matlab version?
36 # Windows or linux (default)?
44 # Extensions (library, object, executable extensions)
49 # Libraries (for some reason, we have to add the VC library path, although it is in the environment)
50 LIBS=/link $(LIB)/libdai$(LE) /LIBPATH:"C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB" /LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib"
52 # We use the BOOST Program Options library
53 BOOSTLIBS=/LIBPATH:C:\boost_1_36_0\stage\lib
55 # Compile using GNU C++ Compiler
58 # Flags for the C++ compiler
59 CCFLAGS=/I./include /IC:\boost_1_36_0 /EHsc /Ox
61 CCFLAGS=$(CCFLAGS) /Zi /DDAI_DEBUG
65 CCFLAGS=$(CCFLAGS) /DWINDOWS
70 CCFLAGS=$(CCFLAGS) /DWITH_BP
71 OBJECTS=$(OBJECTS) bp$(OE)
74 CCFLAGS=$(CCFLAGS) /DWITH_MF
75 OBJECTS=$(OBJECTS) mf$(OE)
78 CCFLAGS=$(CCFLAGS) /DWITH_HAK
79 OBJECTS=$(OBJECTS) hak$(OE)
82 CCFLAGS=$(CCFLAGS) /DWITH_LC
83 OBJECTS=$(OBJECTS) lc$(OE)
86 CCFLAGS=$(CCFLAGS) /DWITH_TREEEP
87 OBJECTS=$(OBJECTS) treeep$(OE)
90 CCFLAGS=$(CCFLAGS) /DWITH_JTREE
91 OBJECTS=$(OBJECTS) jtree$(OE)
94 CCFLAGS=$(CCFLAGS) /DWITH_MR
95 OBJECTS=$(OBJECTS) mr$(OE)
99 # Replace the following by the directory where Matlab has been installed
100 MATLABDIR=/opt/matlab/bin
101 # Replace the following with the extension of compiled MEX files on this platform, e.g. .mexglx for x86
106 MEXFLAGS=$(MEXFLAGS) -g /DDAI_DEBUG
109 MEXFLAGS=$(MEXFLAGS) -largeArrayDims
111 MEXFLAGS=$(MEXFLAGS) /DSMALLMEM
115 HEADERS=$(INC)/bipgraph.h $(INC)/diffs.h $(INC)/index.h $(INC)/var.h $(INC)/factor.h $(INC)/varset.h $(INC)/prob.h $(INC)/daialg.h $(INC)/properties.h $(INC)/alldai.h $(INC)/enum.h $(INC)/exceptions.h
117 TARGETS=tests utils $(LIB)/libdai$(LE) example$(EE)
118 # testregression disabled, it uses diff
119 # doc disabled, it uses doxygen
121 TARGETS = $(TARGETS) matlabs
125 matlabs : matlab/dai.$(ME) matlab/dai_readfg.$(ME) matlab/dai_writefg.$(ME) matlab/dai_potstrength.$(ME)
127 $(LIB)/libdai$(LE) : bipgraph$(OE) daialg$(OE) alldai$(OE) clustergraph$(OE) factorgraph$(OE) properties$(OE) regiongraph$(OE) util$(OE) weightedgraph$(OE) exceptions$(OE) varset$(OE) $(OBJECTS)
128 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) varset$(OE) $(OBJECTS)
130 tests : tests/test$(EE)
132 utils : utils/createfg$(EE) utils/fg2dot$(EE) utils/fginfo$(EE)
134 testregression : tests/test
135 echo Testing...this can take a while...
136 cd tests; time ./testregression; cd ..
138 doc : $(INC)/*.h $(SRC)/*.cpp doxygen.conf
142 del *$(OE) *.ilk *.pdb *$(EE) matlab\*.$(ME) matlab\*$(OE) tests\test$(EE) tests\*.pdb tests\*.ilk utils\*$(EE) utils\*.pdb utils\*.ilk $(LIB)\libdai$(LE)
145 bipgraph$(OE) : $(SRC)/bipgraph.cpp $(HEADERS)
146 $(CC) $(CCFLAGS) -c $(SRC)/bipgraph.cpp
148 daialg$(OE) : $(SRC)/daialg.cpp $(HEADERS)
149 $(CC) $(CCFLAGS) -c $(SRC)/daialg.cpp
151 exactinf$(OE) : $(SRC)/exactinf.cpp $(INC)/exactinf.h $(HEADERS)
152 $(CC) $(CCFLAGS) -c $(SRC)/exactinf.cpp
154 bp$(OE) : $(SRC)/bp.cpp $(INC)/bp.h $(HEADERS)
155 $(CC) $(CCFLAGS) -c $(SRC)/bp.cpp
157 lc$(OE) : $(SRC)/lc.cpp $(INC)/lc.h $(HEADERS)
158 $(CC) $(CCFLAGS) -c $(SRC)/lc.cpp
160 mf$(OE) : $(SRC)/mf.cpp $(INC)/mf.h $(HEADERS)
161 $(CC) $(CCFLAGS) -c $(SRC)/mf.cpp
163 factorgraph$(OE) : $(SRC)/factorgraph.cpp $(INC)/factorgraph.h $(HEADERS)
164 $(CC) $(CCFLAGS) -c $(SRC)/factorgraph.cpp
166 util$(OE) : $(SRC)/util.cpp $(INC)/util.h $(HEADERS)
167 $(CC) $(CCFLAGS) -c $(SRC)/util.cpp
169 regiongraph$(OE) : $(SRC)/regiongraph.cpp $(INC)/regiongraph.h $(HEADERS)
170 $(CC) $(CCFLAGS) -c $(SRC)/regiongraph.cpp
172 hak$(OE) : $(SRC)/hak.cpp $(INC)/hak.h $(HEADERS) $(INC)/regiongraph.h
173 $(CC) $(CCFLAGS) -c $(SRC)/hak.cpp
175 clustergraph$(OE) : $(SRC)/clustergraph.cpp $(INC)/clustergraph.h $(HEADERS)
176 $(CC) $(CCFLAGS) -c $(SRC)/clustergraph.cpp
178 jtree$(OE) : $(SRC)/jtree.cpp $(INC)/jtree.h $(HEADERS) $(INC)/weightedgraph.h $(INC)/clustergraph.h $(INC)/regiongraph.h
179 $(CC) $(CCFLAGS) -c $(SRC)/jtree.cpp
181 treeep$(OE) : $(SRC)/treeep.cpp $(INC)/treeep.h $(HEADERS) $(INC)/weightedgraph.h $(INC)/clustergraph.h $(INC)/regiongraph.h $(INC)/jtree.h
182 $(CC) $(CCFLAGS) -c $(SRC)/treeep.cpp
184 weightedgraph$(OE) : $(SRC)/weightedgraph.cpp $(INC)/weightedgraph.h $(HEADERS)
185 $(CC) $(CCFLAGS) -c $(SRC)/weightedgraph.cpp
187 mr$(OE) : $(SRC)/mr.cpp $(INC)/mr.h $(HEADERS)
188 $(CC) $(CCFLAGS) -c $(SRC)/mr.cpp
190 properties$(OE) : $(SRC)/properties.cpp $(HEADERS)
191 $(CC) $(CCFLAGS) -c $(SRC)/properties.cpp
193 exceptions$(OE) : $(SRC)/exceptions.cpp $(HEADERS)
194 $(CC) $(CCFLAGS) -c $(SRC)/exceptions.cpp
196 alldai$(OE) : $(SRC)/alldai.cpp $(HEADERS)
197 $(CC) $(CCFLAGS) -c $(SRC)/alldai.cpp
199 varset$(OE) : $(SRC)/varset.cpp $(HEADERS)
200 $(CC) $(CCFLAGS) -c $(SRC)/varset.cpp
206 example$(EE) : example.cpp $(HEADERS) $(LIB)/libdai$(LE)
207 $(CC) $(CCFLAGS) /Feexample example.cpp $(LIBS)
213 tests/test$(EE) : tests/test.cpp $(HEADERS) $(LIB)/libdai$(LE)
214 $(CC) $(CCFLAGS) /Fetests/test tests/test.cpp $(LIBS) $(BOOSTLIBS)
220 matlab/dai.$(ME) : matlab/dai.cpp $(HEADERS) matlab/matlab$(OE) $(LIB)/libdai$(LE)
221 $(MEX) $(MEXFLAGS) -o matlab/dai matlab/dai.cpp matlab/matlab$(OE) $(LIB)/libdai$(LE)
223 matlab/dai_readfg.$(ME) : matlab/dai_readfg.cpp $(HEADERS) factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE) varset$(OE)
224 $(MEX) $(MEXFLAGS) -o matlab/dai_readfg matlab/dai_readfg.cpp factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE) varset$(OE)
226 matlab/dai_writefg.$(ME) : matlab/dai_writefg.cpp $(HEADERS) factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE) varset$(OE)
227 $(MEX) $(MEXFLAGS) -o matlab/dai_writefg matlab/dai_writefg.cpp factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE) varset$(OE)
229 matlab/dai_potstrength.$(ME) : matlab/dai_potstrength.cpp $(HEADERS) matlab/matlab$(OE) exceptions$(OE) varset$(OE)
230 $(MEX) $(MEXFLAGS) -o matlab/dai_potstrength matlab/dai_potstrength.cpp matlab/matlab$(OE) exceptions$(OE) varset$(OE)
232 matlab/matlab$(OE) : matlab/matlab.cpp matlab/matlab.h $(HEADERS)
233 $(MEX) $(MEXFLAGS) -outdir matlab -c matlab/matlab.cpp
239 utils/createfg$(EE) : utils/createfg.cpp $(HEADERS) $(LIB)/libdai$(LE)
240 $(CC) $(CCFLAGS) /Feutils/createfg utils/createfg.cpp $(LIBS) $(BOOSTLIBS)
242 utils/fg2dot$(EE) : utils/fg2dot.cpp $(HEADERS) $(LIB)/libdai$(LE)
243 $(CC) $(CCFLAGS) /Feutils/fg2dot utils/fg2dot.cpp $(LIBS)
245 utils/fginfo$(EE) : utils/fginfo.cpp $(HEADERS) $(LIB)/libdai$(LE)
246 $(CC) $(CCFLAGS) /Feutils/fginfo utils/fginfo.cpp $(LIBS)