Fix freelist management
[satune.git] / src / Makefile
index a0fe1b66ec75b56bba90d97a14163005003fc977..431d55b037d997c7f245883d0dc27a052f33429e 100644 (file)
@@ -4,11 +4,14 @@ 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 inc_solver.c
+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 := -Wall -g -O0
+CFLAGS += -IAST -ICollections -IBackend -I. -IEncoders
 LDFLAGS := -ldl -lrt -rdynamic
 SHARED := -shared
 
@@ -26,25 +29,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: *.c *.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,7 +56,7 @@ clean:
 
 PHONY += mrclean
 mrclean: clean
-       rm -rf docs
+       rm -rf ../docs
 
 PHONY += tags
 tags:
@@ -63,10 +64,9 @@ tags:
 
 tabbing:
        uncrustify -c C.cfg --no-backup *.c
-       uncrustify -c C.cfg --no-backup *.h
+       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)