From 1c7e660973bf2c23d4dbfbbf2b684ef3eeb55a32 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Sat, 24 Jun 2023 23:35:14 +0200 Subject: [PATCH] buildsystem: only expose CPU_RAM_BASE & SIZE when known This gets rid of the following ugly warnings: /bin/sh: 1: arithmetic expression: expecting primary: "" --- makefiles/cflags.inc.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/makefiles/cflags.inc.mk b/makefiles/cflags.inc.mk index 00c5eb0778..3ba16a20f3 100644 --- a/makefiles/cflags.inc.mk +++ b/makefiles/cflags.inc.mk @@ -121,5 +121,9 @@ CFLAGS += $(filter-out $(OPTIONAL_CFLAGS_BLACKLIST),$(OPTIONAL_CFLAGS)) CXXEXFLAGS += -Wno-missing-field-initializers # Reformat the RAM region for usage within code and expose them -CFLAGS += -DCPU_RAM_BASE=$(RAM_START_ADDR) -CFLAGS += -DCPU_RAM_SIZE=$(shell printf "0x%x" $$(($(RAM_LEN:%K=%*1024)))) +ifneq (,$(RAM_START_ADDR)) + CFLAGS += -DCPU_RAM_BASE=$(RAM_START_ADDR) +endif +ifneq (,$(RAM_LEN)) + CFLAGS += -DCPU_RAM_SIZE=$(shell printf "0x%x" $$(($(RAM_LEN:%K=%*1024)))) +endif