-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 689 Bytes
/
Makefile
File metadata and controls
37 lines (26 loc) · 689 Bytes
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
HEADERS_C=$(shell find . -type f -name "*.h")
SOURCES_C=$(shell find . -type f -name "*.c")
SOURCES_ASM=$(shell find . -type f -name "*.asm")
OBJECTS_ASM=$(patsubst %.asm, build/%.obj, $(SOURCES_ASM))
.PHONY: all compiler run debug test stdlib
all: always compiler stdlib
always:
@mkdir -p build
@mkdir -p build/stdlib
compiler: build/compiler $(HEADERS_C)
build/compiler: $(SOURCES_C)
@clang -o build/compiler $^
stdlib: $(OBJECTS_ASM)
build/%.obj: %.asm
@nasm -felf64 -o $@ $<
clean:
@rm -rf build
run: all
@build/compiler source.dl out
@rm out.asm
@rm out.o
debug: all
@valgrind build/compiler source.dl out
@rm out.o
test: all
@build/compiler source.dl /dev/null