-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (29 loc) · 926 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
ASM=nasm
LD=ld
LDFLAGS=-s
all: teeworlds_asmr
debug: LDFLAGS=
debug: all
build/teeworlds_asmr.o: $(shell find -name "*.asm")
mkdir -p build
$(ASM) -f elf64 src/teeworlds_asmr.asm -o build/teeworlds_asmr.o
teeworlds_asmr: build/teeworlds_asmr.o
$(LD) $(LDFLAGS) -o teeworlds_asmr build/teeworlds_asmr.o
src_tests := $(wildcard tests/*_test.asm)
# TODO: use this Makefile syntax instead of shell
# all: $(src_test:.asm=) $(src_tests:.asm=.o)
all_tests := $(shell find tests -name "*_test.asm" | rev | cut -c 5- | rev)
test: LDFLAGS=
test: $(all_tests) run_tests
tests/%_test.o : tests/%_test.asm $(shell find -name "*.asm")
nasm -f elf64 -gstabs $<
tests/%_test : tests/%_test.o
$(LD) $(LDFLAGS) -o $@ $^
.PHONY: run_tests
run_tests:
# find tests -name '*_test' -type f -executable -exec {} \;
bash tests/run.sh
.PHONY: clean
clean:
rm -rf build
find tests -name '*_test' -type f -executable -exec rm {} \;