From e559cf01834340d0a4dfcb45f7bdf081e8994032 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 2 Feb 2024 13:49:50 +0100 Subject: Kernel: Port toolchain to mingw (PE/COFF) Signed-off-by: Amlal El Mahrouss --- Private/makefile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Private/makefile') diff --git a/Private/makefile b/Private/makefile index f521b36a..f21a037e 100644 --- a/Private/makefile +++ b/Private/makefile @@ -3,11 +3,13 @@ # This is the microkernel makefile. ################################################## -CC = x86_64-elf-gcc -LD = x86_64-elf-ld +CC = x86_64-w64-mingw32-g++ +LD = x86_64-w64-mingw32-ld CCFLAGS = -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE_APIS__ -D__HCORE__ -I../ -I./ -I$(HOME)/ ASM = nasm -ASMFLAGS = -f elf64 +ASMFLAGS = -f win64 +LDFLAGS = -e Main -filealign:16 -shared --subsystem=10 +LDOBJ = Obj/*.obj # This file is the kernel, responsible of task management, memory, drivers and more. KERNEL = HCoreKrnl.exe @@ -22,23 +24,22 @@ FMT = elf64 invalid-recipe: @echo "[HCoreKrnl] invalid-recipe: Use make all instead." +MOVEALL=./MoveAll.sh + .PHONY: h-core-amd64 h-core-amd64: $(CC) $(CCFLAGS) Source/*.cxx HALKit/AMD64/PCI/*.cpp Source/Network/*.cpp\ Source/Storage/*.cxx HALKit/AMD64/*.cxx HALKit/AMD64/*.cpp HALKit/AMD64/*.s - $(ASM) -f elf64 HALKit/AMD64/DebugManager.asm - $(ASM) -f elf64 HALKit/AMD64/HalInterruptRouting.asm - $(ASM) -f elf64 HALKit/AMD64/SMPCoreManager.asm - $(ASM) -f elf64 HALKit/AMD64/StartSequence.asm - mv *.o HALKit/AMD64/*.o Obj/ - + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptRouting.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/SMPCoreManager.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/StartSequence.asm + $(MOVEALL) OBJCOPY = x86_64-elf-objcopy .PHONY: link-amd64 link-amd64: - $(LD) $(SCRIPT) Obj/*.o -o $(KERNEL) - $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --target efi-app-x86_64 --subsystem=10 $(KERNEL) $(KERNEL) + $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) cp $(KERNEL) Root/System .PHONY: all @@ -47,4 +48,4 @@ all: h-core link .PHONY: clean clean: - rm -f Obj/*.o $(KERNEL) + rm -f $(LDOBJ) $(KERNEL) -- cgit v1.2.3