-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
45 lines (35 loc) · 893 Bytes
/
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
PROGS := driver cli re2dot
PROGS := $(addprefix tests/,$(PROGS))
OBJS := src/compile.o \
src/parse.o \
src/vm.o
deps := $(OBJS:%.o=%.o.d) $(PROGS:%=%.o.d)
include mk/common.mk
CC ?= gcc
CFLAGS += -std=c11 -Wall -pedantic
CFLAGS += -Iinclude
.PHONY: all
all: CFLAGS += -DNDEBUG -O2
all: $(OBJS) $(PROGS)
.PHONY: debug
debug: CFLAGS += -DDEBUG -g
debug: LDFLAGS += -g
debug: $(OBJS) $(PROGS)
include mk/test-data.mk
tests/driver.c: tests/generator.rb $(TESTDATA)
$(VECHO) " GEN\t$@\n"
$(Q)tests/generator.rb $(TESTDATA) > $@
check: tests/driver
$(Q)$<
%.o: %.c
$(VECHO) " CC\t$@\n"
$(Q)$(CC) $(CFLAGS) -MMD -MF $@.d -c -o $@ $<
tests/%: tests/%.o $(OBJS)
$(VECHO) " CC+LD\t$@\n"
$(Q)$(CC) $(LDFLAGS) -o $@ $^
.PHONY: clean
clean:
$(RM) $(PROGS) $(PROGS:%=%.o) $(OBJS) $(deps)
distclean: clean
-$(RM) tests/driver.c $(TESTDATA)
-include $(deps)