summaryrefslogtreecommitdiffstats
path: root/tools/functions.make
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-04-04 21:43:22 +0200
committerThomas Martitz <kugel@rockbox.org>2012-04-04 21:48:19 +0200
commit4b56ee048a950eb8190abec3f8dc8b7a9b6e8946 (patch)
tree5f7275d75c32831531963c6fecf64dbcad250efa /tools/functions.make
parenta54072e2992ad8b6fccdaf8e8062f37c53743be8 (diff)
downloadrockbox-4b56ee048a950eb8190abec3f8dc8b7a9b6e8946.tar.gz
rockbox-4b56ee048a950eb8190abec3f8dc8b7a9b6e8946.tar.bz2
rockbox-4b56ee048a950eb8190abec3f8dc8b7a9b6e8946.zip
Refactor and unify objcopy calls in the build system. Also now properly handles DEBUG builds on hosted targets to keep debug symbols if necessary.
Change-Id: I884031b79c6d49479e4d95752f35ced68872dd5d
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 db7bbe9680..ead62f7b10 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:" \