blob: bdf1afbd00df56a25f80af37bfdc4b9c1e56d914 (
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
|
target = fvm
cflags = -g -O3
ldflags = -lm
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 $@ $^
test: $(tests_bin)
@echo
@echo "Run tests:"
@scripts/runall.sh $^
$(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
|