-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (42 loc) · 1 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
SCANNER = scanner
PARSER = parser
CC = gcc
CFLAGS = -Wall -std=c11
LEX = flex
YACC = bison
LIBS = -lfl
EXEC = $(PARSER)
OBJS = $(PARSER) \
$(SCANNER)
OBJS := $(OBJS:=.o)
DEPS := $(OBJS:=.d)
all: $(EXEC)
$(SCANNER): $(SCANNER).c
$(CC) $(CCFLAGS) $< -o $(SCANNER) $(LIBS)
$(SCANNER).c: %.c: %.l
$(LEX) -o $@ $<
$(PARSER).c: %.c: %.y
$(YACC) -d -o $@ -v $<
$(EXEC): $(OBJS)
$(CC) -o $@ $^ $(LIBS)
prepare:
# we have installed the package meet the basic needs
# you can prepare the extra package you need here, e.g.
#apt install clang
#apt install g++
test: all
make test -C test/
check: all
make check -C test/
pack:
make clean
zip -r icd20-hw2.zip . -x ".*" -x "*.zip" -x "test/*"
.PHONY: clean
clean:
make clean -C test/
$(RM) $(SCANNER) $(SCANNER:=.c) $(PARSER:=.c) $(PARSER:=.h) $(DEPS) $(PARSER:=.output) $(OBJS) $(EXEC)
DOCKERHUB_ACCOUNT=plaslab
IMAGE_NAME = compiler-f20-hw2
DOCKER_IMG = ${DOCKERHUB_ACCOUNT}/${IMAGE_NAME}:latest
pull:
docker pull ${DOCKER_IMG}