-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (37 loc) · 1.01 KB
/
Makefile
File metadata and controls
50 lines (37 loc) · 1.01 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
CC = gcc
CFLAGS = -Wall -Werror
LIB_TARGET = lib
CDFLAGS = -pg -g
CRFLAGS = -O3
LT = lexer_template
LTF = $(LT)/$(LT).c
.PHONY: all debug release test clean
all: reglex
debug: CFLAGS += $(CDFLAGS)
debug: LIB_TARGET = lib_debug
debug: reglex
release: CFLAGS += $(CRFLAGS)
release: LIB_TARGET = lib_release
release: reglex
reglex: reglex.o regex2c/lib.o regex2c/not_enough_cli/bin/lib.o
$(CC) $(CFLAGS) $^ -o $@
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
reglex.o: reglex.c $(LTF)
regex2c/lib.o:
@cd regex2c && make $(LIB_TARGET)
regex2c/not_enough_cli/bin/lib.o:
@cd regex2c/not_enough_cli && make $(LIB_TARGET)
test: release
@cd test && make
clean:
rm -f *.o reglex lexer_template/lexer_template.c
@cd test && make clean
@cd regex2c && make clean
$(LTF): $(LT)/template.c $(LT)/main.c
@echo "static const char lexer_template[] = {" > $(LTF)
@xxd -i <$(LT)/template.c >> $(LTF)
@echo ", 0x0};" >> $(LTF)
@echo "static const char lexer_main[] = {" >> $(LTF)
@xxd -i <$(LT)/main.c >> $(LTF)
@echo ", 0x0};" >> $(LTF)