diff options
author | pacien | 2018-02-20 23:40:06 +0100 |
---|---|---|
committer | pacien | 2018-02-20 23:40:06 +0100 |
commit | 5a30c608fd311c8ce05760335d88208982efc4a5 (patch) | |
tree | c9fe41f03ec5ce7967ad2f81bca428c7aefdfd4b /makefile | |
parent | b45155c92dbff32510c9cad8b684376e115da086 (diff) | |
download | tpc-compiler-5a30c608fd311c8ce05760335d88208982efc4a5.tar.gz |
Bootstrap project
Diffstat (limited to 'makefile')
-rw-r--r-- | makefile | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/makefile b/makefile new file mode 100644 index 0000000..9bcb33a --- /dev/null +++ b/makefile | |||
@@ -0,0 +1,58 @@ | |||
1 | # UPEM / Compilation / Projet | ||
2 | # Pacien TRAN-GIRARD, Adam NAILI | ||
3 | |||
4 | # DIRECTORIES | ||
5 | SRC_DIR := src | ||
6 | OUT_DIR := out | ||
7 | DOC_DIR := doc | ||
8 | |||
9 | # INPUT | ||
10 | LEX_SRC := tpc.lex | ||
11 | YACC_SRC := tpc.y | ||
12 | PDF_SRC := rapport.md | ||
13 | |||
14 | # INTERMEDIATE | ||
15 | LEX_GEN := tpc.yy | ||
16 | YACC_GEN := tpc.tab | ||
17 | |||
18 | # OUTPUT | ||
19 | PARSER_BIN := tparser | ||
20 | COMPIL_BIN := tcompil | ||
21 | COMMIT_LOG := commits.log | ||
22 | REPORT_PDF := rapport.pdf | ||
23 | |||
24 | # CC PARAMS | ||
25 | CC := gcc | ||
26 | LEX := flex | ||
27 | YACC := bison | ||
28 | CFLAGS := -ansi -pedantic -Wall -std=gnu99 -O2 | ||
29 | LFLAGS := -lfl -ly | ||
30 | IFLAGS += -I$(SRC_DIR) -I$(OUT_DIR) | ||
31 | |||
32 | # RULES | ||
33 | all: clean $(OUT_DIR)/$(PARSER_BIN) | ||
34 | |||
35 | $(OUT_DIR)/$(LEX_GEN).c: $(SRC_DIR)/$(LEX_SRC) | ||
36 | $(LEX) -o $@ $^ | ||
37 | |||
38 | $(OUT_DIR)/$(YACC_GEN).c $(OUT_DIR)/$(YACC_GEN).h: $(SRC_DIR)/$(YACC_SRC) | ||
39 | $(YACC) --output=$(OUT_DIR)/$(YACC_GEN).c --defines=$(OUT_DIR)/$(YACC_GEN).h -v $^ | ||
40 | |||
41 | $(OUT_DIR)/$(LEX_GEN).o: $(OUT_DIR)/$(LEX_GEN).c $(OUT_DIR)/$(YACC_GEN).h | ||
42 | $(CC) -o $@ -c $< $(IFLAGS) $(LFLAGS) $(CFLAGS) | ||
43 | |||
44 | $(OUT_DIR)/$(YACC_GEN).o: $(OUT_DIR)/$(YACC_GEN).c | ||
45 | $(CC) -o $@ -c $^ $(IFLAGS) $(LFLAGS) $(CFLAGS) | ||
46 | |||
47 | $(OUT_DIR)/$(PARSER_BIN): $(OUT_DIR)/$(LEX_GEN).o $(OUT_DIR)/$(YACC_GEN).o | ||
48 | $(CC) -o $@ $^ $(IFLAGS) $(LFLAGS) $(CFLAGS) | ||
49 | |||
50 | $(OUT_DIR)/$(REPORT_PDF): $(DOC_DIR)/$(PDF_SRC) | ||
51 | pandoc --template $(DOC_DIR)/report-template.tex --number-sections --listings --output $@ $^ | ||
52 | |||
53 | $(OUT_DIR)/$(COMMIT_LOG): | ||
54 | git log > $@ | ||
55 | |||
56 | clean: | ||
57 | rm -rf $(OUT_DIR)/* | ||
58 | |||