Просмотр исходного кода

[build] Allow for a debug level of zero

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>
tags/v1.20.1
Michael Brown 10 лет назад
Родитель
Сommit
4413ab4f5a
2 измененных файлов: 4 добавлений и 17 удалений
  1. 2
    2
      src/Makefile.housekeeping
  2. 2
    15
      src/include/compiler.h

+ 2
- 2
src/Makefile.housekeeping Просмотреть файл

@@ -533,14 +533,14 @@ endif
533 533
 #
534 534
 COMPILE_c	= $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
535 535
 RULE_c		= $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O)
536
-RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(subst -,_,$(OBJECT))=$* -c $< -o $@ $(POST_O)
536
+RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -DDBGLVL_MAX=$* -c $< -o $@ $(POST_O)
537 537
 RULE_c_to_c	= $(Q)$(COMPILE_c) -E -c $< > $@
538 538
 RULE_c_to_s	= $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
539 539
 
540 540
 PREPROCESS_S	= $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
541 541
 ASSEMBLE_S	= $(AS) $(ASFLAGS)
542 542
 RULE_S		= $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
543
-RULE_S_to_dbg%.o = $(Q)$(PREPROCESS_S) -Ddebug_$(subst -,_,$(OBJECT))=$* $< | $(ASSEMBLE_S) -o $@
543
+RULE_S_to_dbg%.o = $(Q)$(PREPROCESS_S) -DDBGLVL_MAX=$* $< | $(ASSEMBLE_S) -o $@
544 544
 RULE_S_to_s	= $(Q)$(PREPROCESS_S) $< > $@
545 545
 
546 546
 DEBUG_TARGETS	+= dbg%.o c s

+ 2
- 15
src/include/compiler.h Просмотреть файл

@@ -250,16 +250,9 @@ REQUEST_EXPANDED ( CONFIG_SYMBOL );
250 250
  *
251 251
  */
252 252
 
253
-/*
254
- * If debug_OBJECT is set to a true value, the macro DBG(...) will
255
- * expand to printf(...) when compiling OBJECT, and the symbol
256
- * DEBUG_LEVEL will be inserted into the object file.
257
- *
258
- */
259
-#define DEBUG_SYMBOL PREFIX_OBJECT ( debug_ )
260
-
261
-#if DEBUG_SYMBOL == 0
253
+#ifndef DBGLVL_MAX
262 254
 #define NDEBUG
255
+#define DBGLVL_MAX 0
263 256
 #endif
264 257
 
265 258
 #ifndef ASSEMBLY
@@ -276,12 +269,6 @@ extern void dbg_md5_da ( unsigned long dispaddr,
276 269
 extern void dbg_pause ( void );
277 270
 extern void dbg_more ( void );
278 271
 
279
-#if DEBUG_SYMBOL
280
-#define DBGLVL_MAX DEBUG_SYMBOL
281
-#else
282
-#define DBGLVL_MAX 0
283
-#endif
284
-
285 272
 /* Allow for selective disabling of enabled debug levels */
286 273
 #if DBGLVL_MAX
287 274
 int __debug_disable;

Загрузка…
Отмена
Сохранить