summaryrefslogtreecommitdiffstats
path: root/apps/plugins/plugins.make
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-03-02 00:16:44 +0000
committerJens Arnold <amiconn@rockbox.org>2009-03-02 00:16:44 +0000
commitc21e2e686fce7a7df5a933fd3bf06aa20e66c78b (patch)
tree483500a54064c878fd12196ca7fd1fad1177c064 /apps/plugins/plugins.make
parentce1c189d509b1b88044f9821fa36f2461af07219 (diff)
downloadrockbox-c21e2e686fce7a7df5a933fd3bf06aa20e66c78b.tar.gz
rockbox-c21e2e686fce7a7df5a933fd3bf06aa20e66c78b.tar.bz2
rockbox-c21e2e686fce7a7df5a933fd3bf06aa20e66c78b.zip
Calculate the optimal memory location for overlay plugins, and use plugin.lds for linking them. This gets rid of hand-adjusted archos.lds, making it easy to use overlay plugins on other lowmem targets. * Fix some duplicate and incorrect dependencies. * Change the way libs are filtered, so that a lib can be specified more than once. This allows to get rid of explicitly linking gcc-support.o, fixing empty plugins on some simulator platforms.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20163 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/plugins.make')
-rw-r--r--apps/plugins/plugins.make37
1 files changed, 25 insertions, 12 deletions
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
index 7314888eed..8be87b94c1 100644
--- a/apps/plugins/plugins.make
+++ b/apps/plugins/plugins.make
@@ -26,24 +26,25 @@ PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
-# multifile plugins (subdirs):
-PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
-
-# include <dir>.make from each subdir (yay!)
-$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
-
### build data / rules
ifndef SIMVER
PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
+OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link
endif
+# multifile plugins (subdirs):
+PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
+
+# include <dir>.make from each subdir (yay!)
+$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
+
OTHER_INC += -I$(APPSDIR)/plugins -I$(APPSDIR)/plugins/lib
# special compile flags for plugins:
-PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
+PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
-$(ROCKS): $(PLUGINLIB) $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINBITMAPLIB)
+$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
$(PLUGINLIB): $(PLUGINLIB_OBJ)
$(SILENT)$(shell rm -f $@)
@@ -54,11 +55,16 @@ $(PLUGINLINK_LDS): $(PLUGIN_LDS)
$(shell mkdir -p $(dir $@))
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
+$(OVERLAYREF_LDS): $(PLUGIN_LDS)
+ $(call PRINTS,PP $(@F))
+ $(shell mkdir -p $(dir $@))
+ $(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=0)
+
$(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
$(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
# special dependencies
-$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a
+$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a $(PLUGINLIB)
# special pattern rule for compiling plugin lib (with -ffunction-sections)
$(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
@@ -74,15 +80,22 @@ ifdef SIMVER
PLUGINLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
else
PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
+ OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
endif
-$(BUILDDIR)/%.rock: $(GCCSUPPORT_OBJ) $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
+$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
$(filter %.o, $^) \
- $(filter %.a, $^) \
+ $(filter %.a, $+) \
-lgcc $(PLUGINLDFLAGS)
ifdef SIMVER
$(SILENT)cp $(BUILDDIR)/$*.elf $@
else
$(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@
-endif \ No newline at end of file
+endif
+
+$(BUILDDIR)/%.refmap: $(BUILDDIR)/%.o $(OVERLAYREF_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
+ $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(OVERLAYLDFLAGS)