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 # We use the BOOST Program Options library
22 BOOSTFLAGS
= -lboost_program_options
24 # Compile using GNU C++ Compiler
27 # Flags for the C++ compiler
28 CCFLAGS
= -Wall
-fpic
-g
-DDEBUG
-I.
-I
$(HOME
)/include -O3
#-static #-pg #-DVERBOSE
30 # To enable the Matlab interface, define WITH_MATLAB = yes
33 # Replace the following by the directory where Matlab has been installed
34 MATLABDIR
= /opt
/matlab
/bin
35 MEX
= $(MATLABDIR
)/mex
36 MEXFLAGS
= -g
-I.
-DDEBUG
-largeArrayDims
#-g means debugging
39 # Replace the following with the extension of compiled MEX files on this platform, e.g. .mexglx for x86
42 HEADERS
= bipgraph.h diffs.h index.h var.h factor.h varset.h prob.h daialg.h properties.h alldai.h enum.h x2x.h
44 # target matlabs is disabled by default since it only compiles with a very recent MatLab version
45 TARGETS
= tests utils libdai.a example testregression
47 TARGETS
:= $(TARGETS
) matlabs
52 matlabs
: matlab
/dai.
$(MEXEXT
) matlab
/dai_readfg.
$(MEXEXT
) matlab
/dai_writefg.
$(MEXEXT
) matlab
/dai_removeshortloops.
$(MEXEXT
) matlab
/dai_potstrength.
$(MEXEXT
)
54 libdai.a
: daialg.o alldai.o bp.o clustergraph.o factorgraph.o hak.o jtree.o lc.o mf.o mr.o properties.o regiongraph.o util.o treeep.o weightedgraph.o x2x.o
55 ar rcs libdai.a daialg.o alldai.o bp.o clustergraph.o factorgraph.o hak.o jtree.o lc.o mf.o mr.o properties.o regiongraph.o util.o treeep.o weightedgraph.o x2x.o
59 utils
: utils
/createfg utils
/fg2dot utils
/remove_short_loops utils
/fginfo
61 testregression
: tests
/test
62 echo Testing...this can take a while...
63 cd tests
; .
/testregression
; cd ..
65 doc
: *.h
*.
cpp doxygen.conf
69 rm *.o
*.
$(MEXEXT
) example matlab
/*.
$(MEXEXT
) matlab
/*.o tests
/test utils
/fg2dot utils
/createfg utils
/remove_short_loops utils
/fginfo libdai.a
; echo
73 daialg.o
: daialg.
cpp $(HEADERS
)
74 $(CC
) $(CCFLAGS
) -c daialg.
cpp
76 bp.o
: bp.
cpp bp.h
$(HEADERS
)
77 $(CC
) $(CCFLAGS
) -c bp.
cpp
79 lc.o
: lc.
cpp lc.h
$(HEADERS
)
80 $(CC
) $(CCFLAGS
) -c lc.
cpp
82 mf.o
: mf.
cpp mf.h
$(HEADERS
)
83 $(CC
) $(CCFLAGS
) -c mf.
cpp
85 factorgraph.o
: factorgraph.
cpp factorgraph.h
$(HEADERS
)
86 $(CC
) $(CCFLAGS
) -c factorgraph.
cpp
88 util.o
: util.
cpp util.h
$(HEADERS
)
89 $(CC
) $(CCFLAGS
) -c util.
cpp
91 regiongraph.o
: regiongraph.
cpp regiongraph.h
$(HEADERS
)
92 $(CC
) $(CCFLAGS
) -c regiongraph.
cpp
94 hak.o
: hak.
cpp hak.h
$(HEADERS
) regiongraph.h
95 $(CC
) $(CCFLAGS
) -c hak.
cpp
97 clustergraph.o
: clustergraph.
cpp clustergraph.h
$(HEADERS
)
98 $(CC
) $(CCFLAGS
) -c clustergraph.
cpp
100 jtree.o
: jtree.
cpp jtree.h
$(HEADERS
) weightedgraph.h clustergraph.h regiongraph.h
101 $(CC
) $(CCFLAGS
) -c jtree.
cpp
103 treeep.o
: treeep.
cpp treeep.h
$(HEADERS
) weightedgraph.h clustergraph.h regiongraph.h jtree.h
104 $(CC
) $(CCFLAGS
) -c treeep.
cpp
106 weightedgraph.o
: weightedgraph.
cpp weightedgraph.h
$(HEADERS
)
107 $(CC
) $(CCFLAGS
) -c weightedgraph.
cpp
109 mr.o
: mr.
cpp mr.h
$(HEADERS
)
110 $(CC
) $(CCFLAGS
) -c mr.
cpp
112 properties.o
: properties.
cpp $(HEADERS
)
113 $(CC
) $(CCFLAGS
) -c properties.
cpp
115 alldai.o
: alldai.
cpp $(HEADERS
)
116 $(CC
) $(CCFLAGS
) -c alldai.
cpp
118 x2x.o
: x2x.
cpp $(HEADERS
)
119 $(CC
) $(CCFLAGS
) -c x2x.
cpp
124 example
: example.
cpp $(HEADERS
) libdai.a
125 $(CC
) $(CCFLAGS
) -o example example.
cpp -L. libdai.a
130 tests
/test : tests
/test.
cpp $(HEADERS
) libdai.a
131 $(CC
) $(CCFLAGS
) -o tests
/test tests
/test.
cpp -L.
-ldai
$(BOOSTFLAGS
)
137 matlab
/dai.
$(MEXEXT
) : matlab
/dai.
cpp $(HEADERS
) matlab
/matlab.o daialg.o alldai.o bp.o clustergraph.o factorgraph.o hak.o jtree.o lc.o mf.o mr.o properties.o regiongraph.o util.o treeep.o weightedgraph.o x2x.o
138 $(MEX
) $(MEXFLAGS
) -o matlab
/dai matlab
/dai.
cpp matlab
/matlab.o daialg.o alldai.o bp.o clustergraph.o factorgraph.o hak.o jtree.o lc.o mf.o mr.o properties.o regiongraph.o util.o treeep.o weightedgraph.o x2x.o
140 matlab
/dai_readfg.
$(MEXEXT
) : matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph.o matlab
/matlab.o
141 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_readfg matlab
/dai_readfg.
cpp factorgraph.o matlab
/matlab.o
143 matlab
/dai_writefg.
$(MEXEXT
) : matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph.o matlab
/matlab.o
144 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_writefg matlab
/dai_writefg.
cpp factorgraph.o matlab
/matlab.o
146 matlab
/dai_removeshortloops.
$(MEXEXT
) : matlab
/dai_removeshortloops.
cpp $(HEADERS
) factorgraph.o matlab
/matlab.o
147 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_removeshortloops matlab
/dai_removeshortloops.
cpp factorgraph.o matlab
/matlab.o
149 matlab
/dai_potstrength.
$(MEXEXT
) : matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
/matlab.o
150 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_potstrength matlab
/dai_potstrength.
cpp matlab
/matlab.o
152 matlab
/matlab.o
: matlab
/matlab.
cpp matlab
/matlab.h
$(HEADERS
)
153 $(MEX
) $(MEXFLAGS
) -outdir matlab
-c matlab
/matlab.
cpp
159 utils
/createfg
: utils
/createfg.
cpp $(HEADERS
) factorgraph.o weightedgraph.o util.o
160 $(CC
) $(CCFLAGS
) -o utils
/createfg utils
/createfg.
cpp factorgraph.o weightedgraph.o util.o
$(BOOSTFLAGS
)
162 utils
/fg2dot
: utils
/fg2dot.
cpp $(HEADERS
) factorgraph.o
163 $(CC
) $(CCFLAGS
) -o utils
/fg2dot utils
/fg2dot.
cpp factorgraph.o
165 utils
/remove_short_loops
: utils
/remove_short_loops.
cpp $(HEADERS
) factorgraph.o
166 $(CC
) $(CCFLAGS
) -o utils
/remove_short_loops utils
/remove_short_loops.
cpp factorgraph.o
168 utils
/fginfo
: utils
/fginfo.
cpp $(HEADERS
) factorgraph.o
169 $(CC
) $(CCFLAGS
) -o utils
/fginfo utils
/fginfo.
cpp factorgraph.o