summaryrefslogtreecommitdiff
path: root/apps
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
parentce1c189d509b1b88044f9821fa36f2461af07219 (diff)
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')
-rw-r--r--apps/plugins/chessbox/archos.lds44
-rw-r--r--apps/plugins/chessbox/chessbox.make22
-rw-r--r--apps/plugins/goban/archos.lds43
-rw-r--r--apps/plugins/goban/goban.make22
-rw-r--r--apps/plugins/plugin.lds5
-rw-r--r--apps/plugins/plugins.make37
-rw-r--r--apps/plugins/rockboy/archos.lds44
-rw-r--r--apps/plugins/rockboy/rockboy.make22
-rw-r--r--apps/plugins/zxbox/archos.lds44
-rw-r--r--apps/plugins/zxbox/zxbox.make24
10 files changed, 71 insertions, 236 deletions
diff --git a/apps/plugins/chessbox/archos.lds b/apps/plugins/chessbox/archos.lds
deleted file mode 100644
index a419fce0bc..0000000000
--- a/apps/plugins/chessbox/archos.lds
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "config.h"
-
-/* linker script for chessbox as an overlay,
- * only used/ necessary for SH-based archos targets */
-
-OUTPUT_FORMAT(elf32-sh)
-
-#define DRAMORIG 0x09000000
-#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
-
-#define OVERLAY_LENGTH 0x30000
-#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)
-
-MEMORY
-{
- OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH
-}
-
-SECTIONS
-{
- .header : {
- _plugin_start_addr = .;
- KEEP(*(.header))
- } > OVERLAY_RAM
-
- .text : {
- *(.text*)
- } > OVERLAY_RAM
-
- .rodata : {
- *(.rodata*)
- } > OVERLAY_RAM
-
- .data : {
- *(.data*)
- } > OVERLAY_RAM
-
- .bss : {
- *(.bss*)
- *(COMMON)
- . = ALIGN(0x4);
- _plugin_end_addr = .;
- } > OVERLAY_RAM
-}
diff --git a/apps/plugins/chessbox/chessbox.make b/apps/plugins/chessbox/chessbox.make
index 220f0839e3..43df3ab264 100644
--- a/apps/plugins/chessbox/chessbox.make
+++ b/apps/plugins/chessbox/chessbox.make
@@ -17,20 +17,17 @@ OTHER_SRC += $(CHESSBOX_SRC)
ifndef SIMVER
ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
- ## archos recorder targets
- CHESSBOX_INLDS := $(CHESSBOX_SRCDIR)/archos.lds
+ ### lowmem targets
ROCKS += $(CHESSBOX_OBJDIR)/chessbox.ovl
+ CHESSBOX_OUTLDS = $(CHESSBOX_OBJDIR)/chessbox.link
+ CHESSBOX_OVLFLAGS = -T$(CHESSBOX_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
else
### all other targets
- CHESSBOX_INLDS := $(APPSDIR)/plugins/plugin.lds
ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock
endif
- CHESSBOX_OVLFLAGS = -T$(CHESSBOX_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
- CHESSBOX_OUTLDS = $(CHESSBOX_OBJDIR)/chessbox.lds
else
### simulator
ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock
- CHESSBOX_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
endif
ifeq ($(CPU),sh)
@@ -40,15 +37,18 @@ else
CHESSBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2
endif
-$(CHESSBOX_OUTLDS): $(CHESSBOX_INLDS) $(CHESSBOX_OBJ)
- $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+$(CHESSBOX_OBJDIR)/chessbox.rock: $(CHESSBOX_OBJ)
+
+$(CHESSBOX_OBJDIR)/chessbox.refmap: $(CHESSBOX_OBJ)
-$(CHESSBOX_OBJDIR)/chessbox.rock: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS) $(PLUGINBITMAPLIB)
+$(CHESSBOX_OUTLDS): $(PLUGIN_LDS) $(CHESSBOX_OBJDIR)/chessbox.refmap
+ $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
+ $(TOOLSDIR)/ovl_offset.pl $(CHESSBOX_OBJDIR)/chessbox.refmap))
-$(CHESSBOX_OBJDIR)/chessbox.ovl: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS) $(PLUGINBITMAPLIB)
+$(CHESSBOX_OBJDIR)/chessbox.ovl: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS)
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
$(filter %.o, $^) \
- $(filter %.a, $^) \
+ $(filter %.a, $+) \
-lgcc $(CHESSBOX_OVLFLAGS)
$(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@
diff --git a/apps/plugins/goban/archos.lds b/apps/plugins/goban/archos.lds
deleted file mode 100644
index c17346ff0b..0000000000
--- a/apps/plugins/goban/archos.lds
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "config.h"
-
-/* linker script for goban as an overlay */
-
-OUTPUT_FORMAT(elf32-sh)
-
-#define DRAMORIG 0x09000000
-#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
-
-#define OVERLAY_LENGTH 0x10000
-#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)
-
-MEMORY
-{
- OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH
-}
-
-SECTIONS
-{
- .header : {
- _plugin_start_addr = .;
- KEEP(*(.header))
- } > OVERLAY_RAM
-
- .text : {
- *(.text*)
- } > OVERLAY_RAM
-
- .rodata : {
- *(.rodata*)
- } > OVERLAY_RAM
-
- .data : {
- *(.data*)
- } > OVERLAY_RAM
-
- .bss : {
- *(.bss*)
- *(COMMON)
- . = ALIGN(0x4);
- _plugin_end_addr = .;
- } > OVERLAY_RAM
-}
diff --git a/apps/plugins/goban/goban.make b/apps/plugins/goban/goban.make
index b8866fbc4f..03f2276659 100644
--- a/apps/plugins/goban/goban.make
+++ b/apps/plugins/goban/goban.make
@@ -7,7 +7,6 @@
# $Id$
#
-
GOBAN_SRCDIR := $(APPSDIR)/plugins/goban
GOBAN_BUILDDIR := $(BUILDDIR)/apps/plugins/goban
@@ -18,31 +17,30 @@ OTHER_SRC += $(GOBAN_SRC)
ifndef SIMVER
ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
- ### archos recorder targets
- GOBAN_INLDS := $(GOBAN_SRCDIR)/archos.lds
+ ### lowmem targets
ROCKS += $(GOBAN_BUILDDIR)/goban.ovl
+ GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.link
+ GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
else
### all other targets
- GOBAN_INLDS := $(APPSDIR)/plugins/plugin.lds
ROCKS += $(GOBAN_BUILDDIR)/goban.rock
endif
- GOBAN_OVLFLAGS = -T$(GOBAN_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
- GOBAN_OUTLDS = $(GOBAN_BUILDDIR)/goban.lds
else
### simulator
ROCKS += $(GOBAN_BUILDDIR)/goban.rock
- GOBAN_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
endif
-$(GOBAN_OUTLDS): $(GOBAN_INLDS) $(GOBAN_OBJ)
- $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+$(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ)
-$(GOBAN_BUILDDIR)/goban.rock: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
+$(GOBAN_BUILDDIR)/goban.refmap: $(GOBAN_OBJ)
+
+$(GOBAN_OUTLDS): $(PLUGIN_LDS) $(GOBAN_BUILDDIR)/goban.refmap
+ $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
+ $(TOOLSDIR)/ovl_offset.pl $(GOBAN_BUILDDIR)/goban.refmap))
$(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
$(filter %.o, $^) \
- $(filter %.a, $^) \
+ $(filter %.a, $+) \
-lgcc $(GOBAN_OVLFLAGS)
$(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@
-
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index ccf60100bf..e7ed9b1844 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -125,7 +125,10 @@ OUTPUT_FORMAT(elf32-littlemips)
#ifdef CODEC
#define THIS_LENGTH CODEC_SIZE
#define THIS_ORIGIN CODEC_ORIGIN
-#else
+#elif defined OVERLAY_OFFSET
+#define THIS_LENGTH (DRAMSIZE - OVERLAY_OFFSET)
+#define THIS_ORIGIN (DRAMORIG + OVERLAY_OFFSET)
+#else /* plugin */
#define THIS_LENGTH PLUGIN_LENGTH
#define THIS_ORIGIN PLUGIN_ORIGIN
#endif
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)
diff --git a/apps/plugins/rockboy/archos.lds b/apps/plugins/rockboy/archos.lds
deleted file mode 100644
index fcc3e6f922..0000000000
--- a/apps/plugins/rockboy/archos.lds
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "config.h"
-
-/* linker script for rockboy as an overlay,
- * only used/ necessary for SH-based archos targets */
-
-OUTPUT_FORMAT(elf32-sh)
-
-#define DRAMORIG 0x09000000
-#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
-
-#define OVERLAY_LENGTH 0x68000
-#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)
-
-MEMORY
-{
- OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH
-}
-
-SECTIONS
-{
- .header : {
- _plugin_start_addr = .;
- KEEP(*(.header))
- } > OVERLAY_RAM
-
- .text : {
- *(.text*)
- } > OVERLAY_RAM
-
- .rodata : {
- *(.rodata*)
- } > OVERLAY_RAM
-
- .data : {
- *(.data*)
- } > OVERLAY_RAM
-
- .bss : {
- *(.bss*)
- *(COMMON)
- . = ALIGN(0x4);
- _plugin_end_addr = .;
- } > OVERLAY_RAM
-}
diff --git a/apps/plugins/rockboy/rockboy.make b/apps/plugins/rockboy/rockboy.make
index bce549c43c..ca0ed17a0a 100644
--- a/apps/plugins/rockboy/rockboy.make
+++ b/apps/plugins/rockboy/rockboy.make
@@ -18,30 +18,30 @@ OTHER_SRC += $(ROCKBOY_SRC)
ifndef SIMVER
ifneq (,$(findstring RECORDER,$(TARGET)))
- ## archos recorder targets
- ROCKBOY_INLDS := $(ROCKBOY_SRCDIR)/archos.lds
+ ## lowmem targets
ROCKS += $(ROCKBOY_OBJDIR)/rockboy.ovl
+ ROCKBOY_OUTLDS = $(ROCKBOY_OBJDIR)/rockboy.link
+ ROCKBOY_OVLFLAGS = -T$(ROCKBOY_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
else
### all other targets
- ROCKBOY_INLDS := $(APPSDIR)/plugins/plugin.lds
ROCKS += $(ROCKBOY_OBJDIR)/rockboy.rock
endif
- ROCKBOY_OVLFLAGS = -T$(ROCKBOY_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
- ROCKBOY_OUTLDS = $(ROCKBOY_OBJDIR)/rockboy.lds
else
### simulator
ROCKS += $(ROCKBOY_OBJDIR)/rockboy.rock
- ROCKBOY_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
endif
-$(ROCKBOY_OUTLDS): $(ROCKBOY_INLDS) $(ROCKBOY_OBJ)
- $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+$(ROCKBOY_OBJDIR)/rockboy.rock: $(ROCKBOY_OBJ)
+
+$(ROCKBOY_OBJDIR)/rockboy.refmap: $(ROCKBOY_OBJ)
-$(ROCKBOY_OBJDIR)/rockboy.rock: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS) $(PLUGINBITMAPLIB)
+$(ROCKBOY_OUTLDS): $(PLUGIN_LDS) $(ROCKBOY_OBJDIR)/rockboy.refmap
+ $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
+ $(TOOLSDIR)/ovl_offset.pl $(ROCKBOY_OBJDIR)/rockboy.refmap))
-$(ROCKBOY_OBJDIR)/rockboy.ovl: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS) $(PLUGINBITMAPLIB)
+$(ROCKBOY_OBJDIR)/rockboy.ovl: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS)
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
$(filter %.o, $^) \
- $(filter %.a, $^) \
+ $(filter %.a, $+) \
-lgcc $(ROCKBOY_OVLFLAGS)
$(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@
diff --git a/apps/plugins/zxbox/archos.lds b/apps/plugins/zxbox/archos.lds
deleted file mode 100644
index 5b4db7dc3e..0000000000
--- a/apps/plugins/zxbox/archos.lds
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "config.h"
-
-/* linker script for zxbox as an overlay,
- * only used/ necessary for SH-based archos targets */
-
-OUTPUT_FORMAT(elf32-sh)
-
-#define DRAMORIG 0x09000000
-#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
-
-#define OVERLAY_LENGTH 0x48000
-#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)
-
-MEMORY
-{
- OVERLAY_RAM : ORIGIN = OVERLAY_ORIGIN, LENGTH = OVERLAY_LENGTH
-}
-
-SECTIONS
-{
- .header : {
- _plugin_start_addr = .;
- KEEP(*(.header))
- } > OVERLAY_RAM
-
- .text : {
- *(.text*)
- } > OVERLAY_RAM
-
- .rodata : {
- *(.rodata*)
- } > OVERLAY_RAM
-
- .data : {
- *(.data*)
- } > OVERLAY_RAM
-
- .bss : {
- *(.bss*)
- *(COMMON)
- . = ALIGN(0x4);
- _plugin_end_addr = .;
- } > OVERLAY_RAM
-}
diff --git a/apps/plugins/zxbox/zxbox.make b/apps/plugins/zxbox/zxbox.make
index 6f6d1ab693..24f8e91f20 100644
--- a/apps/plugins/zxbox/zxbox.make
+++ b/apps/plugins/zxbox/zxbox.make
@@ -17,12 +17,12 @@ OTHER_SRC += $(ZXBOX_SRC)
ifndef SIMVER
ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
- ## archos recorder targets
- ZXBOX_INLDS := $(ZXBOX_SRCDIR)/archos.lds
+ ## lowmem targets
ROCKS += $(ZXBOX_OBJDIR)/zxbox.ovl
+ ZXBOX_OUTLDS = $(ZXBOX_OBJDIR)/zxbox.link
+ ZXBOX_LDFLAGS = -T$(ZXBOX_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
else
### all other targets
- ZXBOX_INLDS := $(APPSDIR)/plugins/plugin.lds
ROCKS += $(ZXBOX_OBJDIR)/zxbox.rock
endif
else
@@ -32,22 +32,18 @@ endif
ZXBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O3 -funroll-loops
-ifdef SIMVER
- ZXBOX_LDFLAGS = $(SHARED_FLAG) # <-- from Makefile
-else
- ZXBOX_OUTLDS = $(ZXBOX_OBJDIR)/zxbox.lds
- ZXBOX_LDFLAGS = -T$(ZXBOX_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
-endif
+$(ZXBOX_OBJDIR)/zxbox.rock: $(ZXBOX_OBJ)
-$(ZXBOX_OUTLDS): $(ZXBOX_INLDS) $(ZXBOX_OBJ)
- $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+$(ZXBOX_OBJDIR)/zxbox.refmap: $(ZXBOX_OBJ)
-$(ZXBOX_OBJDIR)/zxbox.rock: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS) $(PLUGINBITMAPLIB)
+$(ZXBOX_OUTLDS): $(PLUGIN_LDS) $(ZXBOX_OBJDIR)/zxbox.refmap
+ $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
+ $(TOOLSDIR)/ovl_offset.pl $(ZXBOX_OBJDIR)/zxbox.refmap))
-$(ZXBOX_OBJDIR)/zxbox.ovl: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS) $(PLUGINBITMAPLIB) $(PLUGINLIB)
+$(ZXBOX_OBJDIR)/zxbox.ovl: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS)
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
$(filter %.o, $^) \
- $(filter %.a, $^) \
+ $(filter %.a, $+) \
-lgcc $(ZXBOX_LDFLAGS)
$(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@