93b01a303aee57fb6b8155122ae7276cf12e7519
[libdai.git] / Makefile
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
4 #
5 # This file is part of libDAI.
6 #
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.
11 #
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.
16 #
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
20
21
22 # Enable/disable various approximate inference methods
23 WITH_BP=true
24 WITH_MF=true
25 WITH_HAK=true
26 WITH_LC=true
27 WITH_TREEEP=true
28 WITH_JTREE=true
29 WITH_MR=true
30 # Build with debug info?
31 DEBUG=true
32 # Build matlab interface?
33 WITH_MATLAB=
34 # New/old matlab version?
35 NEW_MATLAB=true
36 # Windows or linux (default)?
37 WINDOWS=
38
39 # Directories
40 INC=include/dai
41 SRC=src
42 LIB=lib
43
44 # Extensions (library, object, executable, matlab compiled MEX file)
45 LE=.a
46 OE=.o
47 EE=
48 ME=.mexglx
49
50 # Libraries
51 LIBS=-ldai
52
53 # We use the BOOST Program Options library
54 BOOSTLIBS=-lboost_program_options
55
56 # Compile using GNU C++ Compiler
57 CC=g++
58 # Output filename option
59 CCO=-o
60
61 # Flags for the C++ compiler
62 CCFLAGS=-O3 -Wno-deprecated -Wall -W -Wextra -fpic -Iinclude -Llib
63 CCDEBUGFLAGS=-g -DDAI_DEBUG
64
65 # Build targets
66 TARGETS=tests utils $(LIB)/libdai$(LE) examples testregression doc
67
68 ifdef WITH_MATLAB
69 # Replace the following by the directory where Matlab has been installed
70 MATLABDIR=/agbs/share/sw/matlab
71 MEX=$(MATLABDIR)/bin/mex
72 MEXFLAGS=-Iinclude CXX\#$(CC) CXXFLAGS\#'-O3 -Wno-deprecated -Wall -W -Wextra -fpic'
73 endif
74
75
76 include Makefile.shared
77
78
79 $(LIB)/libdai$(LE) : bipgraph$(OE) daialg$(OE) alldai$(OE) clustergraph$(OE) factorgraph$(OE) properties$(OE) regiongraph$(OE) util$(OE) weightedgraph$(OE) exceptions$(OE) $(OBJECTS)
80 -mkdir -p lib
81 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)
82
83 testregression : tests/testdai$(EE)
84 @echo Starting regression test...this can take a minute or so!
85 cd tests; time ./testregression; cd ..
86
87 doc : $(INC)/*.h $(SRC)/*.cpp examples/*.cpp doxygen.conf
88 doxygen doxygen.conf
89
90 .PHONY : clean
91 clean :
92 -rm *$(OE)
93 -rm matlab/*$(ME)
94 -rm examples/example$(EE) examples/example_bipgraph$(EE) examples/example_varset$(EE)
95 -rm tests/testdai$(EE)
96 -rm utils/fg2dot$(EE) utils/createfg$(EE) utils/fginfo$(EE)
97 -rm -R doc
98 -rm -R lib