Saving the best tuner settings + bug fixes
[satune.git] / src / Makefile
index c9d26123475cee1fbe4b69838db7ee38ec30f575..caccbdb155df444a54190ded22cda3d9913dd553 100644 (file)
@@ -4,12 +4,17 @@ PHONY += directories
 MKDIR_P = mkdir -p
 OBJ_DIR = bin
 
-C_SOURCES := set.c mutableset.c element.c function.c order.c table.c predicate.c boolean.c csolver.c structs.c constraint.c
+CPP_SOURCES := $(wildcard *.cc) $(wildcard AST/*.cc) $(wildcard ASTTransform/*.cc) $(wildcard Translator/*.cc) $(wildcard ASTAnalyses/*.cc) $(wildcard ASTAnalyses/Order/*.cc) $(wildcard ASTAnalyses/Encoding/*.cc) $(wildcard ASTAnalyses/Polarity/*.cc) $(wildcard Tuner/*.cc) $(wildcard Collections/*.cc) $(wildcard Backend/*.cc) $(wildcard Encoders/*.cc) $(wildcard Serialize/*.cc)
+
+C_SOURCES := $(wildcard *.c) $(wildcard AST/*.c) $(wildcard ASTTransform/*.c) $(wildcard Translator/*.c) $(wildcard ASTAnalyses/*.c) $(wildcard ASTAnalyses/Order/*.c) $(wildcard ASTAnalyses/Encoding/*.c) $(wildcard ASTAnalyses/Polarity/*.c) $(wildcard Tuner/*.c) $(wildcard Collections/*.c) $(wildcard Backend/*.c) $(wildcard Encoders/*.c) $(wildcard Serialize/*.c)
+
+HEADERS := $(wildcard *.h) $(wildcard AST/*.h) $(wildcard ASTTransform/*.h) $(wildcard Translator/*.h) $(wildcard ASTAnalyses/*.h) $(wildcard ASTAnalyses/Order/*.h) $(wildcard ASTAnalyses/Encoding/*.h) $(wildcard ASTAnalyses/Polarity/*.h) $(wildcard Tuner/*.h) $(wildcard Collections/*.h) $(wildcard Backend/*.h) $(wildcard Encoders/*.h) $(wildcard Serialize/*.h)
 
 OBJECTS := $(CPP_SOURCES:%.cc=$(OBJ_DIR)/%.o) $(C_SOURCES:%.c=$(OBJ_DIR)/%.o)
 
-CPPFLAGS += -Iinclude -I.
-LDFLAGS := -ldl -lrt -rdynamic
+CFLAGS := -Wall -O0 -g
+CFLAGS += -IAST -IASTTransform -IASTAnalyses -IASTAnalyses/Polarity -IASTAnalyses/Order -IASTAnalyses/Encoding -ITranslator -ICollections -IBackend -I. -IEncoders -ITuner -ISerialize
+LDFLAGS := -ldl -lrt -rdynamic -g
 SHARED := -shared
 
 # Mac OSX options
@@ -20,31 +25,43 @@ endif
 
 MARKDOWN := ../docs/Markdown/Markdown.pl
 
-all: directories $(LIB_SO)
+all: directories ${OBJ_DIR}/$(LIB_SO)
 
 directories: ${OBJ_DIR}
 
 ${OBJ_DIR}:
        ${MKDIR_P} ${OBJ_DIR}
-
-debug: CPPFLAGS += -DCONFIG_DEBUG
+       ${MKDIR_P} ${OBJ_DIR}/AST
+       ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses
+       ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses/Order
+       ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses/Encoding
+       ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses/Polarity
+       ${MKDIR_P} ${OBJ_DIR}/ASTTransform
+       ${MKDIR_P} ${OBJ_DIR}/Translator
+       ${MKDIR_P} ${OBJ_DIR}/Tuner
+       ${MKDIR_P} ${OBJ_DIR}/Collections
+       ${MKDIR_P} ${OBJ_DIR}/Backend
+       ${MKDIR_P} ${OBJ_DIR}/Encoders
+       ${MKDIR_P} ${OBJ_DIR}/Serialize
+
+debug: CFLAGS += -DCONFIG_DEBUG
 debug: all
 
+test: all
+       make -C Test
+
 PHONY += docs
-docs: *.c *.cc *.h
+docs: $(C_SOURCES) $(HEADERS)
        doxygen
 
-$(LIB_SO): $(OBJECTS)
-       $(CXX) -g $(SHARED) -o $(LIB_SO) $+ $(LDFLAGS)
-
-${OBJ_DIR}/%.o: %.c
-       $(CC) -fPIC -c $< -o $@ $(CPPFLAGS) -Wno-unused-variable
+${OBJ_DIR}/$(LIB_SO): $(OBJECTS)
+       $(CXX) -g $(SHARED) -o ${OBJ_DIR}/$(LIB_SO) $+ $(LDFLAGS)
 
 ${OBJ_DIR}/%.o: %.cc
-       $(CXX) -MMD -MF $@.d -o $@ -fPIC -c $< $(CPPFLAGS)
+       $(CXX) -fPIC -c $< -o $@ $(CFLAGS) -Wno-unused-variable
 
-%.pdf: %.dot
-       dot -Tpdf $< -o $@
+${OBJ_DIR}/%.o: %.c
+       $(CC) -fPIC -c $< -o $@ $(CFLAGS) -Wno-unused-variable
 
 -include $(OBJECTS:%=$OBJ_DIR/.%.d)
 
@@ -55,19 +72,17 @@ clean:
 
 PHONY += mrclean
 mrclean: clean
-       rm -rf docs
+       rm -rf ../docs
 
 PHONY += tags
 tags:
        ctags -R
 
 tabbing:
-       uncrustify -c C.cfg --no-backup *.cc
-       uncrustify -c C.cfg --no-backup *.c
-       uncrustify -c C.cfg --no-backup *.h
+       uncrustify -c C.cfg --no-backup *.cc */*.cc */*/*.cc
+       uncrustify -c C.cfg --no-backup *.h */*.h */*/*.h
 
-.PHONY: $(PHONY)
+wc:
+       wc */*.cc */*.h *.cc *.h */*/*.cc */*/*.h
 
-# A 1-inch margin PDF generated by 'pandoc'
-%.pdf: %.md
-       pandoc -o $@ $< -V header-includes='\usepackage[margin=1in]{geometry}'
+.PHONY: $(PHONY)