summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/bitmaps/bitmaps.make2
-rw-r--r--tools/functions.make15
-rw-r--r--tools/root.make2
3 files changed, 17 insertions, 2 deletions
diff --git a/apps/bitmaps/bitmaps.make b/apps/bitmaps/bitmaps.make
index 159c31b64f..a8165b9409 100644
--- a/apps/bitmaps/bitmaps.make
+++ b/apps/bitmaps/bitmaps.make
@@ -25,7 +25,7 @@ ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
25BMP += $(call preprocess, $(BITMAPDIR)/remote_native/SOURCES) 25BMP += $(call preprocess, $(BITMAPDIR)/remote_native/SOURCES)
26endif 26endif
27 27
28BMPOBJ = $(BMP:$(ROOTDIR)/%.bmp=$(BUILDDIR)/%.o) 28BMPOBJ = $(call full_path_subst,$(ROOTDIR)/%.bmp,$(BUILDDIR)/%.o,$(BMP))
29 29
30BMPHFILES = $(BMPINCDIR)/usblogo.h $(BMPINCDIR)/remote_usblogo.h \ 30BMPHFILES = $(BMPINCDIR)/usblogo.h $(BMPINCDIR)/remote_usblogo.h \
31 $(BMPINCDIR)/default_icons.h $(BMPINCDIR)/remote_default_icons.h \ 31 $(BMPINCDIR)/default_icons.h $(BMPINCDIR)/remote_default_icons.h \
diff --git a/tools/functions.make b/tools/functions.make
index 2a26e48bf2..806e1a2f3e 100644
--- a/tools/functions.make
+++ b/tools/functions.make
@@ -73,3 +73,18 @@ ifeq ($(call info),old)
73export info=echo "$$(1)"; 73export info=echo "$$(1)";
74endif 74endif
75 75
76# path substituion can be surprisingly tricky, indeed the following almost
77# always work but not quite:
78# BMPOBJ = $(BMP:$(ROOTDIR)/%.bmp=$(BUILDDIR)/%.o)
79# indeed if
80# ROOTDIR=/rockbox
81# BUILDDIR=/rockbox/build-bla
82# then:
83# /rockbox/apps/bitmaps/rockboxlogo-bla.bmp -> /rockbox/apps/bitmaps/rockbox/build-blalogo.o
84# this function ensure that this type of problems does not occur
85#
86# usage: $(call full_path_subst,patterm,replacement,text)
87#
88# example: $(call full_path_subst,$(ROOTDIR)/%.bmp,$(BUILDDIR)/%.o,$(BMP))
89NO_MATCH=this_string_will_never_match_anything
90full_path_subst=$(patsubst $(NO_MATCH)/%,%, $(patsubst $(NO_MATCH)/$(1), $(2), $(addprefix $(NO_MATCH)/, $(3))))
diff --git a/tools/root.make b/tools/root.make
index 2deae8cc82..c9f4a2eb65 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -157,7 +157,7 @@ endif # CORE_GCSECTIONS
157OBJ := $(SRC:.c=.o) 157OBJ := $(SRC:.c=.o)
158OBJ := $(OBJ:.S=.o) 158OBJ := $(OBJ:.S=.o)
159OBJ += $(BMP:.bmp=.o) 159OBJ += $(BMP:.bmp=.o)
160OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(OBJ)) 160OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(OBJ))
161 161
162build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO) 162build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO)
163 163