Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/constraint_compiler
[satune.git] / src / Makefile
index dfc0a8f10242bb98b4d1e9cf6a162628097a14e1..cbf758b4a2abf7914ba8ad7444732e7f7cc56ed0 100644 (file)
@@ -4,11 +4,13 @@ PHONY += directories
 MKDIR_P = mkdir -p
 OBJ_DIR = bin
 
-CPP_SOURCES := constraint.cc inc_solver.cc
+C_SOURCES := $(wildcard *.c) $(wildcard AST/*.c) $(wildcard Collections/*.c) $(wildcard Backend/*.c) $(wildcard Encoders/*.c)
+
+HEADERS := $(wildcard *.h) $(wildcard AST/*.h) $(wildcard Collections/*.h) $(wildcard Backend/*.h) $(wildcard Encoders/*.h)
 
 OBJECTS := $(CPP_SOURCES:%.cc=$(OBJ_DIR)/%.o) $(C_SOURCES:%.c=$(OBJ_DIR)/%.o)
 
-CPPFLAGS += -Iinclude -I.
+CFLAGS += -IAST -ICollections -IBackend -I. -IEncoders
 LDFLAGS := -ldl -lrt -rdynamic
 SHARED := -shared
 
@@ -26,25 +28,23 @@ directories: ${OBJ_DIR}
 
 ${OBJ_DIR}:
        ${MKDIR_P} ${OBJ_DIR}
+       ${MKDIR_P} ${OBJ_DIR}/AST
+       ${MKDIR_P} ${OBJ_DIR}/Collections
+       ${MKDIR_P} ${OBJ_DIR}/Backend
+       ${MKDIR_P} ${OBJ_DIR}/Encoders
 
-debug: CPPFLAGS += -DCONFIG_DEBUG
+debug: CFLAGS += -DCONFIG_DEBUG
 debug: all
 
 PHONY += docs
-docs: *.cc *.h
+docs: $(C_SOURCES) $(HEADERS)
        doxygen
 
 $(LIB_SO): $(OBJECTS)
-       $(CXX) -g $(SHARED) -o $(LIB_SO) $+ $(LDFLAGS)
+       $(CC) -g $(SHARED) -o ${OBJ_DIR}/$(LIB_SO) $+ $(LDFLAGS)
 
 ${OBJ_DIR}/%.o: %.c
-       $(CC) -fPIC -c $< -o $@ $(CPPFLAGS) -Wno-unused-variable
-
-${OBJ_DIR}/%.o: %.cc
-       $(CXX) -MMD -MF $@.d -o $@ -fPIC -c $< $(CPPFLAGS)
-
-%.pdf: %.dot
-       dot -Tpdf $< -o $@
+       $(CC) -fPIC -c $< -o $@ $(CFLAGS) -Wno-unused-variable
 
 -include $(OBJECTS:%=$OBJ_DIR/.%.d)
 
@@ -55,18 +55,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 *.h
+       uncrustify -c C.cfg --no-backup *.c
+       uncrustify -c C.cfg --no-backup *.h */*.h
 
-.PHONY: $(PHONY)
+wc:
+       wc */*.c */*.h *.c *.h
 
-# A 1-inch margin PDF generated by 'pandoc'
-%.pdf: %.md
-       pandoc -o $@ $< -V header-includes='\usepackage[margin=1in]{geometry}'
+.PHONY: $(PHONY)