-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (51 loc) · 2.29 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
49
50
51
52
53
54
55
56
57
58
###################################################################################
## School: Brno University of Technology, Faculty of Information Technology ##
## Course: Formal Languages and Compilers ##
## Project: IFJ17 ##
## Module: Makefile ##
## Authors: Kristián Liščinský (xlisci01) ##
## Matúš Liščinský (xlisci02) ##
## Šimon Stupinský (xstupi00) ##
## Vladimír Marcin (xmarci10) ##
###################################################################################
CC= gcc
CCFLAGS= -std=c99 -Wall -Wextra -pedantic
LDLIBS= -lm
EXECUTABLE= ifj17
REMOVE= rm -f
SRC= $(wildcard *.c)
OBJ= $(SRC:%.c=%.o)
.PHONY: all debug clean
all: $(EXECUTABLE)
#allow debug prints
debug: CCFLAGS += -DDEBUG -g
debug: $(EXECUTABLE)
#linking
$(EXECUTABLE): $(OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LDLIBS)
#compilation
error.o: error.c error.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
expr.o: expr.c scanner.h error.h expr.h stack.h symtable.h semantic_control.h generate.h strlib.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
generate.o: generate.c generate.h error.h semantic_control.h scanner.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
main.o: main.c parser.h generate.h semantic_control.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
parser.o: parser.c parser.h scanner.h error.h expr.h semantic_control.h strlib.h generate.h stack.h
$(CC) $(CCFLAGS) -c $< -o $@
scanner.o: scanner.c scanner.h error.h strlib.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
semantic_control.o: semantic_control.c semantic_control.h stack.h symtable.h error.h scanner.h generate.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
stack.o: stack.c stack.h error.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
strlib.o: strlib.c strlib.h error.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
symtable.o: symtable.c symtable.h error.h scanner.h semantic_control.h clear.h
$(CC) $(CCFLAGS) -c $< -o $@
clear.o: clear.c clear.h stack.h error.h
$(CC) $(CCFLAGS) -c $< -o $@
#clean object files and binary
clean:
$(REMOVE) $(OBJ) $(EXECUTABLE)