build: Misc improvements to makefiles
This commit is contained in:
parent
4be6e52259
commit
7be9c17d6a
@ -135,10 +135,10 @@ uninstall:
|
||||
$(call MKESCAPE,$(BUILDDIR))/stage1.stamp: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor-build/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/common-bios/stage2.bin.gz
|
||||
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
|
||||
cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm @WERROR@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-hdd.bin'
|
||||
ifneq ($(BUILD_CD), no)
|
||||
ifneq ($(BUILD_CD),no)
|
||||
cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm @WERROR@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-cd.bin'
|
||||
endif
|
||||
ifneq ($(BUILD_PXE), no)
|
||||
ifneq ($(BUILD_PXE),no)
|
||||
cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm @WERROR@ -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin'
|
||||
endif
|
||||
cp '$(call SHESCAPE,$(BUILDDIR))/common-bios/limine.sys' '$(call SHESCAPE,$(BINDIR))/'
|
||||
@ -147,12 +147,12 @@ endif
|
||||
.PHONY: limine-bios
|
||||
limine-bios: common-bios decompressor
|
||||
$(MAKE) '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp'
|
||||
ifneq ($(BUILD_LIMINE_DEPLOY), no)
|
||||
ifneq ($(BUILD_LIMINE_DEPLOY),no)
|
||||
$(MAKE) limine-deploy
|
||||
endif
|
||||
|
||||
$(call MKESCAPE,$(BINDIR))/limine-cd-efi.bin: $(if @BUILD_UEFI_IA32@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if @BUILD_UEFI_X86_64@, $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI)
|
||||
ifneq ($(BUILD_CD_EFI), no)
|
||||
ifneq ($(BUILD_CD_EFI),no)
|
||||
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
|
||||
rm -f '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
|
||||
dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin' bs=512 count=2880 2>/dev/null
|
||||
@ -170,18 +170,24 @@ endif
|
||||
limine-cd-efi:
|
||||
$(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-cd-efi.bin'
|
||||
|
||||
.PHONY: limine-uefi-x86-64
|
||||
limine-uefi-x86-64: $(call MKESCAPE,$(SRCDIR))/limine-efi
|
||||
$(MAKE) common-uefi-x86-64
|
||||
$(call MKESCAPE,$(BINDIR))/BOOTX64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI
|
||||
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
|
||||
cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' '$(call SHESCAPE,$(BINDIR))/'
|
||||
|
||||
.PHONY: limine-uefi-ia32
|
||||
limine-uefi-ia32: $(call MKESCAPE,$(SRCDIR))/limine-efi
|
||||
$(MAKE) common-uefi-ia32
|
||||
.PHONY: limine-uefi-x86-64
|
||||
limine-uefi-x86-64:
|
||||
$(MAKE) common-uefi-x86-64
|
||||
$(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI'
|
||||
|
||||
$(call MKESCAPE,$(BINDIR))/BOOTIA32.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI
|
||||
$(MKDIR_P) '$(call SHESCAPE,$(BINDIR))'
|
||||
cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' '$(call SHESCAPE,$(BINDIR))/'
|
||||
|
||||
.PHONY: limine-uefi-ia32
|
||||
limine-uefi-ia32:
|
||||
$(MAKE) common-uefi-ia32
|
||||
$(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI'
|
||||
|
||||
.PHONY: limine-bios-clean
|
||||
limine-bios-clean: common-bios-clean decompressor-clean
|
||||
|
||||
|
@ -11,18 +11,18 @@ MKESCAPE = $(subst $(SPACE),\ ,$(1))
|
||||
SHESCAPE = $(subst ','\'',$(1))
|
||||
OBJESCAPE = $(subst .a ,.a' ',$(subst .o ,.o' ',$(call SHESCAPE,$(1))))
|
||||
|
||||
ifeq ($(call MKESCAPE,$(BUILDDIR)), )
|
||||
$(error BUILDDIR not specified)
|
||||
ifeq ($(call MKESCAPE,$(BUILDDIR)),)
|
||||
$(error BUILDDIR not specified)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
override OBJCOPY_ARCH := elf32-i386
|
||||
else ifeq ($(TARGET), uefi-x86-64)
|
||||
override OBJCOPY_ARCH := elf64-x86-64
|
||||
else ifeq ($(TARGET), uefi-ia32)
|
||||
override OBJCOPY_ARCH := elf32-i386
|
||||
ifeq ($(TARGET),bios)
|
||||
override OBJCOPY_ARCH := elf32-i386
|
||||
else ifeq ($(TARGET),uefi-x86-64)
|
||||
override OBJCOPY_ARCH := elf64-x86-64
|
||||
else ifeq ($(TARGET),uefi-ia32)
|
||||
override OBJCOPY_ARCH := elf32-i386
|
||||
else
|
||||
$(error Invalid target)
|
||||
$(error Invalid target)
|
||||
endif
|
||||
|
||||
COM_OUTPUT ?= false
|
||||
@ -31,146 +31,146 @@ E9_OUTPUT ?= false
|
||||
override S2CFLAGS := -Os
|
||||
|
||||
override CROSS_CFLAGS += \
|
||||
-g \
|
||||
$(WERROR) \
|
||||
-std=gnu11 \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
-fno-omit-frame-pointer \
|
||||
-fno-strict-aliasing \
|
||||
-fno-lto \
|
||||
-nostdinc \
|
||||
-Wshadow \
|
||||
-Wvla \
|
||||
-mno-80387 \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-MMD \
|
||||
-DCOM_OUTPUT=$(COM_OUTPUT) \
|
||||
-DE9_OUTPUT=$(E9_OUTPUT) \
|
||||
-I../freestanding-headers \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/..' \
|
||||
-I. \
|
||||
-I.. \
|
||||
-I../stivale \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/tinf'
|
||||
-g \
|
||||
$(WERROR) \
|
||||
-std=gnu11 \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
-fno-omit-frame-pointer \
|
||||
-fno-strict-aliasing \
|
||||
-fno-lto \
|
||||
-nostdinc \
|
||||
-Wshadow \
|
||||
-Wvla \
|
||||
-mno-80387 \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-MMD \
|
||||
-DCOM_OUTPUT=$(COM_OUTPUT) \
|
||||
-DE9_OUTPUT=$(E9_OUTPUT) \
|
||||
-I../freestanding-headers \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/..' \
|
||||
-I. \
|
||||
-I.. \
|
||||
-I../stivale \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/tinf'
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
override CROSS_CFLAGS += \
|
||||
-Dbios=1 \
|
||||
-Duefi=0 \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-fno-pie \
|
||||
-fno-pic
|
||||
ifeq ($(TARGET),bios)
|
||||
override CROSS_CFLAGS += \
|
||||
-Dbios=1 \
|
||||
-Duefi=0 \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-fno-pie \
|
||||
-fno-pic
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
override INTERNAL_CFLAGS32 := \
|
||||
$(CROSS_CFLAGS) \
|
||||
-g0 \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-fpie
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
override INTERNAL_CFLAGS32 := \
|
||||
$(CROSS_CFLAGS) \
|
||||
-g0 \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-fpie
|
||||
|
||||
override CROSS_CFLAGS += \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/x86_64' \
|
||||
-fpie \
|
||||
-mno-red-zone
|
||||
override CROSS_CFLAGS += \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/x86_64' \
|
||||
-fpie \
|
||||
-mno-red-zone
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-ia32)
|
||||
override CROSS_CFLAGS += \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/ia32' \
|
||||
-fpie
|
||||
ifeq ($(TARGET),uefi-ia32)
|
||||
override CROSS_CFLAGS += \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/ia32' \
|
||||
-fpie
|
||||
endif
|
||||
|
||||
override CROSS_LDFLAGS += \
|
||||
-nostdlib \
|
||||
-z max-page-size=0x1000
|
||||
-nostdlib \
|
||||
-z max-page-size=0x1000
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_i386 \
|
||||
-static \
|
||||
--build-id=sha1
|
||||
ifeq ($(TARGET),bios)
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_i386 \
|
||||
-static \
|
||||
--build-id=sha1
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_x86_64 \
|
||||
-static \
|
||||
-pie \
|
||||
--no-dynamic-linker \
|
||||
-ztext
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_x86_64 \
|
||||
-static \
|
||||
-pie \
|
||||
--no-dynamic-linker \
|
||||
-ztext
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-ia32)
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_i386 \
|
||||
-static \
|
||||
-pie \
|
||||
--no-dynamic-linker \
|
||||
-ztext
|
||||
ifeq ($(TARGET),uefi-ia32)
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_i386 \
|
||||
-static \
|
||||
-pie \
|
||||
--no-dynamic-linker \
|
||||
-ztext
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
|
||||
override C_FILES := $(shell find ./ -type f -name '*.c')
|
||||
ifeq ($(TARGET), bios)
|
||||
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
|
||||
override ASM32_FILES := $(shell find ./ -type f -name '*.asm_ia32')
|
||||
override ASMB_FILES := $(shell find ./ -type f -name '*.asm_bios_ia32')
|
||||
ifeq ($(TARGET),bios)
|
||||
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
|
||||
override ASM32_FILES := $(shell find ./ -type f -name '*.asm_ia32')
|
||||
override ASMB_FILES := $(shell find ./ -type f -name '*.asm_bios_ia32')
|
||||
|
||||
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM32_FILES:.asm_ia32=.o) $(ASMB_FILES:.asm_bios_ia32=.o) $(ASMX86_FILES:.asm_x86=.o))
|
||||
override OBJ_S2 := $(filter %.s2.o,$(OBJ))
|
||||
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM32_FILES:.asm_ia32=.o) $(ASMB_FILES:.asm_bios_ia32=.o) $(ASMX86_FILES:.asm_x86=.o))
|
||||
override OBJ_S2 := $(filter %.s2.o,$(OBJ))
|
||||
endif
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
|
||||
override ASM64_FILES := $(shell find ./ -type f -name '*.asm_x86_64')
|
||||
override ASM64U_FILES := $(shell find ./ -type f -name '*.asm_uefi_x86_64')
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
|
||||
override ASM64_FILES := $(shell find ./ -type f -name '*.asm_x86_64')
|
||||
override ASM64U_FILES := $(shell find ./ -type f -name '*.asm_uefi_x86_64')
|
||||
|
||||
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM64_FILES:.asm_x86_64=.o) $(ASM64U_FILES:.asm_uefi_x86_64=.o) $(ASMX86_FILES:.asm_x86=.o))
|
||||
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM64_FILES:.asm_x86_64=.o) $(ASM64U_FILES:.asm_uefi_x86_64=.o) $(ASMX86_FILES:.asm_x86=.o))
|
||||
endif
|
||||
ifeq ($(TARGET), uefi-ia32)
|
||||
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
|
||||
override ASM32_FILES := $(shell find ./ -type f -name '*.asm_ia32')
|
||||
override ASM32U_FILES := $(shell find ./ -type f -name '*.asm_uefi_ia32')
|
||||
ifeq ($(TARGET),uefi-ia32)
|
||||
override ASMX86_FILES := $(shell find ./ -type f -name '*.asm_x86')
|
||||
override ASM32_FILES := $(shell find ./ -type f -name '*.asm_ia32')
|
||||
override ASM32U_FILES := $(shell find ./ -type f -name '*.asm_uefi_ia32')
|
||||
|
||||
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM32_FILES:.asm_ia32=.o) $(ASM32U_FILES:.asm_uefi_ia32=.o) $(ASMX86_FILES:.asm_x86=.o))
|
||||
override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(ASM32_FILES:.asm_ia32=.o) $(ASM32U_FILES:.asm_uefi_ia32=.o) $(ASMX86_FILES:.asm_x86=.o))
|
||||
endif
|
||||
override HEADER_DEPS := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.d))
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
.PHONY: all
|
||||
|
||||
ifeq ($(TARGET),bios)
|
||||
all: $(call MKESCAPE,$(BUILDDIR))/limine.sys $(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz
|
||||
else ifeq ($(TARGET), uefi-x86-64)
|
||||
else ifeq ($(TARGET),uefi-x86-64)
|
||||
all: $(call MKESCAPE,$(BUILDDIR))/BOOTX64.EFI
|
||||
else ifeq ($(TARGET), uefi-ia32)
|
||||
else ifeq ($(TARGET),uefi-ia32)
|
||||
all: $(call MKESCAPE,$(BUILDDIR))/BOOTIA32.EFI
|
||||
endif
|
||||
|
||||
@ -192,7 +192,7 @@ $(call MKESCAPE,$(BUILDDIR))/tinf/tinflate.o: $(call MKESCAPE,$(BUILDDIR))/tinf-
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
$(CROSS_CC) $(CROSS_CFLAGS) -c '$(call SHESCAPE,$(@:.o=.c))' -o '$(call SHESCAPE,$@)'
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
ifeq ($(TARGET),bios)
|
||||
|
||||
$(call MKESCAPE,$(BUILDDIR))/stage2.bin.gz: $(call MKESCAPE,$(BUILDDIR))/stage2.bin
|
||||
gzip -n -9 < '$(call SHESCAPE,$<)' > '$(call SHESCAPE,$@)'
|
||||
@ -261,7 +261,7 @@ $(call MKESCAPE,$(BUILDDIR))/limine-efi: ../limine-efi/*
|
||||
$(MKDIR_P) '$(call SHESCAPE,$(BUILDDIR))'
|
||||
cp -r ../limine-efi '$(call SHESCAPE,$(BUILDDIR))/'
|
||||
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
|
||||
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
|
||||
cd '$(call SHESCAPE,$(BUILDDIR))' && \
|
||||
@ -302,7 +302,7 @@ $(call MKESCAPE,$(BUILDDIR))/limine.elf: $(call MKESCAPE,$(BUILDDIR))/limine-efi
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-ia32)
|
||||
ifeq ($(TARGET),uefi-ia32)
|
||||
|
||||
$(call MKESCAPE,$(BUILDDIR))/full.map.o: $(call MKESCAPE,$(BUILDDIR))/limine_nomap.elf
|
||||
cd '$(call SHESCAPE,$(BUILDDIR))' && \
|
||||
@ -345,19 +345,19 @@ endif
|
||||
|
||||
-include $(HEADER_DEPS)
|
||||
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied $(call MKESCAPE,$(BUILDDIR))/limine-efi
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
$(CROSS_CC) $(CROSS_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-ia32)
|
||||
ifeq ($(TARGET),uefi-ia32)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied $(call MKESCAPE,$(BUILDDIR))/limine-efi
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
$(CROSS_CC) $(CROSS_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
ifeq ($(TARGET),bios)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.o: %.c $(call MKESCAPE,$(BUILDDIR))/tinf-copied
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
$(CROSS_CC) $(CROSS_CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
|
||||
@ -365,7 +365,7 @@ endif
|
||||
|
||||
-include $(HEADER_DEPS)
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
ifeq ($(TARGET),bios)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.s2.o: %.s2.c
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
$(CROSS_CC) $(CROSS_CFLAGS) $(S2CFLAGS) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@)'
|
||||
@ -373,7 +373,7 @@ endif
|
||||
|
||||
-include $(HEADER_DEPS)
|
||||
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.32.o: %.32.c $(call MKESCAPE,$(BUILDDIR))/limine-efi
|
||||
mkdir -p "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
$(CROSS_CC) $(CROSS_CFLAGS) $(INTERNAL_CFLAGS32) -c '$(call SHESCAPE,$<)' -o '$(call SHESCAPE,$@).32'
|
||||
@ -381,7 +381,7 @@ $(call MKESCAPE,$(BUILDDIR))/%.32.o: %.32.c $(call MKESCAPE,$(BUILDDIR))/limine-
|
||||
rm '$(call SHESCAPE,$@).32'
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), bios)
|
||||
ifeq ($(TARGET),bios)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_ia32
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
nasm '$(call SHESCAPE,$<)' -F dwarf -g $(WERROR) -f elf32 -o '$(call SHESCAPE,$@)'
|
||||
@ -395,7 +395,7 @@ $(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_x86
|
||||
nasm '$(call SHESCAPE,$<)' -F dwarf -g $(WERROR) -f elf32 -o '$(call SHESCAPE,$@)'
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-x86-64)
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_x86_64
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
nasm '$(call SHESCAPE,$<)' -F dwarf -g $(WERROR) -f elf64 -o '$(call SHESCAPE,$@)'
|
||||
@ -409,7 +409,7 @@ $(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_x86
|
||||
nasm '$(call SHESCAPE,$<)' -F dwarf -g $(WERROR) -f elf64 -o '$(call SHESCAPE,$@)'
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), uefi-ia32)
|
||||
ifeq ($(TARGET),uefi-ia32)
|
||||
$(call MKESCAPE,$(BUILDDIR))/%.o: %.asm_ia32
|
||||
$(MKDIR_P) "$$(dirname '$(call SHESCAPE,$@)')"
|
||||
nasm '$(call SHESCAPE,$<)' -F dwarf -g $(WERROR) -f elf32 -o '$(call SHESCAPE,$@)'
|
||||
|
@ -8,44 +8,44 @@ MKESCAPE = $(subst $(SPACE),\ ,$(1))
|
||||
SHESCAPE = $(subst ','\'',$(1))
|
||||
OBJESCAPE = $(subst .a ,.a' ',$(subst .o ,.o' ',$(call SHESCAPE,$(1))))
|
||||
|
||||
ifeq ($(call MKESCAPE,$(BUILDDIR)), )
|
||||
$(error BUILDDIR not specified)
|
||||
ifeq ($(call MKESCAPE,$(BUILDDIR)),)
|
||||
$(error BUILDDIR not specified)
|
||||
endif
|
||||
|
||||
override CROSS_CFLAGS += \
|
||||
$(WERROR) \
|
||||
$(WERROR) \
|
||||
-Os \
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-std=gnu11 \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
-fno-strict-aliasing \
|
||||
-fno-lto \
|
||||
-fno-pie \
|
||||
-fno-pic \
|
||||
-fomit-frame-pointer \
|
||||
-nostdinc \
|
||||
-Wshadow \
|
||||
-Wvla \
|
||||
-mno-80387 \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-MMD \
|
||||
-I../freestanding-headers \
|
||||
-I. \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/tinf'
|
||||
-m32 \
|
||||
-march=i686 \
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-std=gnu11 \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
-fno-strict-aliasing \
|
||||
-fno-lto \
|
||||
-fno-pie \
|
||||
-fno-pic \
|
||||
-fomit-frame-pointer \
|
||||
-nostdinc \
|
||||
-Wshadow \
|
||||
-Wvla \
|
||||
-mno-80387 \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-MMD \
|
||||
-I../freestanding-headers \
|
||||
-I. \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/tinf'
|
||||
|
||||
override CROSS_LDFLAGS += \
|
||||
-melf_i386 \
|
||||
-nostdlib \
|
||||
-z max-page-size=0x1000 \
|
||||
-static \
|
||||
-Tlinker.ld
|
||||
-melf_i386 \
|
||||
-nostdlib \
|
||||
-z max-page-size=0x1000 \
|
||||
-static \
|
||||
-Tlinker.ld
|
||||
|
||||
override C_FILES := $(shell find ./ -type f -name '*.c')
|
||||
override ASM_FILES := $(shell find ./ -type f -name '*.asm')
|
||||
|
Loading…
Reference in New Issue
Block a user