-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (38 loc) · 1.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Compilation tools
LEX = flex
YACC = bison -y -t
CC = g++
# Directories
INC_DIR = include
SRC_DIR = src
MAIN_DIR = main
PARSER_DIR = parser
# Files
SOURCES = $(shell find $(SRC_DIR)/ -name '*.cc')
MAIN_SRC = $(shell find $(MAIN_DIR)/ -name '*.cc')
OBJECTS = $(SOURCES:.cc=.o)
MAIN_OBJ = $(MAIN_SRC:.cc=.o)
MAIN_TARGET = h2smt
#Flags
CFLAGS = -std=c++11 -g -Wall -pedantic
PARSE_FLAGS = -lfl -lm
Z3FLAGS = -lz3
YFLAGS = --defines --debug --verbose
INCLUDE_FLAGS = $(addprefix -I, $(INC_DIR))
$(MAIN_TARGET): $(OBJECTS) $(MAIN_OBJ) $(PARSER_DIR)/par.o $(PARSER_DIR)/lex.o
$(CC) $(CFLAGS) -o $@ $^ $(PARSE_FLAGS) $(Z3FLAGS)
# PARSER
$(PARSER_DIR)/lex.o: $(PARSER_DIR)/lex.c $(PARSER_DIR)/par.h $(OBJECTS)
$(PARSER_DIR)/par.o: $(PARSER_DIR)/par.c $(OBJECTS)
$(PARSER_DIR)/par.h $(PARSER_DIR)/par.c: $(PARSER_DIR)/lang.y
$(YACC) $(YFLAGS) $< -o $(PARSER_DIR)/par.c
$(PARSER_DIR)/lex.c: $(PARSER_DIR)/lang.l
$(LEX) -o $@ $<
# Objects
%.o: %.cc
$(CC) $(CFLAGS) $(INCLUDE_FLAGS) -o $@ -c $<
clean:
rm -f $(OBJECTS) $(MAIN_OBJ) $(MAIN_TARGET)
rm -f $(PARSER_DIR)/par.c $(PARSER_DIR)/par.h \
$(PARSER_DIR)/lex.c $(PARSER_DIR)/par.output
rm -f $(PARSER_DIR)/*.o