34 lines
622 B
Makefile
34 lines
622 B
Makefile
|
SHELL = /bin/bash
|
||
|
.DEFAULT_GOAL := build
|
||
|
BUILDDIR = build
|
||
|
BINDIR = bin
|
||
|
OBJECT_FILES = boot.o
|
||
|
|
||
|
build: clean-objects assemble-stub compile copy-o link
|
||
|
|
||
|
assemble-stub:
|
||
|
mkdir -p $(BUILDDIR)/
|
||
|
aarch64-elf-as boot.s -o $(BUILDDIR)/boot.o
|
||
|
|
||
|
compile:
|
||
|
mkdir -p $(BUILDDIR)/
|
||
|
nim c -d:release kernel.nim
|
||
|
|
||
|
copy-o:
|
||
|
cp nimcache/*.o build/
|
||
|
|
||
|
clear, clean:
|
||
|
rm -rf $(BUILDDIR) nimcache/ bin/
|
||
|
|
||
|
clean-objects:
|
||
|
rm -rf $(BUILDDIR)/*.o nimcache/*.o
|
||
|
|
||
|
link:
|
||
|
mkdir -p $(BINDIR) && \
|
||
|
aarch64-elf-ld -nostdlib -Tlinker.ld -o bin/kernel.elf -O2 $(wildcard build/*.o)
|
||
|
|
||
|
boot:
|
||
|
|
||
|
setup-macos:
|
||
|
brew install aarch64-elf-binutils aarch64-elf-gcc nim
|