-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (46 loc) · 1.46 KB
/
Makefile
File metadata and controls
60 lines (46 loc) · 1.46 KB
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
59
60
CC = gcc
CFLAGS = -Wall -Werror
LD = ld
LIB_TARGET = lib
CDFLAGS = -pg -g
CRFLAGS = -O3
.PHONY: all debug release lib lib_debug lib_release test clean
all: regex2c
debug: CFLAGS += $(CDFLAGS)
debug: LIB_TARGET = lib_debug
debug: regex2c
lib_debug: CFLAGS += $(CDFLAGS)
lib_debug: LIB_TARGET = lib_debug
lib_debug: lib
release: CFLAGS += $(CRFLAGS)
release: LIB_TARGET = lib_release
release: regex2c
lib_release: CFLAGS += $(CRFLAGS)
lib_release: LIB_TARGET = lib_release
lib_release: lib
regex2c: regex2c.o regex_parser.o ast2automaton.o automaton2c.o ast.o automaton.o common.o not_enough_cli/bin/lib.o
$(CC) $(CFLAGS) $^ -o $@
lib: regex_parser.o ast2automaton.o automaton2c.o ast.o automaton.o common.o
$(LD) -r $^ -o lib.o
pattern_matcher: pattern_matcher.o pattern.o
$(CC) $(CFLAGS) $^ -o $@
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
regex2c.o: regex2c.c regex_parser.h ast2automaton.h automaton2c.h
regex_parser.o: regex_parser.c regex_parser.h ast.h common.h
ast2automaton.o: ast2automaton.c ast2automaton.h ast.h automaton.h
automaton2c.o: automaton2c.c automaton2c.h automaton.h
ast.o: ast.c ast.h common.h
automaton.o: automaton.c automaton.h common.h
common.o: common.c common.h
pattern_matcher.o: pattern_matcher.c
pattern.o: pattern.c
not_enough_cli/bin/lib.o:
@cd not_enough_cli && make $(LIB_TARGET)
test: regex2c
@cd test && make
@echo "test/pattern_matcher has been generated"
clean:
rm -f *.o *.out regex2c
@cd test && make clean
@cd not_enough_cli && make clean