build: Build necessary gnu-efi objects in the stage23 Makefile rather than the root one
This commit is contained in:
parent
34584d97ea
commit
b697b6aec6
6
Makefile
6
Makefile
@ -7,14 +7,10 @@ SHELL := /usr/bin/env bash
|
|||||||
TOOLCHAIN = x86_64-elf
|
TOOLCHAIN = x86_64-elf
|
||||||
|
|
||||||
TOOLCHAIN_CC = $(TOOLCHAIN)-gcc
|
TOOLCHAIN_CC = $(TOOLCHAIN)-gcc
|
||||||
TOOLCHAIN_AR = $(TOOLCHAIN)-ar
|
|
||||||
|
|
||||||
ifeq ($(shell export "PATH=$(PATH)"; command -v $(TOOLCHAIN_CC) ; ), )
|
ifeq ($(shell export "PATH=$(PATH)"; command -v $(TOOLCHAIN_CC) ; ), )
|
||||||
TOOLCHAIN_CC := gcc
|
TOOLCHAIN_CC := gcc
|
||||||
endif
|
endif
|
||||||
ifeq ($(shell export "PATH=$(PATH)"; command -v $(TOOLCHAIN_AR) ; ), )
|
|
||||||
TOOLCHAIN_AR := ar
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS), toolchain)
|
ifneq ($(MAKECMDGOALS), toolchain)
|
||||||
ifneq ($(shell export "PATH=$(PATH)"; $(TOOLCHAIN_CC) -dumpmachine | head -c 6), x86_64)
|
ifneq ($(shell export "PATH=$(PATH)"; $(TOOLCHAIN_CC) -dumpmachine | head -c 6), x86_64)
|
||||||
@ -132,8 +128,6 @@ toolchain:
|
|||||||
|
|
||||||
gnu-efi:
|
gnu-efi:
|
||||||
git clone https://git.code.sf.net/p/gnu-efi/code --branch=3.0.13 --depth=1 $@
|
git clone https://git.code.sf.net/p/gnu-efi/code --branch=3.0.13 --depth=1 $@
|
||||||
$(MAKE) -C gnu-efi/gnuefi CC="$(TOOLCHAIN_CC) -m64 -march=x86-64" AR="$(TOOLCHAIN_AR)"
|
|
||||||
$(MAKE) -C gnu-efi/lib CC="$(TOOLCHAIN_CC) -m64 -march=x86-64" ARCH=x86_64 x86_64/efi_stub.o
|
|
||||||
|
|
||||||
ovmf:
|
ovmf:
|
||||||
mkdir -p ovmf
|
mkdir -p ovmf
|
||||||
|
@ -17,6 +17,7 @@ TOOLCHAIN = x86_64-elf
|
|||||||
|
|
||||||
TOOLCHAIN_CC = $(TOOLCHAIN)-gcc
|
TOOLCHAIN_CC = $(TOOLCHAIN)-gcc
|
||||||
TOOLCHAIN_LD = $(TOOLCHAIN)-ld
|
TOOLCHAIN_LD = $(TOOLCHAIN)-ld
|
||||||
|
TOOLCHAIN_AR = $(TOOLCHAIN)-ar
|
||||||
TOOLCHAIN_OBJCOPY = $(TOOLCHAIN)-objcopy
|
TOOLCHAIN_OBJCOPY = $(TOOLCHAIN)-objcopy
|
||||||
TOOLCHAIN_OBJDUMP = $(TOOLCHAIN)-objdump
|
TOOLCHAIN_OBJDUMP = $(TOOLCHAIN)-objdump
|
||||||
TOOLCHAIN_READELF = $(TOOLCHAIN)-readelf
|
TOOLCHAIN_READELF = $(TOOLCHAIN)-readelf
|
||||||
@ -27,6 +28,9 @@ endif
|
|||||||
ifeq ($(shell command -v $(TOOLCHAIN_LD) ; ), )
|
ifeq ($(shell command -v $(TOOLCHAIN_LD) ; ), )
|
||||||
TOOLCHAIN_LD := ld
|
TOOLCHAIN_LD := ld
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(shell command -v $(TOOLCHAIN_AR) ; ), )
|
||||||
|
TOOLCHAIN_AR := ar
|
||||||
|
endif
|
||||||
ifeq ($(shell command -v $(TOOLCHAIN_OBJCOPY) ; ), )
|
ifeq ($(shell command -v $(TOOLCHAIN_OBJCOPY) ; ), )
|
||||||
TOOLCHAIN_OBJCOPY := objcopy
|
TOOLCHAIN_OBJCOPY := objcopy
|
||||||
endif
|
endif
|
||||||
@ -197,20 +201,20 @@ $(BUILDDIR)/full.map.o: $(BUILDDIR)/limine_efi_nomap.elf
|
|||||||
$(BUILDDIR)/BOOTX64.EFI: $(BUILDDIR)/limine_efi.elf
|
$(BUILDDIR)/BOOTX64.EFI: $(BUILDDIR)/limine_efi.elf
|
||||||
$(TOOLCHAIN_OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc -j .sbat --target efi-app-x86_64 --subsystem=10 $< $@
|
$(TOOLCHAIN_OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc -j .sbat --target efi-app-x86_64 --subsystem=10 $< $@
|
||||||
|
|
||||||
$(BUILDDIR)/limine_efi_nomap.elf: $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o
|
../gnu-efi/gnuefi/crt0-efi-x86_64.o ../gnu-efi/gnuefi/libgnuefi.a:
|
||||||
|
$(MAKE) -C ../gnu-efi/gnuefi CC="$(TOOLCHAIN_CC) -m64 -march=x86-64" AR="$(TOOLCHAIN_AR)" ARCH=x86_64
|
||||||
|
|
||||||
|
../gnu-efi/lib/x86_64/efi_stub.o:
|
||||||
|
$(MAKE) -C ../gnu-efi/lib CC="$(TOOLCHAIN_CC) -m64 -march=x86-64" ARCH=x86_64 x86_64/efi_stub.o
|
||||||
|
|
||||||
|
$(BUILDDIR)/limine_efi_nomap.elf: ../gnu-efi/gnuefi/crt0-efi-x86_64.o ../gnu-efi/gnuefi/libgnuefi.a ../gnu-efi/lib/x86_64/efi_stub.o $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o
|
||||||
$(TOOLCHAIN_LD) \
|
$(TOOLCHAIN_LD) \
|
||||||
-Tlinker_uefi_nomap.ld \
|
-Tlinker_uefi_nomap.ld \
|
||||||
../gnu-efi/gnuefi/crt0-efi-x86_64.o \
|
|
||||||
../gnu-efi/gnuefi/libgnuefi.a \
|
|
||||||
../gnu-efi/lib/x86_64/efi_stub.o \
|
|
||||||
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
|
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/limine_efi.elf: $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/full.map.o
|
$(BUILDDIR)/limine_efi.elf: ../gnu-efi/gnuefi/crt0-efi-x86_64.o ../gnu-efi/gnuefi/libgnuefi.a ../gnu-efi/lib/x86_64/efi_stub.o $(OBJ) $(BUILDDIR)/font.o $(BUILDDIR)/sys/smp_trampoline.o $(BUILDDIR)/full.map.o
|
||||||
$(TOOLCHAIN_LD) \
|
$(TOOLCHAIN_LD) \
|
||||||
-Tlinker_uefi.ld \
|
-Tlinker_uefi.ld \
|
||||||
../gnu-efi/gnuefi/crt0-efi-x86_64.o \
|
|
||||||
../gnu-efi/gnuefi/libgnuefi.a \
|
|
||||||
../gnu-efi/lib/x86_64/efi_stub.o \
|
|
||||||
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
|
$^ $(LDFLAGS) $(INTERNAL_LDFLAGS) -o $@
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user