summaryrefslogtreecommitdiff
path: root/tools/functions.make
diff options
context:
space:
mode:
Diffstat (limited to 'tools/functions.make')
-rw-r--r--tools/functions.make14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/functions.make b/tools/functions.make
index db7bbe9..ead62f7 100644
--- a/tools/functions.make
+++ b/tools/functions.make
@@ -28,6 +28,20 @@ c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
a2lnk = $(patsubst lib%.a,-l%,$(notdir $(1)))
+# objcopy wrapper that keeps debug symbols in DEBUG builds
+# handles the $(1) == $(2) case too
+ifndef APP_TYPE
+objcopy = $(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $(1) $(2) # objcopy native
+else ifneq (,$(findstring sdl-sim,$(APP_TYPE)))
+objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy simulator
+else
+ ifdef DEBUG
+ objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy hosted (DEBUG)
+ else
+ objcopy = $(OC) -S -x $(1) $(2) # objcopy hosted (!DEBUG)
+ endif
+endif
+
# calculate dependencies for a list of source files $(2) and output them to $(1)
mkdepfile = $(SILENT)perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \
sed -e "s: lang.h: lang/lang.h:" \