-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
41 lines (32 loc) · 1.11 KB
/
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
toolchain := arm-none-eabi
elfs := hello.elf raytracer.elf
# Hello World
sources/hello.elf := $(addprefix src/hello-world/, HelloWorld.c)
# Raytracer
sources/raytracer.elf := $(addprefix src/raytracer/, main.c Raytracing.c VC.c VC_aligned_buffer.S)
libs/raytracer.elf := -lm
cflags/raytracer.elf := -Og
# Common Flags
cflags := -specs=sdk/Alpha.specs -mfloat-abi=hard -mfpu=vfp -march=armv6zk -mtune=arm1176jzf-s -g3 -ggdb
ldflags := -Wl,-Tsdk/link.ld -Lsdk -Wl,-umalloc
.PHONY: all
all: $(elfs)
.PHONY: clean
clean:
rm -f $(elfs) $(addsuffix .map, $(basename $(elfs))) kernel.img kernel.dbg
kernel.img: raytracer.elf
$(toolchain)-objcopy -O binary $< $@
$(toolchain)-objcopy --only-keep-debug $< $(basename $@).dbg
.SECONDEXPANSION:
$(elfs): $$(sources/$$@)
$(toolchain)-gcc $(cflags) $(ldflags) -Wl,-Map,$(basename $@).map -o $@ $(cflags/$@) $^ $(libs/$@)
.PHONY: shell
define docker/build :=
docker build -f sdk/Dockerfile --build-arg uid=$$(id -u) .
endef
shell:
$(docker/build)
docker run -it -v $$PWD:$$PWD -w $$PWD --privileged $$($(docker/build) -q)
.PHONY: README.md
README.md:
./scripts/update-readme.sh