]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Allow for a debug level of zero
authorMichael Brown <mcb30@ipxe.org>
Mon, 28 Apr 2014 13:43:19 +0000 (14:43 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 28 Apr 2014 13:45:47 +0000 (14:45 +0100)
Allow for an explicit debug level of zero, which will enable
assertions and profiling (i.e. anything controlled by NDEBUG) without
generating any debug messages.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile.housekeeping
src/include/compiler.h

index c0c1c910591c492493579ee3e09fa35e0a80626c..e240a738625d4bc2e3b7c343336a7fbefcd251dc 100644 (file)
@@ -533,14 +533,14 @@ endif
 #
 COMPILE_c      = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
 RULE_c         = $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O)
-RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(subst -,_,$(OBJECT))=$* -c $< -o $@ $(POST_O)
+RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -DDBGLVL_MAX=$* -c $< -o $@ $(POST_O)
 RULE_c_to_c    = $(Q)$(COMPILE_c) -E -c $< > $@
 RULE_c_to_s    = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
 
 PREPROCESS_S   = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
 ASSEMBLE_S     = $(AS) $(ASFLAGS)
 RULE_S         = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
-RULE_S_to_dbg%.o = $(Q)$(PREPROCESS_S) -Ddebug_$(subst -,_,$(OBJECT))=$* $< | $(ASSEMBLE_S) -o $@
+RULE_S_to_dbg%.o = $(Q)$(PREPROCESS_S) -DDBGLVL_MAX=$* $< | $(ASSEMBLE_S) -o $@
 RULE_S_to_s    = $(Q)$(PREPROCESS_S) $< > $@
 
 DEBUG_TARGETS  += dbg%.o c s
index 132793b5d400d2f7e408d51af2017f8760cca798..3f5c913a0990e11fef5aa1096583b9237cde99d2 100644 (file)
@@ -250,16 +250,9 @@ REQUEST_EXPANDED ( CONFIG_SYMBOL );
  *
  */
 
-/*
- * If debug_OBJECT is set to a true value, the macro DBG(...) will
- * expand to printf(...) when compiling OBJECT, and the symbol
- * DEBUG_LEVEL will be inserted into the object file.
- *
- */
-#define DEBUG_SYMBOL PREFIX_OBJECT ( debug_ )
-
-#if DEBUG_SYMBOL == 0
+#ifndef DBGLVL_MAX
 #define NDEBUG
+#define DBGLVL_MAX 0
 #endif
 
 #ifndef ASSEMBLY
@@ -276,12 +269,6 @@ extern void dbg_md5_da ( unsigned long dispaddr,
 extern void dbg_pause ( void );
 extern void dbg_more ( void );
 
-#if DEBUG_SYMBOL
-#define DBGLVL_MAX DEBUG_SYMBOL
-#else
-#define DBGLVL_MAX 0
-#endif
-
 /* Allow for selective disabling of enabled debug levels */
 #if DBGLVL_MAX
 int __debug_disable;