diff options
author | Marvin Borner | 2021-04-28 23:05:23 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-28 23:05:23 +0200 |
commit | 7a517df706a35e2e16637395d8ff6122b2129bd4 (patch) | |
tree | 3e14bb22db156c3d8fdae6f581adcf82cb4fc211 /Makefile |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6d0ddc2 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +# MIT License, Copyright (c) 2021 Marvin Borner + +CC = $(PWD)/cross/opt/bin/i686-elf-gcc +LD = $(PWD)/cross/opt/bin/i686-elf-ld +OC = $(PWD)/cross/opt/bin/i686-elf-objcopy +ST = $(PWD)/cross/opt/bin/i686-elf-strip +AS = nasm + +BUILD = $(PWD)/build/ + +CFLAGS = -Wall -Wextra -Werror -std=c99 -m32 -nostdlib -nostdinc -fno-builtin -fno-profile-generate -fno-omit-frame-pointer -fno-common -ffreestanding -Ofast + +ASFLAGS = -f elf32 + +all: bootloader example + +bootloader: + @mkdir -p $(BUILD) + @$(CC) -c $(CFLAGS) load.c -o $(BUILD)/load.o + @$(LD) -N -emain -Ttext 0x00009000 -o $(BUILD)/load.bin $(BUILD)/load.o --oformat binary + @$(AS) -f bin entry.asm -o $(BUILD)/boot.bin + +example: + @mkdir -p $(BUILD) + @$(CC) -c $(CFLAGS) example.c -o $(BUILD)/example.o + @$(LD) -N -ekernel_main -o $(BUILD)/example $(BUILD)/example.o + +clean: + @find . \( -name "*.o" -or -name "*.a" -or -name "*.elf" -or -name "*.bin" \) -type f -delete |