diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-09 00:42:44 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-09 00:42:44 +0200 |
| commit | af8a516fc22865abd80d6e26f1541fa3d6bebfdc (patch) | |
| tree | 96d42a10945fc03df022389aef54708383c1d616 /Kernel/makefile | |
| parent | a874e9cc98df994178d55996943fe81799c61d2f (diff) | |
MHR-23: :boom:, refactors.
- Move NewBoot to /Boot, thus making Kernel directory only containing the kernel.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/makefile')
| -rw-r--r-- | Kernel/makefile | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/Kernel/makefile b/Kernel/makefile new file mode 100644 index 00000000..61eb9dfe --- /dev/null +++ b/Kernel/makefile @@ -0,0 +1,87 @@ +################################################## +# (C) SoftwareLabs, all rights reserved. +# This is the microkernel makefile. +################################################## + +CC = x86_64-w64-mingw32-gcc +LD = x86_64-w64-mingw32-ld +CCFLAGS = -c -fPIC -ffreestanding -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \ + -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./ \ + -DBLEND2D_NO_STDCXX -DBLEND2D_NO_TLS -DBLEND2D_EMBED + +ASM = nasm + +ifneq ($(ATA_PIO_SUPPORT), ) +DISKDRIVER = -D__ATA_PIO__ +endif + +ifneq ($(ATA_DMA_SUPPORT), ) +DISKDRIVER = -D__ATA_DMA__ +endif + +ifneq ($(AHCI_SUPPORT), ) +DISKDRIVER = -D__AHCI__ +endif + +ifneq ($(DEBUG_SUPPORT), ) +DEBUG = -D__DEBUG__ +endif + +COPY = cp + +# Add assembler, linker, and object files variables. +ASMFLAGS = -f win64 + +# NewOS subsystem is 17 and entrypoint is __ImageStart +LDFLAGS = -e __ImageStart --subsystem=17 +LDOBJ = Objects/*.obj + +# This file is the kernel, responsible of task management and memory. +KERNEL = NewKernel.exe + +# The kernel entrypoint +SCRIPT = --script=Linker/Platforms/PC.lds + +.PHONY: error +error: + @echo "=== ERROR ===" + @echo "=> Use a specific target." + +MOVEALL=./MoveAll.sh +WINDRES=x86_64-w64-mingw32-windres + +.PHONY: newos-amd64-epm +newos-amd64-epm: clean + $(WINDRES) KernelRsrc.rsrc -O coff -o KernelRsrc.obj + $(CC) $(CCFLAGS) $(DISKDRIVER) $(DEBUG) $(wildcard Source/*.cxx) \ + $(wildcard Source/FS/*.cxx) $(wildcard HALKit/AMD64/Storage/*.cxx) \ + $(wildcard HALKit/AMD64/PCI/*.cxx) $(wildcard Source/Network/*.cxx) $(wildcard Source/Storage/*.cxx) \ + $(wildcard HALKit/AMD64/*.cxx) $(wildcard HALKit/AMD64/*.cpp) \ + $(wildcard HALKit/AMD64/*.s) + + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInterruptAPI.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalSMPCoreManager.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalNewBoot.asm + $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInstallTIB.asm + $(MOVEALL) + +OBJCOPY=x86_64-w64-mingw32-objcopy + +.PHONY: link-amd64-epm +link-amd64-epm: + $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) + +.PHONY: all +all: newos-amd64-epm link-amd64-epm + @echo "NewKernel => OK." + +.PHONY: help +help: + @echo "=== HELP ===" + @echo "all: Build kernel and link it." + @echo "link-amd64-epm: Link kernel. (EPM AMD64)" + @echo "newos-amd64-epm: Build kernel. (EPM AMD64)" + +.PHONY: clean +clean: + rm -f $(LDOBJ) $(KERNEL) |
