From c626e63b563b1363b9c59b941ad5fb3368fc7429 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Mon, 22 Aug 2022 18:41:32 +0200 Subject: [PATCH] build: Fix #208 --- GNUmakefile.in | 25 ++++++++++++++++--------- configure.ac | 6 ++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/GNUmakefile.in b/GNUmakefile.in index 2f48a62f..3ad3fb29 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -19,32 +19,39 @@ MKESCAPE = $(subst $(SPACE),\ ,$(1)) SHESCAPE = $(subst ','\'',$(1)) NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1)) +define DEFAULT_VAR = + ifeq ($(origin $1),default) + override $(1) := $(2) + endif + ifeq ($(origin $1),undefined) + override $(1) := $(2) + endif +endef + override BUILD_CD_EFI := @BUILD_CD_EFI@ override BUILD_PXE := @BUILD_PXE@ override BUILD_CD := @BUILD_CD@ override BUILD_LIMINE_DEPLOY := @BUILD_LIMINE_DEPLOY@ -WERROR ?= @WERROR@ +override WERROR := @WERROR@ export WERROR -ifeq ($(origin CC),default) - CC := @CC@ -endif +$(eval $(call DEFAULT_VAR,CC,cc)) export CC -MKDIR_P ?= @MKDIR_P@ +override MKDIR_P := @MKDIR_P@ export MKDIR_P -INSTALL ?= @INSTALL@ +override INSTALL := @INSTALL@ export INSTALL -GREP ?= @GREP@ +override GREP := @GREP@ export GREP -SED ?= @SED@ +override SED := @SED@ export SED -AWK ?= @AWK@ +override AWK := @AWK@ export AWK CFLAGS ?= @CFLAGS@ diff --git a/configure.ac b/configure.ac index e0b4b789..0eecfac8 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,13 @@ if test "$werror_state" = "yes"; then fi AC_PROG_MKDIR_P +case "$MKDIR_P" in + .*) MKDIR_P="$(cd "$(dirname "$MKDIR_P")" && pwd -P)/$(basename "$MKDIR_P")" ;; +esac AC_PROG_INSTALL +case "$INSTALL" in + .*) INSTALL="$(cd "$(dirname "$INSTALL")" && pwd -P)/$(basename "$INSTALL")" ;; +esac AC_PROG_GREP AC_PROG_SED AC_PROG_AWK