summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-08-21 13:47:09 +0200
committerNico Huber <nico.h@gmx.de>2024-08-27 09:06:58 +0000
commit1dfe9dc46063c751e0bf3a4637e144c0da4d5502 (patch)
treec9de2c0c3cf3f6e80fbae665c4a03189cec15a58 /payloads/libpayload
parentb1cf21378d843bd97a8061569c2b9fc837b7bb84 (diff)
libpayload: Set reasonable arch defaults
This makes it easy to switch between x86_32 and x86_64 in payloads. Change-Id: I3ac5f24d83dc80db924e92b53403c477e6256c44 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84014 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/Makefile.payload20
1 files changed, 14 insertions, 6 deletions
diff --git a/payloads/libpayload/Makefile.payload b/payloads/libpayload/Makefile.payload
index 936698760b..d2860bf42d 100644
--- a/payloads/libpayload/Makefile.payload
+++ b/payloads/libpayload/Makefile.payload
@@ -32,14 +32,8 @@ DEFAULT_DEPS += $(PAYLOAD_DEPS)
obj ?= build
-ARCH ?=
OBJS ?=
CCACHE ?=
-
-CFLAGS = $(CFLAGS_$(ARCH))
-CFLAGS += -Os -ffreestanding
-CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wvla -Werror
-
STRIP ?= debug
$(TARGET):
@@ -78,6 +72,20 @@ $(error $(xcompile) deleted because it's invalid. \
Restarting the build should fix that, or explain the problem.)
endif
+ifeq ($(CONFIG_LP_ARCH_ARM),y)
+ARCH ?= arm
+else ifeq ($(CONFIG_LP_ARCH_X86_64),y)
+ARCH ?= x86_64
+else ifeq ($(CONFIG_LP_ARCH_X86_32),y)
+ARCH ?= x86_32
+else ifeq ($(CONFIG_LP_ARCH_ARM64),y)
+ARCH ?= arm64
+endif
+
+CFLAGS = $(CFLAGS_$(ARCH))
+CFLAGS += -Os -ffreestanding
+CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wvla -Werror
+
# `lpgcc` in in-tree mode:
LPGCC = CC="$(CCACHE) $(CC_$(ARCH))"
LPGCC += _OBJ="$(LIBPAYLOAD_OBJ)"