49f51cbab0bb363213704a5c0de61ca8e8c1a655
[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 WITH_GIBBS=true
31 # Build with debug info?
32 DEBUG=true
33 # Build matlab interface?
34 WITH_MATLAB=
35 # New/old matlab version?
36 NEW_MATLAB=true
37
38 # Default OS = GNU/Linux
39 # Windows Visual C++?
40 WINDOWS=
41 # Cygwin?
42 CYGWIN=
43
44 # Directories
45 INC=include/dai
46 SRC=src
47 LIB=lib
48
49 # Extensions (library, object, executable, matlab compiled MEX file)
50 LE=.a
51 OE=.o
52 EE=
53 ME=.mexglx
54
55 # Libraries
56 LIBS=-ldai
57
58 # We use the BOOST Program Options library
59 ifdef CYGWIN
60 BOOSTLIBS=-lboost_program_options-gcc34-mt
61 else
62 BOOSTLIBS=-lboost_program_options
63 endif
64
65 # Compile using GNU C++ Compiler
66 CC=g++
67 # Output filename option
68 CCO=-o
69
70 # Flags for the C++ compiler
71 CCFLAGS=-O3 -Wno-deprecated -Wall -W -Wextra -fpic -Iinclude -Llib
72 ifdef CYGWIN
73 CCFLAGS:=$(CCFLAGS) -I/usr/local/include/boost-1_37 -DCYGWIN -static
74 # dynamic linking of Boost libraries seems not to work on Cygwin
75 endif
76 CCDEBUGFLAGS=-g -DDAI_DEBUG
77
78 # Build targets
79 TARGETS=tests utils $(LIB)/libdai$(LE) examples testregression doc
80
81 ifdef WITH_MATLAB
82 # Replace the following by the directory where Matlab has been installed
83 MATLABDIR=/agbs/share/sw/matlab
84 MEX=$(MATLABDIR)/bin/mex
85 MEXFLAGS=-Iinclude CXX\#$(CC) CXXFLAGS\#'-O3 -Wno-deprecated -Wall -W -Wextra -fpic'
86 endif
87
88
89 include Makefile.shared
90
91
92 $(LIB)/libdai$(LE) : bipgraph$(OE) daialg$(OE) alldai$(OE) clustergraph$(OE) factorgraph$(OE) properties$(OE) regiongraph$(OE) util$(OE) weightedgraph$(OE) exceptions$(OE) $(OBJECTS)
93 -mkdir -p lib
94 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)
95
96 testregression : tests/testdai$(EE)
97 @echo Starting regression test...this can take a minute or so!
98 cd tests && ./testregression && cd ..
99
100 doc : $(INC)/*.h $(SRC)/*.cpp examples/*.cpp doxygen.conf
101 doxygen doxygen.conf
102
103 .PHONY : clean
104 clean :
105 -rm *$(OE)
106 -rm matlab/*$(ME)
107 -rm examples/example$(EE) examples/example_bipgraph$(EE) examples/example_varset$(EE)
108 -rm tests/testdai$(EE)
109 -rm utils/fg2dot$(EE) utils/createfg$(EE) utils/fginfo$(EE)
110 -rm -R doc
111 -rm -R lib