Adding Support for BooleanVar
[satune.git] / src / Makefile
1 include common.mk
2
3 PHONY += directories
4 MKDIR_P = mkdir -p
5 OBJ_DIR = bin
6
7 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) $(wildcard AlloyEnc/*.cc)
8
9 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) $(wildcard AlloyEnc/*.c)
10
11 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) $(wildcard AlloyEnc/*.h)
12
13 OBJECTS := $(CPP_SOURCES:%.cc=$(OBJ_DIR)/%.o) $(C_SOURCES:%.c=$(OBJ_DIR)/%.o)
14
15 CFLAGS := -Wall -O0 -g
16 CXXFLAGS := -std=c++1y -pthread
17 CFLAGS += -IAST -IASTTransform -IASTAnalyses -IASTAnalyses/Polarity -IASTAnalyses/Order -IASTAnalyses/Encoding -ITranslator -ICollections -IBackend -I. -IEncoders -ITuner -ISerialize -IAlloyEnc
18 LDFLAGS := -ldl -lrt -rdynamic -g
19 SHARED := -shared
20
21 # Mac OSX options
22 ifeq ($(UNAME), Darwin)
23 LDFLAGS := -ldl
24 SHARED := -Wl,-undefined,dynamic_lookup -dynamiclib
25 endif
26
27 MARKDOWN := ../docs/Markdown/Markdown.pl
28
29 all: directories ${OBJ_DIR}/$(LIB_SO)
30
31 directories: ${OBJ_DIR}
32
33 ${OBJ_DIR}:
34         ${MKDIR_P} ${OBJ_DIR}
35         ${MKDIR_P} ${OBJ_DIR}/AST
36         ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses
37         ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses/Order
38         ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses/Encoding
39         ${MKDIR_P} ${OBJ_DIR}/ASTAnalyses/Polarity
40         ${MKDIR_P} ${OBJ_DIR}/ASTTransform
41         ${MKDIR_P} ${OBJ_DIR}/Translator
42         ${MKDIR_P} ${OBJ_DIR}/Tuner
43         ${MKDIR_P} ${OBJ_DIR}/Collections
44         ${MKDIR_P} ${OBJ_DIR}/Backend
45         ${MKDIR_P} ${OBJ_DIR}/Encoders
46         ${MKDIR_P} ${OBJ_DIR}/Serialize
47         ${MKDIR_P} ${OBJ_DIR}/AlloyEnc
48
49 debug: CFLAGS += -DCONFIG_DEBUG
50 debug: all
51
52 test: all
53         make -C Test
54
55 PHONY += docs
56 docs: $(C_SOURCES) $(HEADERS)
57         doxygen
58
59 ${OBJ_DIR}/$(LIB_SO): $(OBJECTS)
60         $(CXX) -g $(SHARED) -o ${OBJ_DIR}/$(LIB_SO) $+ $(LDFLAGS)
61
62 ${OBJ_DIR}/%.o: %.cc
63         $(CXX) -fPIC -c $< -o $@ $(CFLAGS) -Wno-unused-variable $(CXXFLAGS)
64
65 ${OBJ_DIR}/%.o: %.c
66         $(CC) -fPIC -c $< -o $@ $(CFLAGS) -Wno-unused-variable
67
68 -include $(OBJECTS:%=$OBJ_DIR/.%.d)
69
70 PHONY += clean
71 clean:
72         rm -f *.o *.so
73         rm -rf $(OBJ_DIR)
74
75 PHONY += mrclean
76 mrclean: clean
77         rm -rf ../docs
78
79 PHONY += tags
80 tags:
81         ctags -R
82
83 tabbing:
84         uncrustify -c C.cfg --no-backup *.cc */*.cc */*/*.cc
85         uncrustify -c C.cfg --no-backup *.h */*.h */*/*.h
86
87 wc:
88         wc */*.cc */*.h *.cc *.h */*/*.cc */*/*.h
89
90 .PHONY: $(PHONY)