build: Further portability improvements

This commit is contained in:
mintsuki 2022-01-21 02:34:38 +01:00
parent 7b0c430fb5
commit 64467c06d8
1 changed files with 19 additions and 11 deletions

View File

@ -82,16 +82,6 @@ export LIMINE_OBJCOPY
export LIMINE_OBJDUMP
export LIMINE_READELF
override USING_GNU_LD := $(shell $(LIMINE_LD) --version | grep Binutils >/dev/null && echo 1)
ifeq ($(USING_GNU_LD), 0)
$(error The specified LIMINE_LD linker ($(LIMINE_LD)) is not the GNU linker)
endif
override USING_GNU_OBJCOPY := $(shell $(LIMINE_OBJCOPY) --version | grep Binutils >/dev/null && echo 1)
ifeq ($(USING_GNU_OBJCOPY), 0)
$(error The specified LIMINE_OBJCOPY ($(LIMINE_OBJCOPY)) is not GNU objcopy)
endif
override USING_CLANG := $(shell $(LIMINE_CC) --version | grep clang >/dev/null && echo 1)
export USING_CLANG
@ -103,13 +93,31 @@ endif
override CC_MACHINE := $(shell PATH='$(call SHESCAPE,$(PATH))' $(LIMINE_CC) -dumpmachine | dd bs=6 count=1 2>/dev/null)
ifneq ($(MAKECMDGOALS), toolchain)
ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), distclean)
ifneq ($(MAKECMDGOALS), distclean2)
ifneq ($(MAKECMDGOALS), maintainer-clean)
ifneq ($(MAKECMDGOALS), uninstall)
ifneq ($(MAKECMDGOALS), dist)
override USING_GNU_LD := $(shell $(LIMINE_LD) --version | grep Binutils >/dev/null && echo 1)
ifneq ($(USING_GNU_LD), 1)
$(error The specified LIMINE_LD linker ($(LIMINE_LD)) is not the GNU linker)
endif
override USING_GNU_OBJCOPY := $(shell $(LIMINE_OBJCOPY) --version | grep Binutils >/dev/null && echo 1)
ifneq ($(USING_GNU_OBJCOPY), 1)
$(error The specified LIMINE_OBJCOPY ($(LIMINE_OBJCOPY)) is not GNU objcopy)
endif
ifneq ($(CC_MACHINE), x86_64)
ifneq ($(CC_MACHINE), amd64-)
$(error No suitable x86_64 C compiler found, please install an x86_64 C toolchain or run "make toolchain")
endif
endif
endif
endif
endif
endif
endif
endif