diff options
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/config/config.c (renamed from src/core/config.c) | 18 | ||||
-rw-r--r-- | src/include/compiler.h | 5 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile index 16759ca0..72b0e64c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -73,6 +73,7 @@ SRCDIRS += crypto crypto/axtls crypto/matrixssl SRCDIRS += hci hci/commands hci/tui SRCDIRS += hci/mucurses hci/mucurses/widgets SRCDIRS += usr +SRCDIRS += config # NON_AUTO_SRCS lists files that are excluded from the normal # automatic build system. diff --git a/src/core/config.c b/src/config/config.c index e4c05613..3c43dfbc 100644 --- a/src/core/config.c +++ b/src/config/config.c @@ -10,6 +10,24 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <config/general.h> #include <config/console.h> +/** @file + * + * Configuration options + * + * This file contains macros that pull various objects into the link + * based on definitions in configuration header files. Ideally it + * should be the only place in gPXE where one might need to use #ifdef + * for compile-time options. + * + * In the fairly common case where an object should only be considered + * for inclusion if the subsystem it depends on is present, its + * configuration macros should be placed in a file named + * <tt>config_<i>subsystem</i>.c</tt>, where @e subsystem is the + * object basename of the main source file for that subsystem. The + * build system will pull in that file if @c subsystem.c is included + * in the final gPXE executable built. + */ + /* * Build ID string calculations * diff --git a/src/include/compiler.h b/src/include/compiler.h index 5ba7f441..f481f38a 100644 --- a/src/include/compiler.h +++ b/src/include/compiler.h @@ -159,10 +159,15 @@ #define PREFIX_OBJECT( _prefix ) _C2 ( _prefix, OBJECT ) #define OBJECT_SYMBOL PREFIX_OBJECT ( obj_ ) +#define REQUEST_EXPANDED( _sym ) REQUEST_SYMBOL ( _sym ) +#define CONFIG_SYMBOL PREFIX_OBJECT ( obj_config_ ) /** Always provide the symbol for the current object (defined by -DOBJECT) */ PROVIDE_SYMBOL ( OBJECT_SYMBOL ); +/** Pull in an object-specific configuration file if available */ +REQUEST_EXPANDED ( CONFIG_SYMBOL ); + /** Explicitly require another object */ #define REQUIRE_OBJECT( _obj ) REQUIRE_SYMBOL ( obj_ ## _obj ) |