1 # Copyright (C) 2006-2009 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 # Choose OS from {LINUX, WINDOWS, CYGWIN, MACOSX}
23 # LINUX: GNU/Linux and other UNIX variants
24 # WINDOWS: Visual C++ with GNU Make
29 # Enable/disable various approximate inference methods
39 # Build with debug info?
42 # Build matlab interface?
44 # New/old matlab version?
48 # Location libDAI headers
50 # Location of libDAI source files
52 # Destination directory of libDAI library
54 # Additional iclude paths for C compiler
57 # Extensions (library, object, executable, matlab compiled MEX file)
73 # Additional library paths for linker
76 # For some reason, we have to add the VC library path, although it is in the environment
77 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"
80 # Tell the linker to link with the BOOST Program Options library
82 BOOSTLIBS
=-lboost_program_options-gcc34-mt
85 BOOSTLIBS
=-lboost_program_options-mt
88 BOOSTLIBS
=-lboost_program_options
91 BOOSTLIBS
=/LIBPATH
:C
:\boost_
1_
36_
0\stage\lib
94 # Compiler specific options
96 # Compile using GNU C++ Compiler
98 # Output filename option of the compiler
101 # Compile using Visual C++ Compiler
103 # Output filename option
107 # Flags for the C++ compiler
108 ifneq ($(OS
),WINDOWS
)
109 CCFLAGS
=-O3
-Wno-deprecated
-Wall
-W
-Wextra
-fpic
110 CCDEBUGFLAGS
=-g
-DDAI_DEBUG
112 CCFLAGS
=/Iinclude
/IC
:\boost_
1_
36_
0 /EHsc
/Ox
113 CCDEBUGFLAGS
=/Zi
-DDAI_DEBUG
117 CCINC
:=$(CCINC
) -I
/usr
/local
/include/boost-1_37
118 # dynamic linking of Boost libraries seems not to work on Cygwin
119 CCFLAGS
:=$(CCFLAGS
) -DCYGWIN
-static
122 # indicate where your boost headers and libraries are (likely where macports installs libraries)
123 CCINC
:=$(CCINC
) -I
/opt
/local
/include
124 CCLIB
:=$(CCLIB
) -L
/opt
/local
/lib
128 TARGETS
=tests utils
$(LIB
)/libdai
$(LE
) examples testregression
129 ifneq ($(OS
),WINDOWS
)
130 TARGETS
:=$(TARGETS
) doc
134 ifneq ($(OS
),WINDOWS
)
135 # Replace the following by the directory where Matlab has been installed
136 MATLABDIR
=/agbs
/share
/sw
/matlab
137 MEX
=$(MATLABDIR
)/bin
/mex
138 MEXFLAGS
=CXX\
#$(CC) CXXFLAGS\#'$(CCFLAGS)'
140 # Replace the following by the directory where Matlab has been installed
142 MEX
=$(MATLABDIR
)\bin\mex
143 MEXFLAGS
=-Iinclude CXX\
#$(CC) CXXFLAGS\#"/EHsc /Ox"
149 CCFLAGS
:=$(CCFLAGS
) $(CCDEBUGFLAGS
)
152 CCFLAGS
:=$(CCFLAGS
) -DWINDOWS
155 TARGETS
:=$(TARGETS
) matlabs
157 MEXFLAGS
:=$(MEXFLAGS
) -largeArrayDims
159 MEXFLAGS
:=$(MEXFLAGS
) -DSMALLMEM
164 OBJECTS
:=exactinf
$(OE
)
166 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_BP
167 OBJECTS
:=$(OBJECTS
) bp
$(OE
)
170 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MF
171 OBJECTS
:=$(OBJECTS
) mf
$(OE
)
174 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_HAK
175 OBJECTS
:=$(OBJECTS
) hak
$(OE
)
178 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_LC
179 OBJECTS
:=$(OBJECTS
) lc
$(OE
)
182 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_TREEEP
183 OBJECTS
:=$(OBJECTS
) treeep
$(OE
)
186 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_JTREE
187 OBJECTS
:=$(OBJECTS
) jtree
$(OE
)
190 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_MR
191 OBJECTS
:=$(OBJECTS
) mr
$(OE
)
194 CCFLAGS
:=$(CCFLAGS
) -DDAI_WITH_GIBBS
195 OBJECTS
:=$(OBJECTS
) gibbs
$(OE
)
199 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
202 CC
:=$(CC
) $(CCINC
) $(CCLIB
) $(CCFLAGS
)
203 MEX
:=$(MEX
) $(CCLIB
) $(CCINC
) $(MEXFLAGS
)
211 examples
: examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_sprinkler
$(EE
)
213 matlabs
: matlab
/dai
$(ME
) matlab
/dai_readfg
$(ME
) matlab
/dai_writefg
$(ME
) matlab
/dai_potstrength
$(ME
)
215 tests
: tests
/testdai
$(EE
)
217 utils
: utils
/createfg
$(EE
) utils
/fg2dot
$(EE
) utils
/fginfo
$(EE
)
223 bipgraph
$(OE
) : $(SRC
)/bipgraph.
cpp $(HEADERS
)
224 $(CC
) -c
$(SRC
)/bipgraph.
cpp
226 daialg
$(OE
) : $(SRC
)/daialg.
cpp $(HEADERS
)
227 $(CC
) -c
$(SRC
)/daialg.
cpp
229 exactinf
$(OE
) : $(SRC
)/exactinf.
cpp $(INC
)/exactinf.h
$(HEADERS
)
230 $(CC
) -c
$(SRC
)/exactinf.
cpp
232 bp
$(OE
) : $(SRC
)/bp.
cpp $(INC
)/bp.h
$(HEADERS
)
233 $(CC
) -c
$(SRC
)/bp.
cpp
235 lc
$(OE
) : $(SRC
)/lc.
cpp $(INC
)/lc.h
$(HEADERS
)
236 $(CC
) -c
$(SRC
)/lc.
cpp
238 mf
$(OE
) : $(SRC
)/mf.
cpp $(INC
)/mf.h
$(HEADERS
)
239 $(CC
) -c
$(SRC
)/mf.
cpp
241 factorgraph
$(OE
) : $(SRC
)/factorgraph.
cpp $(INC
)/factorgraph.h
$(HEADERS
)
242 $(CC
) -c
$(SRC
)/factorgraph.
cpp
244 util
$(OE
) : $(SRC
)/util.
cpp $(INC
)/util.h
$(HEADERS
)
245 $(CC
) -c
$(SRC
)/util.
cpp
247 regiongraph
$(OE
) : $(SRC
)/regiongraph.
cpp $(INC
)/regiongraph.h
$(HEADERS
)
248 $(CC
) -c
$(SRC
)/regiongraph.
cpp
250 hak
$(OE
) : $(SRC
)/hak.
cpp $(INC
)/hak.h
$(HEADERS
) $(INC
)/regiongraph.h
251 $(CC
) -c
$(SRC
)/hak.
cpp
253 clustergraph
$(OE
) : $(SRC
)/clustergraph.
cpp $(INC
)/clustergraph.h
$(HEADERS
)
254 $(CC
) -c
$(SRC
)/clustergraph.
cpp
256 jtree
$(OE
) : $(SRC
)/jtree.
cpp $(INC
)/jtree.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
257 $(CC
) -c
$(SRC
)/jtree.
cpp
259 treeep
$(OE
) : $(SRC
)/treeep.
cpp $(INC
)/treeep.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
$(INC
)/jtree.h
260 $(CC
) -c
$(SRC
)/treeep.
cpp
262 weightedgraph
$(OE
) : $(SRC
)/weightedgraph.
cpp $(INC
)/weightedgraph.h
$(HEADERS
)
263 $(CC
) -c
$(SRC
)/weightedgraph.
cpp
265 mr
$(OE
) : $(SRC
)/mr.
cpp $(INC
)/mr.h
$(HEADERS
)
266 $(CC
) -c
$(SRC
)/mr.
cpp
268 gibbs
$(OE
) : $(SRC
)/gibbs.
cpp $(INC
)/gibbs.h
$(HEADERS
)
269 $(CC
) -c
$(SRC
)/gibbs.
cpp
271 properties
$(OE
) : $(SRC
)/properties.
cpp $(HEADERS
)
272 $(CC
) -c
$(SRC
)/properties.
cpp
274 exceptions
$(OE
) : $(SRC
)/exceptions.
cpp $(HEADERS
)
275 $(CC
) -c
$(SRC
)/exceptions.
cpp
277 alldai
$(OE
) : $(SRC
)/alldai.
cpp $(HEADERS
)
278 $(CC
) -c
$(SRC
)/alldai.
cpp
284 examples
/example
$(EE
) : examples
/example.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
285 $(CC
) $(CCO
)examples
/example
$(EE
) examples
/example.
cpp $(LIBS
)
287 examples
/example_bipgraph
$(EE
) : examples
/example_bipgraph.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
288 $(CC
) $(CCO
)examples
/example_bipgraph
$(EE
) examples
/example_bipgraph.
cpp $(LIBS
)
290 examples
/example_varset
$(EE
) : examples
/example_varset.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
291 $(CC
) $(CCO
)examples
/example_varset
$(EE
) examples
/example_varset.
cpp $(LIBS
)
293 examples
/example_sprinkler
$(EE
) : examples
/example_sprinkler.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
294 $(CC
) $(CCO
)examples
/example_sprinkler
$(EE
) examples
/example_sprinkler.
cpp $(LIBS
)
300 tests
/testdai
$(EE
) : tests
/testdai.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
301 $(CC
) $(CCO
)tests
/testdai
$(EE
) tests
/testdai.
cpp $(LIBS
) $(BOOSTLIBS
)
307 matlab
/dai
$(ME
) : $(SRC
)/matlab
/dai.
cpp $(HEADERS
) matlab
$(OE
) $(LIB
)/libdai
$(LE
)
308 $(MEX
) -o matlab
/dai
$(SRC
)/matlab
/dai.
cpp matlab
$(OE
) $(LIB
)/libdai
$(LE
)
310 matlab
/dai_readfg
$(ME
) : $(SRC
)/matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
311 $(MEX
) -o matlab
/dai_readfg
$(SRC
)/matlab
/dai_readfg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
313 matlab
/dai_writefg
$(ME
) : $(SRC
)/matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
314 $(MEX
) -o matlab
/dai_writefg
$(SRC
)/matlab
/dai_writefg.
cpp factorgraph
$(OE
) matlab
$(OE
) exceptions
$(OE
)
316 matlab
/dai_potstrength
$(ME
) : $(SRC
)/matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
$(OE
) exceptions
$(OE
)
317 $(MEX
) -o matlab
/dai_potstrength
$(SRC
)/matlab
/dai_potstrength.
cpp matlab
$(OE
) exceptions
$(OE
)
319 matlab
$(OE
) : $(SRC
)/matlab
/matlab.
cpp $(INC
)/matlab
/matlab.h
$(HEADERS
)
320 $(MEX
) -c
$(SRC
)/matlab
/matlab.
cpp
326 utils
/createfg
$(EE
) : utils
/createfg.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
327 $(CC
) $(CCO
)utils
/createfg
$(EE
) utils
/createfg.
cpp $(LIBS
) $(BOOSTLIBS
)
329 utils
/fg2dot
$(EE
) : utils
/fg2dot.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
330 $(CC
) $(CCO
)utils
/fg2dot
$(EE
) utils
/fg2dot.
cpp $(LIBS
)
332 utils
/fginfo
$(EE
) : utils
/fginfo.
cpp $(HEADERS
) $(LIB
)/libdai
$(LE
)
333 $(CC
) $(CCO
)utils
/fginfo
$(EE
) utils
/fginfo.
cpp $(LIBS
)
339 ifneq ($(OS
),WINDOWS
)
340 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
342 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
)
344 $(LIB
)/libdai
$(LE
) : bipgraph
$(OE
) daialg
$(OE
) alldai
$(OE
) clustergraph
$(OE
) factorgraph
$(OE
) properties
$(OE
) regiongraph
$(OE
) util
$(OE
) weightedgraph
$(OE
) exceptions
$(OE
) $(OBJECTS
)
346 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
)
353 ifneq ($(OS
),WINDOWS
)
354 testregression
: tests
/testdai
$(EE
)
355 @echo Starting regression
test...this can take a minute or so
!
356 cd tests
&& .
/testregression
&& cd ..
358 testregression
: tests
/testdai
$(EE
)
359 @echo Starting regression
test...this can take a minute or so
!
360 cd tests
&& testregression.bat
&& cd ..
367 doc
: $(INC
)/*.h
$(SRC
)/*.
cpp examples
/*.
cpp doxygen.conf
374 ifneq ($(OS
),WINDOWS
)
379 -rm examples
/example
$(EE
) examples
/example_bipgraph
$(EE
) examples
/example_varset
$(EE
) examples
/example_sprinkler
$(EE
)
380 -rm tests
/testdai
$(EE
)
381 -rm utils
/fg2dot
$(EE
) utils
/createfg
$(EE
) utils
/fginfo
$(EE
)
387 -del
*$(OE
) *.ilk
*.pdb
*$(EE
) matlab\
*$(ME
) examples\
*$(EE
) examples\
*.ilk examples\
*.pdb tests
\testdai
$(EE
) tests\
*.pdb tests\
*.ilk utils\
*$(EE
) utils\
*.pdb utils\
*.ilk
$(LIB
)\libdai
$(LE
)