Merge branch 'master' of git@git.tuebingen.mpg.de:libdai
[libdai.git] / Makefile
index a3e5c35..5740a10 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,9 +26,14 @@ WITH_LC = true
 WITH_TREEEP = true
 WITH_JTREE = true
 WITH_MR = true
+# Build with debug info?
 DEBUG = true
-NEW_MATLAB = true
+# Build matlab interface?
 WITH_MATLAB =
+# New/old matlab version?
+NEW_MATLAB = true
+# Windows or linux (default)?
+WINDOWS =
 
 # Directories
 INC = include/dai
@@ -42,7 +47,7 @@ BOOSTFLAGS = -lboost_program_options
 CC = g++
 
 # Flags for the C++ compiler
-CCFLAGS = -Wall -W -Wextra -fpic -I./include -Llib -O3 #-pg #-static -DVERBOSE
+CCFLAGS = -Wall -W -Wextra -fpic -I./include -Llib -O3 #-pg #-static #-DVERBOSE
 ifdef DEBUG
 CCFLAGS := $(CCFLAGS) -g -DDAI_DEBUG
 else
@@ -95,7 +100,7 @@ MEXFLAGS := $(MEXFLAGS) -DSMALLMEM
 endif
 endif
 
-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
+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 $(INC)/exceptions.h
 
 TARGETS = tests utils $(LIB)/libdai.a example testregression doc
 ifdef WITH_MATLAB
@@ -106,8 +111,8 @@ all : $(TARGETS)
 
 matlabs : matlab/dai.$(MEXEXT) matlab/dai_readfg.$(MEXEXT) matlab/dai_writefg.$(MEXEXT) matlab/dai_removeshortloops.$(MEXEXT) matlab/dai_potstrength.$(MEXEXT)
 
-$(LIB)/libdai.a : daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o $(OBJECTS)
-       ar rcs $(LIB)/libdai.a daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o $(OBJECTS)
+$(LIB)/libdai.a : bipgraph.o daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o exceptions.o $(OBJECTS)
+       ar rcs $(LIB)/libdai.a bipgraph.o daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o exceptions.o $(OBJECTS)
 
 tests : tests/test
 
@@ -124,6 +129,8 @@ clean :
        rm *.o example matlab/*.$(MEXEXT) matlab/*.o tests/test utils/fg2dot utils/createfg utils/remove_short_loops utils/fginfo $(LIB)/libdai.a; echo
        rm -R doc; echo
 
+bipgraph.o : $(SRC)/bipgraph.cpp $(HEADERS)
+       $(CC) $(CCFLAGS) -c $(SRC)/bipgraph.cpp
 
 daialg.o : $(SRC)/daialg.cpp $(HEADERS)
        $(CC) $(CCFLAGS) -c $(SRC)/daialg.cpp
@@ -167,6 +174,9 @@ mr.o : $(SRC)/mr.cpp $(INC)/mr.h $(HEADERS)
 properties.o : $(SRC)/properties.cpp $(HEADERS)
        $(CC) $(CCFLAGS) -c $(SRC)/properties.cpp
 
+exceptions.o: $(SRC)/exceptions.cpp $(HEADERS)
+       $(CC) $(CCFLAGS) -c $(SRC)/exceptions.cpp
+
 alldai.o : $(SRC)/alldai.cpp $(HEADERS)
        $(CC) $(CCFLAGS) -c $(SRC)/alldai.cpp
 
@@ -176,8 +186,8 @@ x2x.o : $(SRC)/x2x.cpp $(HEADERS)
 # EXAMPLE
 ##########
 
-example : $(SRC)/example.cpp $(HEADERS) $(LIB)/libdai.a
-       $(CC) $(CCFLAGS) -o example $(SRC)/example.cpp -ldai
+example : example.cpp $(HEADERS) $(LIB)/libdai.a
+       $(CC) $(CCFLAGS) -o example example.cpp -ldai
 
 # TESTS
 ########
@@ -211,14 +221,14 @@ matlab/matlab.o : matlab/matlab.cpp matlab/matlab.h $(HEADERS)
 # UTILS
 ########
 
-utils/createfg : utils/createfg.cpp $(HEADERS) factorgraph.o weightedgraph.o util.o
-       $(CC) $(CCFLAGS) -o utils/createfg utils/createfg.cpp factorgraph.o weightedgraph.o util.o $(BOOSTFLAGS)
+utils/createfg : utils/createfg.cpp $(HEADERS) factorgraph.o weightedgraph.o util.o bipgraph.o exceptions.o
+       $(CC) $(CCFLAGS) -o utils/createfg utils/createfg.cpp factorgraph.o weightedgraph.o util.o bipgraph.o exceptions.o $(BOOSTFLAGS)
 
-utils/fg2dot : utils/fg2dot.cpp $(HEADERS) factorgraph.o
-       $(CC) $(CCFLAGS) -o utils/fg2dot utils/fg2dot.cpp factorgraph.o
+utils/fg2dot : utils/fg2dot.cpp $(HEADERS) factorgraph.o exceptions.o
+       $(CC) $(CCFLAGS) -o utils/fg2dot utils/fg2dot.cpp factorgraph.o exceptions.o
 
-utils/remove_short_loops : utils/remove_short_loops.cpp $(HEADERS) factorgraph.o
-       $(CC) $(CCFLAGS) -o utils/remove_short_loops utils/remove_short_loops.cpp factorgraph.o
+utils/remove_short_loops : utils/remove_short_loops.cpp $(HEADERS) factorgraph.o exceptions.o
+       $(CC) $(CCFLAGS) -o utils/remove_short_loops utils/remove_short_loops.cpp factorgraph.o exceptions.o
 
-utils/fginfo : utils/fginfo.cpp $(HEADERS) factorgraph.o
-       $(CC) $(CCFLAGS) -o utils/fginfo utils/fginfo.cpp factorgraph.o
+utils/fginfo : utils/fginfo.cpp $(HEADERS) factorgraph.o bipgraph.o exceptions.o
+       $(CC) $(CCFLAGS) -o utils/fginfo utils/fginfo.cpp factorgraph.o bipgraph.o exceptions.o