CFLAGS_privkey += $(if $(PRIVKEY),-DPRIVATE_KEY="\"$(PRIVKEY_INC)\"")
+# (Single-element) list of named configurations
+#
+CONFIG_LIST := $(BIN)/.config.list
+ifeq ($(wildcard $(CONFIG_LIST)),)
+CONFIG_OLD := <invalid>
+else
+CONFIG_OLD := $(shell cat $(CONFIG_LIST))
+endif
+ifneq ($(CONFIG_OLD),$(CONFIG))
+$(shell $(ECHO) "$(CONFIG)" > $(CONFIG_LIST))
+endif
+
+$(CONFIG_LIST) : $(MAKEDEPS)
+
+VERYCLEANUP += $(CONFIG_LIST)
+
+# Named configurations
+#
+ifneq ($(CONFIG),)
+ifneq ($(wildcard config/$(CONFIG)),)
+CFLAGS += -DCONFIG=$(CONFIG)
+endif
+CFLAGS += -DLOCAL_CONFIG=$(CONFIG)
+endif
+
+config/named.h : $(CONFIG_LIST)
+ $(Q)$(TOUCH) $@
+
# These files use .incbin inline assembly to include a binary file.
# Unfortunately ccache does not detect this dependency and caches
# builds even when the binary file has changed.
#
# Local configs
#
-config/local/%.h :
- $(Q)touch $@
+CONFIG_HEADERS := $(patsubst config/%,%,$(wildcard config/*.h))
+
+$(foreach HEADER,$(CONFIG_HEADERS),config/local/$(HEADER)) :
+ $(Q)$(TOUCH) $@
+
+ifneq ($(CONFIG),)
+$(foreach HEADER,$(CONFIG_HEADERS),config/local/$(CONFIG)/$(HEADER)) :
+ $(Q)$(MKDIR) -p $(dir $@)
+ $(Q)$(TOUCH) $@
+endif
###############################################################################
#
#define COLOR_PXE_FG COLOR_BLACK
#define COLOR_PXE_BG COLOR_WHITE
+#include <config/named.h>
+#include NAMED_CONFIG(colour.h)
#include <config/local/colour.h>
+#include LOCAL_NAMED_CONFIG(colour.h)
#endif /* CONFIG_COLOUR_H */
#define LOG_LEVEL LOG_NONE
+#include <config/named.h>
+#include NAMED_CONFIG(console.h)
#include <config/local/console.h>
+#include LOCAL_NAMED_CONFIG(console.h)
#endif /* CONFIG_CONSOLE_H */
*/
#define TIMESTAMP_ERROR_MARGIN ( ( 12 * 60 + 30 ) * 60 )
+#include <config/named.h>
+#include NAMED_CONFIG(crypto.h)
#include <config/local/crypto.h>
+#include LOCAL_NAMED_CONFIG(crypto.h)
#endif /* CONFIG_CRYPTO_H */
#undef GDBUDP /* Remote GDB debugging over UDP
* (both may be set) */
+#include <config/named.h>
+#include NAMED_CONFIG(general.h)
#include <config/local/general.h>
+#include LOCAL_NAMED_CONFIG(general.h)
#endif /* CONFIG_GENERAL_H */
--- /dev/null
+#ifndef CONFIG_NAMED_H
+#define CONFIG_NAMED_H
+
+/** @file
+ *
+ * Named configurations
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+/* config/<name>/<header>.h */
+#ifdef CONFIG
+#define NAMED_CONFIG(_header) <config/CONFIG/_header>
+#else
+#define NAMED_CONFIG(_header) <config/_header>
+#endif
+
+/* config/local/<name>/<header>.h */
+#ifdef LOCAL_CONFIG
+#define LOCAL_NAMED_CONFIG(_header) <config/local/LOCAL_CONFIG/_header>
+#else
+#define LOCAL_NAMED_CONFIG(_header) <config/_header>
+#endif
+
+#endif /* CONFIG_NAMED_H */
#define COMSTOP 1 /* Stop bits */
#endif
+#include <config/named.h>
+#include NAMED_CONFIG(serial.h)
#include <config/local/serial.h>
+#include LOCAL_NAMED_CONFIG(serial.h)
#endif /* CONFIG_SERIAL_H */
//#define MEMMAP_SETTINGS /* Memory map settings */
//#define VMWARE_SETTINGS /* VMware GuestInfo settings */
+#include <config/named.h>
+#include NAMED_CONFIG(settings.h)
#include <config/local/settings.h>
+#include LOCAL_NAMED_CONFIG(settings.h)
#endif /* CONFIG_SETTINGS_H */
//#define CONFIG_BOFM /* IBM's BladeCenter Open Fabric Manager */
+#include <config/named.h>
+#include NAMED_CONFIG(sideband.h)
#include <config/local/sideband.h>
+#include LOCAL_NAMED_CONFIG(sideband.h)
#endif /* CONFIG_SIDEBAND_H */