blob: ee688696be3e0190409140d9b9fcac33b443934f (
plain)
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
|
target = fvm
cflags = -g -fsanitize=address -fno-omit-frame-pointer
ldflags = -lm -fsanitize=address -fno-omit-frame-pointer
cc = gcc
csc = chicken-csc
src = $(shell find src/ -name '*.c' -not -name '*main.c')
obj = $(src:.c=.o)
tests=$(shell find tests/ -name '*.c')
tests_bin=$(tests:.c=.bin)
all: $(target) fvm-as
fvm-as: $(obj) src/as_main.c
$(cc) $(cflags) $(ldflags) $^ -o $@
full: all $(tests_bin)
$(target): $(obj) src/main.o
$(cc) $(cflags) $(ldflags) -o $@ $^
buildtest: $(tests_bin)
test: buildtest
@echo
@echo "Run tests:"
@scripts/runall.sh $(tests_bin)
$(obj):%.o:%.c
$(cc) -c $(cflags) $< -MD -MF $@.d -o $@
src/main.o:src/main.c
$(cc) -c $(cflags) $< -MD -MF $@.d -o $@
$(tests_bin):%.bin:%.c $(obj)
$(cc) -Isrc/ $(cflags) $(ldflags) $< $(obj) -MD -MF $@.d -o $@
clean:
-rm $(shell find tests/ -name '*.bin')
-rm $(shell find . -name '*.o' -or -name '*.d')
-rm $(target)
DEPS := $(shell find . -name *.d)
ifneq ($(DEPS),)
include $(DEPS)
endif
|