From e5a591054ea0992acc3cb786d3af9f358febca6d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 19 Apr 2024 21:17:21 +0200 Subject: MHR-5: Improve makefile, and separating them for each platform. Signed-off-by: Amlal El Mahrouss --- Private/makefile | 19 ++++++++++++------- Public/Developer/SystemLib/Makefile | 22 ---------------------- Public/Developer/SystemLib/amd64.mk | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 29 deletions(-) delete mode 100644 Public/Developer/SystemLib/Makefile create mode 100644 Public/Developer/SystemLib/amd64.mk diff --git a/Private/makefile b/Private/makefile index 412739ca..ffefecf2 100644 --- a/Private/makefile +++ b/Private/makefile @@ -5,25 +5,28 @@ CC = x86_64-w64-mingw32-gcc LD = x86_64-w64-mingw32-ld -CCFLAGS = -c -ffreestanding -D__NEWOS_AMD64__ -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./ +CCFLAGS = -c -ffreestanding -D__NEWOS_AMD64__ -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./ ASM = nasm ifneq ($(ATA_PIO_SUPPORT), ) -DISKDRIVER = -D__ATA_PIO__ +DISKDRIVER = -D__ATA_PIO__ endif ifneq ($(ATA_DMA_SUPPORT), ) -DISKDRIVER = -D__ATA_DMA__ +DISKDRIVER = -D__ATA_DMA__ endif ifneq ($(AHCI_SUPPORT), ) -DISKDRIVER = -D__AHCI__ +DISKDRIVER = -D__AHCI__ endif ifneq ($(DEBUG_SUPPORT), ) -DEBUG = -D__DEBUG__ +DEBUG = -D__DEBUG__ endif +SLEEP = sleep 1 +COPY = cp + # Add assembler, linker, and object files variables. ASMFLAGS = -f win64 LDFLAGS = -e Main --subsystem=17 @@ -50,14 +53,16 @@ newos-amd64-epm: clean $(ASM) $(ASMFLAGS) HALKit/AMD64/HalSMPCoreManager.asm $(ASM) $(ASMFLAGS) HALKit/AMD64/HalNewBoot.asm $(ASM) $(ASMFLAGS) HALKit/AMD64/HalInstallTIB.asm + $(SLEEP) $(MOVEALL) -OBJCOPY=x86_64-w64-mingw32-objcopy +OBJCOPY=x86_64-w64-mingw32-objcopy .PHONY: link-amd64-epm link-amd64-epm: + $(SLEEP) $(LD) $(LDFLAGS) $(LDOBJ) -o $(KERNEL) - cp $(KERNEL) Root/Boot + $(COPY) $(KERNEL) Root/Boot .PHONY: all all: newos-amd64-epm link-amd64-epm diff --git a/Public/Developer/SystemLib/Makefile b/Public/Developer/SystemLib/Makefile deleted file mode 100644 index a753ccc8..00000000 --- a/Public/Developer/SystemLib/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -################################################## -# (C) Mahrouss Logic, all rights reserved. -# This is the SystemLib Makefile. -################################################## - -CC=x86_64-w64-mingw32-gcc -AR=x86_64-w64-mingw32-ar -CCINC=-I./ -CCFLAGS=-D__SINGLE_PRECISION__ -nostdlib -std=c17 -ffreestanding -Xlinker --subsystem=17 -shared -OUTPUT=SystemLib.lib - -.PHONY: all -all: build-core-amd64 - @echo "[SystemLib.lib] Build done." - -.PHONY: build-core-amd64 -build-core-amd64: - $(CC) $(CCINC) $(CCFLAGS) $(wildcard Sources/*.c) $(wildcard AMD64/*.s) -o $(OUTPUT) - -.PHONY: clean -clean: - rm -f $(wildcard *.lib) diff --git a/Public/Developer/SystemLib/amd64.mk b/Public/Developer/SystemLib/amd64.mk new file mode 100644 index 00000000..a753ccc8 --- /dev/null +++ b/Public/Developer/SystemLib/amd64.mk @@ -0,0 +1,22 @@ +################################################## +# (C) Mahrouss Logic, all rights reserved. +# This is the SystemLib Makefile. +################################################## + +CC=x86_64-w64-mingw32-gcc +AR=x86_64-w64-mingw32-ar +CCINC=-I./ +CCFLAGS=-D__SINGLE_PRECISION__ -nostdlib -std=c17 -ffreestanding -Xlinker --subsystem=17 -shared +OUTPUT=SystemLib.lib + +.PHONY: all +all: build-core-amd64 + @echo "[SystemLib.lib] Build done." + +.PHONY: build-core-amd64 +build-core-amd64: + $(CC) $(CCINC) $(CCFLAGS) $(wildcard Sources/*.c) $(wildcard AMD64/*.s) -o $(OUTPUT) + +.PHONY: clean +clean: + rm -f $(wildcard *.lib) -- cgit v1.2.3