|
@@ -523,19 +523,25 @@ POST_O :=
|
523
|
523
|
POST_O_DEPS :=
|
524
|
524
|
endif
|
525
|
525
|
|
|
526
|
+# Debug level calculations
|
|
527
|
+#
|
|
528
|
+DBGLVL_MAX = -DDBGLVL_MAX=$(firstword $(subst ., ,$(1)))
|
|
529
|
+DBGLVL_DFLT = -DDBGLVL_DFLT=$(lastword $(subst ., ,$(1)))
|
|
530
|
+DBGLVL = $(call DBGLVL_MAX,$(1)) $(call DBGLVL_DFLT,$(1))
|
|
531
|
+
|
526
|
532
|
# Rules for specific object types.
|
527
|
533
|
#
|
528
|
534
|
COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
|
529
|
535
|
RULE_c = $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O)
|
530
|
536
|
RULE_c_to_ids.o = $(Q)$(ECHO_E) '$(OBJ_IDS_ASM_NL)' | $(ASSEMBLE_S) -o $@
|
531
|
|
-RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -DDBGLVL_MAX=$* -c $< -o $@ $(POST_O)
|
|
537
|
+RULE_c_to_dbg%.o= $(Q)$(COMPILE_c) $(call DBGLVL,$*) -c $< -o $@ $(POST_O)
|
532
|
538
|
RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
|
533
|
539
|
RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
|
534
|
540
|
|
535
|
541
|
PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
|
536
|
542
|
ASSEMBLE_S = $(AS) $(ASFLAGS)
|
537
|
543
|
RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
|
538
|
|
-RULE_S_to_dbg%.o = $(Q)$(PREPROCESS_S) -DDBGLVL_MAX=$* $< | $(ASSEMBLE_S) -o $@
|
|
544
|
+RULE_S_to_dbg%.o= $(Q)$(PREPROCESS_S) $(call DBGLVL,$*) $< | $(ASSEMBLE_S) -o $@
|
539
|
545
|
RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
|
540
|
546
|
|
541
|
547
|
GENERIC_TARGETS += ids.o dbg%.o c s
|
|
@@ -1019,10 +1025,12 @@ TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) \
|
1019
|
1025
|
# the target.
|
1020
|
1026
|
#
|
1021
|
1027
|
DEBUG_LIST = $(subst $(COMMA), ,$(DEBUG))
|
1022
|
|
-DEBUG_OBJ_LEVEL = $(firstword $(word 2,$(subst :, ,$(1))) 1)
|
1023
|
|
-DEBUG_OBJ_BASE = $(word 1,$(subst :, ,$(1))).dbg$(call DEBUG_OBJ_LEVEL,$(1))
|
1024
|
|
-DEBUG_OBJ = $(BIN)/$(call DEBUG_OBJ_BASE,$(1)).o
|
1025
|
|
-DEBUG_ORIG_OBJ = $(BIN)/$(word 1,$(subst :, ,$(1))).o
|
|
1028
|
+DEBUG_MAX = $(firstword $(word 2,$(subst :, ,$(1))) 1)
|
|
1029
|
+DEBUG_DFLT = $(if $(word 3,$(subst :, ,$(1))),.$(word 3,$(subst :, ,$(1))))
|
|
1030
|
+DEBUG_LEVEL = $(call DEBUG_MAX,$(1))$(call DEBUG_DFLT,$(1))
|
|
1031
|
+DEBUG_BASE = $(firstword $(subst :, ,$(1))).dbg$(call DEBUG_LEVEL,$(1))
|
|
1032
|
+DEBUG_OBJ = $(BIN)/$(call DEBUG_BASE,$(1)).o
|
|
1033
|
+DEBUG_ORIG_OBJ = $(BIN)/$(firstword $(subst :, ,$(1))).o
|
1026
|
1034
|
DEBUG_OBJS = $(foreach D,$(DEBUG_LIST),$(call DEBUG_OBJ,$(D)))
|
1027
|
1035
|
DEBUG_ORIG_OBJS = $(foreach D,$(DEBUG_LIST),$(call DEBUG_ORIG_OBJ,$(D)))
|
1028
|
1036
|
BLIB_OBJS = $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS))
|