[gPXE-devel] [PATCH 2/2] [config] Support local config.
Piotr Jaroszyński
p.jaroszynski at gmail.com
Mon Mar 22 16:20:45 EDT 2010
config/config.c automatically includes config/local.h if it's present
and NO_LOCAL_CONF wasn't passed as a make param. Building detects
whether local config was used previously and rebuilds as needed.
---
src/.gitignore | 1 -
src/Makefile.housekeeping | 28 ++++++++++++++++++++++++++++
src/config/.gitignore | 1 +
src/config/config.c | 4 ++++
4 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/src/.gitignore b/src/.gitignore
index 413f814..cc8e33e 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -2,4 +2,3 @@
.echocheck
TAGS*
bin*
-config-local.h
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 7d3ec67..e08906f 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -450,6 +450,34 @@ RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
DEBUG_TARGETS += dbg%.o c s
+###############################################################################
+#
+# Local config
+#
+
+ifndef NO_LOCAL_CONFIG
+ifneq ($(wildcard config/local.h),)
+LOCAL_CONFIG = 1
+endif
+endif
+
+$(BIN)/.local_config_0:
+ @$(ECHO) " [CONFIG] local disabled"
+ @rm -f $(BIN)/.local_config_*
+ @touch $(BIN)/.local_config_0
+
+$(BIN)/.local_config_1:
+ @$(ECHO) " [CONFIG] local enabled"
+ @rm -f $(BIN)/.local_config_*
+ @touch $(BIN)/.local_config_1
+
+ifdef LOCAL_CONFIG
+config_EXTRA_DEPS = $(BIN)/.local_config_1 config/local.h
+CFLAGS += -DINCLUDE_LOCAL_CONFIG
+else
+config_EXTRA_DEPS = $(BIN)/.local_config_0
+endif
+
# We automatically generate rules for any file mentioned in AUTO_SRCS
# using the following set of templates. It would be cleaner to use
# $(eval ...), but this function exists only in GNU make >= 3.80.
diff --git a/src/config/.gitignore b/src/config/.gitignore
index 8e94f32..36da581 100644
--- a/src/config/.gitignore
+++ b/src/config/.gitignore
@@ -1 +1,2 @@
.buildserial.*
+local.h
diff --git a/src/config/config.c b/src/config/config.c
index a6e7622..dcdb870 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -10,6 +10,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <config/general.h>
#include <config/console.h>
+#ifdef INCLUDE_LOCAL_CONFIG
+# include <config/local.h>
+#endif
+
/** @file
*
* Configuration options
--
1.7.0.2
More information about the gPXE-devel
mailing list