diff options
Diffstat (limited to 'makefile')
-rw-r--r-- | makefile | 49 |
1 files changed, 31 insertions, 18 deletions
@@ -1,29 +1,32 @@ LIMINE_DIR = $(abspath dependencies/limine) +MINTSUKI_HEADERS_DIR = $(abspath dependencies/mintsuki-headers) TOOLCHAIN_DIR = $(abspath toolchain) +EXTRA_CC_ARGS = -Wall -Wextra -Og -ggdb -fno-exceptions + HILBERT_NASM = nasm -f elf64 -HILBERT_CC = ${TOOLCHAIN_DIR}/usr/bin/x86_64-elf-c++ -std=c++17 -Wall \ - -Wextra -O3 -ggdb -static -fno-exceptions -fno-rtti -mno-sse -I include \ - -I $(abspath dependencies/mintsuki-headers) -I $(abspath euler/include) \ - -I $(abspath libraries/daguerre/include) +HILBERT_CC = ${TOOLCHAIN_DIR}/usr/bin/x86_64-elf-c++ -std=c++20 \ + ${EXTRA_CC_ARGS} -static -mno-sse -I include -I $(abspath euler/include) \ + -I $(abspath libraries/daguerre/include) -I ${MINTSUKI_HEADERS_DIR} HILBERT_AR = ${TOOLCHAIN_DIR}/usr/bin/x86_64-elf-ar HILBERT_LD = ${TOOLCHAIN_DIR}/usr/bin/x86_64-elf-ld -z noexecstack .EXPORT_ALL_VARIABLES: -LIB_DIR = toolchain/usr/x86_64-elf/lib/ +LIB_DIR = ${TOOLCHAIN_DIR}/usr/x86_64-elf/lib LIMINE_DEP = dependencies/.limine-done MINTSUKI_HEADERS_DEP = dependencies/.mintsuki-headers-done BINUTILS_DEP = toolchain/.binutils-done GCC_DEP = toolchain/.gcc-done LIBGCC_DEP = toolchain/.libgcc-done +LIBSTDCPP_DEP = toolchain/.libstdcpp-done EULER_DEP = toolchain/.euler-done DAGUERRE_DEP = toolchain/.daguerre-done -APP_DEPS = ${GCC_DEP} ${LIBGCC_DEP} ${EULER_DEP} ${MINTSUKI_HEADERS_DEP} -LIBRARY_DEPS = ${GCC_DEP} ${MINTSUKI_HEADERS_DEP} +APP_DEPS = ${GCC_DEP} ${LIBGCC_DEP} ${LIBSTDCPP_DEP} ${EULER_DEP} +LIBRARY_DEPS = ${GCC_DEP} ${LIBSTDCPP_DEP} .PHONY: default run clean clean-dependencies @@ -53,7 +56,10 @@ ${LIMINE_DEP}: ${MINTSUKI_HEADERS_DEP}: mkdir -p dependencies - test -e dependencies/mintsuki-headers || git clone --depth 1 https://github.com/mintsuki/freestanding-headers dependencies/mintsuki-headers + test -e dependencies/mintsuki-headers || git clone --depth 1 https://github.com/osdev0/freestanding-headers dependencies/mintsuki-headers + cd dependencies/mintsuki-headers && git fetch --depth=1 origin dd3abd2d7147efc4170dff478d3b7730bed14147 + cd dependencies/mintsuki-headers && git checkout dd3abd2d7147efc4170dff478d3b7730bed14147 + patch dependencies/mintsuki-headers/stddef.h patches/mintsuki-stddef.patch touch $@ ${BINUTILS_DEP}: @@ -71,8 +77,10 @@ ${GCC_DEP}: ${BINUTILS_DEP} test -e dependencies/gcc || git clone --depth 1 -b releases/gcc-14.1.0 https://gcc.gnu.org/git/gcc dependencies/gcc mkdir -p dependencies/gcc/build cd dependencies/gcc/build && ../configure --disable-fixed-point \ - --disable-gcov --disable-multilib --disable-shared --enable-languages=c++ \ - --target=x86_64-elf --prefix=${TOOLCHAIN_DIR}/usr --without-headers + --disable-gcov --disable-multilib --disable-shared \ + --disable-hosted-libstdcxx \ + --enable-languages=c++ --target=x86_64-elf --enable-cstdio=stdio_pure \ + --prefix=${TOOLCHAIN_DIR}/usr --without-headers --enable-cxx-flags=-mno-sse +make -C dependencies/gcc/build all-gcc +make -C dependencies/gcc/build install-gcc touch $@ @@ -82,17 +90,22 @@ ${LIBGCC_DEP}: ${GCC_DEP} +make -C dependencies/gcc/build install-target-libgcc touch $@ -${EULER_DEP}: ${GCC_DEP} ${MINTSUKI_HEADERS_DEP} - +make -C euler build/crt0.o build/libc.a build/libg.a build/libm.a \ - build/libstdc++.a - mkdir -p toolchain/usr/x86_64-elf/lib - cp euler/build/crt0.o euler/build/libc.a euler/build/libg.a \ - euler/build/libm.a euler/build/libstdc++.a ${LIB_DIR} +${LIBSTDCPP_DEP}: ${GCC_DEP} + +make -C dependencies/gcc/build all-target-libstdc++-v3 + +make -C dependencies/gcc/build install-target-libstdc++-v3 + patch toolchain/usr/x86_64-elf/include/c++/14.1.0/memory patches/gcc-memory.patch + touch $@ + +${EULER_DEP}: ${LIBRARY_DEPS} + +make -C euler build/crt0.o build/libc.a build/libg.a build/libm.a + mkdir -p ${LIB_DIR} + cp euler/build/crt0.o euler/build/libc.a \ + euler/build/libg.a euler/build/libm.a ${LIB_DIR}/ touch $@ ${DAGUERRE_DEP}: ${LIBRARY_DEPS} +make -C libraries/daguerre build/libdaguerre.a - cp libraries/daguerre/build/libdaguerre.a ${LIB_DIR} + cp libraries/daguerre/build/libdaguerre.a ${LIB_DIR}/ touch $@ kernel/build/kernel.elf: ${GCC_DEP} ${MINTSUKI_HEADERS_DEP} ${LIMINE_DEP} @@ -101,7 +114,7 @@ kernel/build/kernel.elf: ${GCC_DEP} ${MINTSUKI_HEADERS_DEP} ${LIMINE_DEP} applications/init/build/init.elf: ${APP_DEPS} +make -C applications/init build/init.elf -applications/goldman/build/goldman.elf: ${APP_DEPS} +applications/goldman/build/goldman.elf: ${APP_DEPS} ${DAGUERRE_DEP} +make -C applications/goldman build/goldman.elf build/initfs.tgz: applications/init/build/init.elf \ |