summaryrefslogtreecommitdiff
path: root/tests/Makefile
blob: 909b750935abe98bd7916a2083e84c03e428e80c (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
empty :=

out_dir := out
obj_dir := $(out_dir)/artifacts

src_files := $(wildcard *.tnsl)
obj_files := $(src_files:.tnsl=.o)
out_files := $(src_files:.tnsl=.out)

.PHONY: all outdir clean
all: outdir $(out_files)

%.asm: %.tnsl
	@../ctc $< $(obj_dir)/$@

%.o: %.asm
	@nasm -f elf64 -o $(obj_dir)/$@ $(obj_dir)/$<

%.out: %.o
	@gcc -o $(out_dir)/$@ $(obj_dir)/$<
	@echo "Built $(out_dir)/$@"

outdir:
	@mkdir -p $(out_dir)
	@mkdir -p $(obj_dir)
	@echo "Created output directories"

clean:
	rm -rf out/*