1 # Copyright (C) 2006-2008 Joris Mooij [j dot mooij at science dot ru dot nl]
2 # Radboud University Nijmegen, The Netherlands
4 # This file is part of libDAI.
6 # libDAI is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # libDAI is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with libDAI; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 # Enable/disable various approximate inference methods
29 # Build with debug info?
31 # Build matlab interface?
33 # New/old matlab version?
35 # Windows or linux (default)?
43 # Extensions (library, object, executable extensions)
48 # Libraries (for some reason, we have to add the VC library path, although it is in the environment)
49 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"
51 # We use the BOOST Program Options library
52 BOOSTLIBS=/LIBPATH:C:\boost_1_36_0\stage\lib
54 # Compile using GNU C++ Compiler
57 # Flags for the C++ compiler
58 CCFLAGS=/I./include /IC:\boost_1_36_0 /EHsc /Ox
60 CCFLAGS=$(CCFLAGS) /Zi /DDAI_DEBUG
64 CCFLAGS=$(CCFLAGS) /DWINDOWS
69 CCFLAGS=$(CCFLAGS) /DWITH_BP
70 OBJECTS=$(OBJECTS) bp$(OE)
73 CCFLAGS=$(CCFLAGS) /DWITH_MF
74 OBJECTS=$(OBJECTS) mf$(OE)
77 CCFLAGS=$(CCFLAGS) /DWITH_HAK
78 OBJECTS=$(OBJECTS) hak$(OE)
81 CCFLAGS=$(CCFLAGS) /DWITH_LC
82 OBJECTS=$(OBJECTS) lc$(OE)
85 CCFLAGS=$(CCFLAGS) /DWITH_TREEEP
86 OBJECTS=$(OBJECTS) treeep$(OE)
89 CCFLAGS=$(CCFLAGS) /DWITH_JTREE
90 OBJECTS=$(OBJECTS) jtree$(OE)
93 CCFLAGS=$(CCFLAGS) /DWITH_MR
94 OBJECTS=$(OBJECTS) mr$(OE)
98 # Replace the following by the directory where Matlab has been installed
99 MATLABDIR=/opt/matlab/bin
100 # Replace the following with the extension of compiled MEX files on this platform, e.g. .mexglx for x86
105 MEXFLAGS=$(MEXFLAGS) -g /DDAI_DEBUG
108 MEXFLAGS=$(MEXFLAGS) -largeArrayDims
110 MEXFLAGS=$(MEXFLAGS) /DSMALLMEM
114 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)/x2x.h $(INC)/exceptions.h
116 TARGETS=tests utils $(LIB)/libdai$(LE) example$(EE)
117 # testregression disabled, it uses diff
118 # doc disabled, it uses doxygen
120 TARGETS = $(TARGETS) matlabs
124 matlabs : matlab/dai.$(ME) matlab/dai_readfg.$(ME) matlab/dai_writefg.$(ME) matlab/dai_potstrength.$(ME)
126 $(LIB)/libdai$(LE) : bipgraph$(OE) daialg$(OE) alldai$(OE) clustergraph$(OE) factorgraph$(OE) properties$(OE) regiongraph$(OE) util$(OE) weightedgraph$(OE) x2x$(OE) exceptions$(OE) $(OBJECTS)
127 lib /out:$(LIB)/libdai$(LE) bipgraph$(OE) daialg$(OE) alldai$(OE) clustergraph$(OE) factorgraph$(OE) properties$(OE) regiongraph$(OE) util$(OE) weightedgraph$(OE) x2x$(OE) exceptions$(OE) $(OBJECTS)
129 tests : tests/test$(EE)
131 utils : utils/createfg$(EE) utils/fg2dot$(EE) utils/fginfo$(EE)
133 testregression : tests/test
134 echo Testing...this can take a while...
135 cd tests; time ./testregression; cd ..
137 doc : $(INC)/*.h $(SRC)/*.cpp doxygen.conf
141 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)
144 bipgraph$(OE) : $(SRC)/bipgraph.cpp $(HEADERS)
145 $(CC) $(CCFLAGS) -c $(SRC)/bipgraph.cpp
147 daialg$(OE) : $(SRC)/daialg.cpp $(HEADERS)
148 $(CC) $(CCFLAGS) -c $(SRC)/daialg.cpp
150 exactinf$(OE) : $(SRC)/exactinf.cpp $(INC)/exactinf.h $(HEADERS)
151 $(CC) $(CCFLAGS) -c $(SRC)/exactinf.cpp
153 bp$(OE) : $(SRC)/bp.cpp $(INC)/bp.h $(HEADERS)
154 $(CC) $(CCFLAGS) -c $(SRC)/bp.cpp
156 lc$(OE) : $(SRC)/lc.cpp $(INC)/lc.h $(HEADERS)
157 $(CC) $(CCFLAGS) -c $(SRC)/lc.cpp
159 mf$(OE) : $(SRC)/mf.cpp $(INC)/mf.h $(HEADERS)
160 $(CC) $(CCFLAGS) -c $(SRC)/mf.cpp
162 factorgraph$(OE) : $(SRC)/factorgraph.cpp $(INC)/factorgraph.h $(HEADERS)
163 $(CC) $(CCFLAGS) -c $(SRC)/factorgraph.cpp
165 util$(OE) : $(SRC)/util.cpp $(INC)/util.h $(HEADERS)
166 $(CC) $(CCFLAGS) -c $(SRC)/util.cpp
168 regiongraph$(OE) : $(SRC)/regiongraph.cpp $(INC)/regiongraph.h $(HEADERS)
169 $(CC) $(CCFLAGS) -c $(SRC)/regiongraph.cpp
171 hak$(OE) : $(SRC)/hak.cpp $(INC)/hak.h $(HEADERS) $(INC)/regiongraph.h
172 $(CC) $(CCFLAGS) -c $(SRC)/hak.cpp
174 clustergraph$(OE) : $(SRC)/clustergraph.cpp $(INC)/clustergraph.h $(HEADERS)
175 $(CC) $(CCFLAGS) -c $(SRC)/clustergraph.cpp
177 jtree$(OE) : $(SRC)/jtree.cpp $(INC)/jtree.h $(HEADERS) $(INC)/weightedgraph.h $(INC)/clustergraph.h $(INC)/regiongraph.h
178 $(CC) $(CCFLAGS) -c $(SRC)/jtree.cpp
180 treeep$(OE) : $(SRC)/treeep.cpp $(INC)/treeep.h $(HEADERS) $(INC)/weightedgraph.h $(INC)/clustergraph.h $(INC)/regiongraph.h $(INC)/jtree.h
181 $(CC) $(CCFLAGS) -c $(SRC)/treeep.cpp
183 weightedgraph$(OE) : $(SRC)/weightedgraph.cpp $(INC)/weightedgraph.h $(HEADERS)
184 $(CC) $(CCFLAGS) -c $(SRC)/weightedgraph.cpp
186 mr$(OE) : $(SRC)/mr.cpp $(INC)/mr.h $(HEADERS)
187 $(CC) $(CCFLAGS) -c $(SRC)/mr.cpp
189 properties$(OE) : $(SRC)/properties.cpp $(HEADERS)
190 $(CC) $(CCFLAGS) -c $(SRC)/properties.cpp
192 exceptions$(OE) : $(SRC)/exceptions.cpp $(HEADERS)
193 $(CC) $(CCFLAGS) -c $(SRC)/exceptions.cpp
195 alldai$(OE) : $(SRC)/alldai.cpp $(HEADERS)
196 $(CC) $(CCFLAGS) -c $(SRC)/alldai.cpp
198 x2x$(OE) : $(SRC)/x2x.cpp $(HEADERS)
199 $(CC) $(CCFLAGS) -c $(SRC)/x2x.cpp
205 example$(EE) : example.cpp $(HEADERS) $(LIB)/libdai$(LE)
206 $(CC) $(CCFLAGS) /Feexample example.cpp $(LIBS)
212 tests/test$(EE) : tests/test.cpp $(HEADERS) $(LIB)/libdai$(LE)
213 $(CC) $(CCFLAGS) /Fetests/test tests/test.cpp $(LIBS) $(BOOSTLIBS)
219 matlab/dai.$(ME) : matlab/dai.cpp $(HEADERS) matlab/matlab$(OE) $(LIB)/libdai$(LE)
220 $(MEX) $(MEXFLAGS) -o matlab/dai matlab/dai.cpp matlab/matlab$(OE) $(LIB)/libdai$(LE)
222 matlab/dai_readfg.$(ME) : matlab/dai_readfg.cpp $(HEADERS) factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE)
223 $(MEX) $(MEXFLAGS) -o matlab/dai_readfg matlab/dai_readfg.cpp factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE)
225 matlab/dai_writefg.$(ME) : matlab/dai_writefg.cpp $(HEADERS) factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE)
226 $(MEX) $(MEXFLAGS) -o matlab/dai_writefg matlab/dai_writefg.cpp factorgraph$(OE) matlab/matlab$(OE) exceptions$(OE)
228 matlab/dai_potstrength.$(ME) : matlab/dai_potstrength.cpp $(HEADERS) matlab/matlab$(OE) exceptions$(OE)
229 $(MEX) $(MEXFLAGS) -o matlab/dai_potstrength matlab/dai_potstrength.cpp matlab/matlab$(OE) exceptions$(OE)
231 matlab/matlab$(OE) : matlab/matlab.cpp matlab/matlab.h $(HEADERS)
232 $(MEX) $(MEXFLAGS) -outdir matlab -c matlab/matlab.cpp
238 utils/createfg$(EE) : utils/createfg.cpp $(HEADERS) $(LIB)/libdai$(LE)
239 $(CC) $(CCFLAGS) /Feutils/createfg utils/createfg.cpp $(LIBS) $(BOOSTLIBS)
241 utils/fg2dot$(EE) : utils/fg2dot.cpp $(HEADERS) $(LIB)/libdai$(LE)
242 $(CC) $(CCFLAGS) /Feutils/fg2dot utils/fg2dot.cpp $(LIBS)
244 utils/fginfo$(EE) : utils/fginfo.cpp $(HEADERS) $(LIB)/libdai$(LE)
245 $(CC) $(CCFLAGS) /Feutils/fginfo utils/fginfo.cpp $(LIBS)