From 7199e74aa22e592a3b77bdd81f735edca5470596 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 20 Jan 2024 17:59:40 -0500 Subject: update --- makefile | 51 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 4c285f0..bff2b4e 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,8 @@ -GPP_ARGS = -Wall -Wextra -O3 -ggdb -I include \ - -ffreestanding -fno-exceptions -fno-rtti -mno-sse -KGPP_ARGS = ${GPP_ARGS} -AGPP_ARGS = ${GPP_ARGS} +GPP_ARGS = -std=c++17 -Wall -Wextra -O3 -ggdb -nostdinc \ + -fno-exceptions -ffreestanding -fno-rtti -mno-sse +KGPP_ARGS = ${GPP_ARGS} -I kernel/include -I mintsuki-freestanding-headers +AGPP_ARGS = ${GPP_ARGS} -I libraries/euler/include \ + -I libraries/daguerre/include LD_ARGS = -z noexecstack KLD_ARGS = -T kernel/link.ld ${LD_ARGS} @@ -17,21 +18,24 @@ clean: rm -rf obj out dist-clean: - rm -rf limine - rm -f include/hilbert/kernel/limine.hpp + rm -rf limine mintsuki-freestanding-headers limine: git clone --depth=1 -b v6.x-branch \ https://github.com/limine-bootloader/limine.git limine cd limine && ./bootstrap && ./configure -q --enable-bios --enable-bios-cd +make -C limine - cp limine/limine.h include/hilbert/kernel/limine.hpp -obj/kernel/entry.cpp.o: kernel/entry.cpp limine +mintsuki-freestanding-headers: + git clone --depth=1 \ + https://github.com/mintsuki/freestanding-headers.git \ + mintsuki-freestanding-headers + +obj/kernel/entry.cpp.o: kernel/entry.cpp limine mintsuki-freestanding-headers @mkdir -p $(@D) g++ -c ${KGPP_ARGS} $< -o $@ -obj/kernel/%.cpp.o: kernel/%.cpp +obj/kernel/%.cpp.o: kernel/%.cpp mintsuki-freestanding-headers @mkdir -p $(@D) g++ -c ${KGPP_ARGS} $< -o $@ @@ -46,29 +50,36 @@ KERNEL_OBJECTS = allocator.cpp application.cpp entry.cpp framebuffer.cpp \ obj/kernel.elf: ${KERNEL_OBJECTS:%=obj/kernel/%.o} ld ${KLD_ARGS} $^ -o $@ -obj/stdlib/%.asm.o: stdlib/%.asm +obj/%.cpp.o: %.cpp mintsuki-freestanding-headers @mkdir -p $(@D) - nasm -f elf64 $< -o $@ + g++ -c ${AGPP_ARGS} $< -o $@ -obj/stdlib/%.cpp.o: stdlib/%.cpp +obj/%.asm.o: %.asm @mkdir -p $(@D) - g++ -c ${AGPP_ARGS} $< -o $@ + nasm -f elf64 $< -o $@ -STDLIB_OBJECTS = entry.cpp syscall.asm -obj/stdlib.o: ${STDLIB_OBJECTS:%=obj/stdlib/%.o} +EULER_OBJECTS = entry.cpp syscall.asm cassert.cpp allocator.cpp cstdio.cpp \ + cctype.cpp +obj/euler.o: ${EULER_OBJECTS:%=obj/libraries/euler/%.o} ld -r ${LLD_ARGS} $^ -o $@ -obj/%.cpp.o: applications/%.cpp - @mkdir -p $(@D) - g++ -c ${AGPP_ARGS} $< -o $@ +DAGUERRE_OBJECTS = ppm.cpp +obj/daguerre.o: ${DAGUERRE_OBJECTS:%=obj/libraries/daguerre/%.o} + ld -r ${LLD_ARGS} $^ -o $@ INIT_OBJECTS = main.cpp -obj/initfs/bin/init.elf: ${INIT_OBJECTS:%=obj/init/%.o} obj/stdlib.o +obj/initfs/bin/init.elf: ${INIT_OBJECTS:%=obj/applications/init/%.o} \ + obj/euler.o obj/daguerre.o @mkdir -p $(@D) ld ${ALD_ARGS} $^ -o $@ +obj/initfs/.skeleton: + @mkdir -p obj/initfs + cp -r skeleton/* obj/initfs/ + @touch obj/initfs/.skeleton + APPLICATIONS = init -obj/initfs.tgz: ${APPLICATIONS:%=obj/initfs/bin/%.elf} +obj/initfs.tgz: ${APPLICATIONS:%=obj/initfs/bin/%.elf} obj/initfs/.skeleton tar czf obj/initfs.tgz -C obj/initfs . out/disk.iso: obj/kernel.elf obj/initfs.tgz limine -- cgit v1.2.3