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 # We use the BOOST Program Options library
44 BOOSTFLAGS
= -lboost_program_options
46 # Compile using GNU C++ Compiler
49 # Flags for the C++ compiler
50 CCFLAGS
= -Wall
-W
-Wextra
-fpic
-I.
/include -Llib
-O3
#-pg #-static #-DVERBOSE
52 CCFLAGS
:= $(CCFLAGS
) -g
-DDAI_DEBUG
58 CCFLAGS
:= $(CCFLAGS
) -DWITH_BP
59 OBJECTS
:= $(OBJECTS
) bp.o
62 CCFLAGS
:= $(CCFLAGS
) -DWITH_MF
63 OBJECTS
:= $(OBJECTS
) mf.o
66 CCFLAGS
:= $(CCFLAGS
) -DWITH_HAK
67 OBJECTS
:= $(OBJECTS
) hak.o
70 CCFLAGS
:= $(CCFLAGS
) -DWITH_LC
71 OBJECTS
:= $(OBJECTS
) lc.o
74 CCFLAGS
:= $(CCFLAGS
) -DWITH_TREEEP
75 OBJECTS
:= $(OBJECTS
) treeep.o
78 CCFLAGS
:= $(CCFLAGS
) -DWITH_JTREE
79 OBJECTS
:= $(OBJECTS
) jtree.o
82 CCFLAGS
:= $(CCFLAGS
) -DWITH_MR
83 OBJECTS
:= $(OBJECTS
) mr.o
87 # Replace the following by the directory where Matlab has been installed
88 MATLABDIR
= /opt
/matlab
/bin
89 # Replace the following with the extension of compiled MEX files on this platform, e.g. .mexglx for x86
91 MEX
= $(MATLABDIR
)/mex
94 MEXFLAGS
:= $(MEXFLAGS
) -g
-DDAI_DEBUG
97 MEXFLAGS
:= $(MEXFLAGS
) -largeArrayDims
99 MEXFLAGS
:= $(MEXFLAGS
) -DSMALLMEM
103 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
105 TARGETS
= tests utils
$(LIB
)/libdai.a example testregression doc
107 TARGETS
:= $(TARGETS
) matlabs
112 matlabs
: matlab
/dai.
$(MEXEXT
) matlab
/dai_readfg.
$(MEXEXT
) matlab
/dai_writefg.
$(MEXEXT
) matlab
/dai_removeshortloops.
$(MEXEXT
) matlab
/dai_potstrength.
$(MEXEXT
)
114 $(LIB
)/libdai.a
: daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o
$(OBJECTS
)
115 ar rcs
$(LIB
)/libdai.a daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o
$(OBJECTS
)
119 utils
: utils
/createfg utils
/fg2dot utils
/remove_short_loops utils
/fginfo
121 testregression
: tests
/test
122 echo Testing...this can take a while...
123 cd tests
; time .
/testregression
; cd ..
125 doc
: $(INC
)/*.h
$(SRC
)/*.
cpp doxygen.conf
129 rm *.o example matlab
/*.
$(MEXEXT
) matlab
/*.o tests
/test utils
/fg2dot utils
/createfg utils
/remove_short_loops utils
/fginfo
$(LIB
)/libdai.a
; echo
133 daialg.o
: $(SRC
)/daialg.
cpp $(HEADERS
)
134 $(CC
) $(CCFLAGS
) -c
$(SRC
)/daialg.
cpp
136 bp.o
: $(SRC
)/bp.
cpp $(INC
)/bp.h
$(HEADERS
)
137 $(CC
) $(CCFLAGS
) -c
$(SRC
)/bp.
cpp
139 lc.o
: $(SRC
)/lc.
cpp $(INC
)/lc.h
$(HEADERS
)
140 $(CC
) $(CCFLAGS
) -c
$(SRC
)/lc.
cpp
142 mf.o
: $(SRC
)/mf.
cpp $(INC
)/mf.h
$(HEADERS
)
143 $(CC
) $(CCFLAGS
) -c
$(SRC
)/mf.
cpp
145 factorgraph.o
: $(SRC
)/factorgraph.
cpp $(INC
)/factorgraph.h
$(HEADERS
)
146 $(CC
) $(CCFLAGS
) -c
$(SRC
)/factorgraph.
cpp
148 util.o
: $(SRC
)/util.
cpp $(INC
)/util.h
$(HEADERS
)
149 $(CC
) $(CCFLAGS
) -c
$(SRC
)/util.
cpp
151 regiongraph.o
: $(SRC
)/regiongraph.
cpp $(INC
)/regiongraph.h
$(HEADERS
)
152 $(CC
) $(CCFLAGS
) -c
$(SRC
)/regiongraph.
cpp
154 hak.o
: $(SRC
)/hak.
cpp $(INC
)/hak.h
$(HEADERS
) $(INC
)/regiongraph.h
155 $(CC
) $(CCFLAGS
) -c
$(SRC
)/hak.
cpp
157 clustergraph.o
: $(SRC
)/clustergraph.
cpp $(INC
)/clustergraph.h
$(HEADERS
)
158 $(CC
) $(CCFLAGS
) -c
$(SRC
)/clustergraph.
cpp
160 jtree.o
: $(SRC
)/jtree.
cpp $(INC
)/jtree.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
161 $(CC
) $(CCFLAGS
) -c
$(SRC
)/jtree.
cpp
163 treeep.o
: $(SRC
)/treeep.
cpp $(INC
)/treeep.h
$(HEADERS
) $(INC
)/weightedgraph.h
$(INC
)/clustergraph.h
$(INC
)/regiongraph.h
$(INC
)/jtree.h
164 $(CC
) $(CCFLAGS
) -c
$(SRC
)/treeep.
cpp
166 weightedgraph.o
: $(SRC
)/weightedgraph.
cpp $(INC
)/weightedgraph.h
$(HEADERS
)
167 $(CC
) $(CCFLAGS
) -c
$(SRC
)/weightedgraph.
cpp
169 mr.o
: $(SRC
)/mr.
cpp $(INC
)/mr.h
$(HEADERS
)
170 $(CC
) $(CCFLAGS
) -c
$(SRC
)/mr.
cpp
172 properties.o
: $(SRC
)/properties.
cpp $(HEADERS
)
173 $(CC
) $(CCFLAGS
) -c
$(SRC
)/properties.
cpp
175 alldai.o
: $(SRC
)/alldai.
cpp $(HEADERS
)
176 $(CC
) $(CCFLAGS
) -c
$(SRC
)/alldai.
cpp
178 x2x.o
: $(SRC
)/x2x.
cpp $(HEADERS
)
179 $(CC
) $(CCFLAGS
) -c
$(SRC
)/x2x.
cpp
184 example
: example.
cpp $(HEADERS
) $(LIB
)/libdai.a
185 $(CC
) $(CCFLAGS
) -o example example.
cpp -ldai
190 tests
/test : tests
/test.
cpp $(HEADERS
) $(LIB
)/libdai.a
191 $(CC
) $(CCFLAGS
) -o tests
/test tests
/test.
cpp -ldai
$(BOOSTFLAGS
)
197 matlab
/dai.
$(MEXEXT
) : matlab
/dai.
cpp $(HEADERS
) matlab
/matlab.o
$(LIB
)/libdai.a
198 $(MEX
) $(MEXFLAGS
) -o matlab
/dai matlab
/dai.
cpp matlab
/matlab.o
$(LIB
)/libdai.a
200 matlab
/dai_readfg.
$(MEXEXT
) : matlab
/dai_readfg.
cpp $(HEADERS
) factorgraph.o matlab
/matlab.o
201 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_readfg matlab
/dai_readfg.
cpp factorgraph.o matlab
/matlab.o
203 matlab
/dai_writefg.
$(MEXEXT
) : matlab
/dai_writefg.
cpp $(HEADERS
) factorgraph.o matlab
/matlab.o
204 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_writefg matlab
/dai_writefg.
cpp factorgraph.o matlab
/matlab.o
206 matlab
/dai_removeshortloops.
$(MEXEXT
) : matlab
/dai_removeshortloops.
cpp $(HEADERS
) factorgraph.o matlab
/matlab.o
207 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_removeshortloops matlab
/dai_removeshortloops.
cpp factorgraph.o matlab
/matlab.o
209 matlab
/dai_potstrength.
$(MEXEXT
) : matlab
/dai_potstrength.
cpp $(HEADERS
) matlab
/matlab.o
210 $(MEX
) $(MEXFLAGS
) -o matlab
/dai_potstrength matlab
/dai_potstrength.
cpp matlab
/matlab.o
212 matlab
/matlab.o
: matlab
/matlab.
cpp matlab
/matlab.h
$(HEADERS
)
213 $(MEX
) $(MEXFLAGS
) -outdir matlab
-c matlab
/matlab.
cpp
219 utils
/createfg
: utils
/createfg.
cpp $(HEADERS
) factorgraph.o weightedgraph.o util.o
220 $(CC
) $(CCFLAGS
) -o utils
/createfg utils
/createfg.
cpp factorgraph.o weightedgraph.o util.o
$(BOOSTFLAGS
)
222 utils
/fg2dot
: utils
/fg2dot.
cpp $(HEADERS
) factorgraph.o
223 $(CC
) $(CCFLAGS
) -o utils
/fg2dot utils
/fg2dot.
cpp factorgraph.o
225 utils
/remove_short_loops
: utils
/remove_short_loops.
cpp $(HEADERS
) factorgraph.o
226 $(CC
) $(CCFLAGS
) -o utils
/remove_short_loops utils
/remove_short_loops.
cpp factorgraph.o
228 utils
/fginfo
: utils
/fginfo.
cpp $(HEADERS
) factorgraph.o
229 $(CC
) $(CCFLAGS
) -o utils
/fginfo utils
/fginfo.
cpp factorgraph.o