stkarm/Makefile

40 lines
800 B
Makefile
Raw Normal View History

2018-12-28 08:20:09 +00:00
.POSIX:
TOOLCHAIN=arm-none-eabi-
CCX=$(TOOLCHAIN)g++
CCFLAGS=-c -Wall -fno-stack-protector -ffreestanding -fno-exceptions -march=armv7-a -mno-unaligned-access -nostdlib -Iinclude -g
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
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/*