2018-12-28 08:20:09 +00:00
|
|
|
.POSIX:
|
2018-12-30 22:51:20 +00:00
|
|
|
|
|
|
|
TOOLCHAIN=arm-none-eabi-
|
|
|
|
|
|
|
|
CCX=$(TOOLCHAIN)g++
|
2018-12-30 21:44:14 +00:00
|
|
|
CCFLAGS=-c -Wall -fno-stack-protector -ffreestanding -fno-exceptions -march=armv7-a -mno-unaligned-access -nostdlib -Iinclude -g
|
2018-12-30 22:51:20 +00:00
|
|
|
STRIP=$(TOOLCHAIN)strip
|
2018-12-28 08:20:09 +00:00
|
|
|
|
|
|
|
C_HDR=$(wildcard include/*.h)
|
|
|
|
C_SRC=$(wildcard src/*.cpp)
|
|
|
|
C_OBJ=$(patsubst src/%.cpp, obj/c_%.o, $(C_SRC))
|
|
|
|
|
|
|
|
A_SRC=$(wildcard src/*.s)
|
|
|
|
A_OBJ=$(patsubst src/%.s, obj/s_%.o, $(A_SRC))
|
|
|
|
|
|
|
|
.PHONY: all environ clean
|
|
|
|
|
|
|
|
all: environ bin/kernel.elf
|
|
|
|
|
2018-12-30 22:51:20 +00:00
|
|
|
strip: bin/kernel.elf
|
|
|
|
$(STRIP) -s bin/kernel.elf
|
|
|
|
|
2018-12-28 08:20:09 +00:00
|
|
|
environ:
|
|
|
|
mkdir -p bin
|
|
|
|
mkdir -p obj
|
|
|
|
|
|
|
|
bin/kernel.elf: environ $(A_OBJ) $(C_OBJ)
|
|
|
|
arm-none-eabi-ld --nmagic -nostdlib -T src/linker.ld -o bin/kernel.elf obj/*.o
|
|
|
|
|
|
|
|
obj/s_%.o: src/%.s
|
|
|
|
$(CCX) $(CCFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
obj/c_%.o: src/%.cpp $(C_HDR)
|
|
|
|
$(CCX) $(CCFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f bin/*
|
|
|
|
rm -f obj/*
|
|
|
|
|