diff --git a/android/android.make b/android/android.make
index f18b3f958e..dfbc64ef6e 100644
--- a/android/android.make
+++ b/android/android.make
@@ -114,7 +114,7 @@ dex: $(DEX)
classes: $(R_OBJ) $(JAVA_OBJ)
-$(BUILDDIR)/$(BINARY): $$(OBJ) $(VOICESPEEXLIB) $(FIRMLIB) $(RBCODEC_LIB) $(SKINLIB) $(UNWARMINDER) $(CPUFEAT_BUILD)/cpu-features.o
+$(BUILDDIR)/$(BINARY): $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $(CPUFEAT_BUILD)/cpu-features.o
$(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
$(call PRINTS,OC $(@F))$(OC) -S -x $@
diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make
index 55002b229b..37713015ad 100644
--- a/apps/codecs/codecs.make
+++ b/apps/codecs/codecs.make
@@ -21,6 +21,9 @@ include $(APPSDIR)/codecs/lib/tlsf/libtlsf.make
include $(APPSDIR)/codecs/lib/libcodec.make
OTHER_INC += -I$(APPSDIR)/codecs/lib
+# extra libraries
+CODEC_LIBS := $(EXTRA_LIBS) $(TLSFLIB) $(CODECLIB)
+
# the codec libraries
include $(APPSDIR)/codecs/demac/libdemac.make
include $(APPSDIR)/codecs/liba52/liba52.make
@@ -135,7 +138,7 @@ $(CODECDIR)/spc.codec : $(CODECDIR)/libspc.a
$(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a
$(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a
$(CODECDIR)/flac.codec : $(CODECDIR)/libffmpegFLAC.a
-$(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a $(TLSFLIB)
+$(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a
$(CODECDIR)/speex.codec : $(CODECDIR)/libspeex.a
$(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a
$(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.a
@@ -168,10 +171,7 @@ $(CODECDIR)/sgc.codec : $(CODECDIR)/libsgc.a $(CODECDIR)/libemu2413.a
$(CODECDIR)/vgm.codec : $(CODECDIR)/libvgm.a $(CODECDIR)/libemu2413.a
$(CODECDIR)/kss.codec : $(CODECDIR)/libkss.a $(CODECDIR)/libemu2413.a
-$(CODECS): $(CODECLIB) # this must be last in codec dependency list
-
-# libfaad and libmusepack both contain a huffman.h file, with different
-# content. So we compile them with special command lines:
+$(CODECS): $(CODEC_LIBS) # this must be last in codec dependency list
# pattern rule for compiling codecs
$(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.c
@@ -194,14 +194,13 @@ else
endif
CODECLDFLAGS += $(GLOBAL_LDOPTS)
-$(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECLIB)
+$(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECS_LIBS)
$(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \
$(filter %.o, $^) \
- $(filter-out $(CODECLIB),$(filter %.a, $+)) \
- $(CODECLIB) \
+ $(filter-out $(CODECLIB),$(filter %.a, $+)) $(CODECLIB) \
-lgcc $(subst .map,-pre.map,$(CODECLDFLAGS))
-$(CODECDIR)/%.codec: $(CODECDIR)/%.o $(LIBSETJMP) $(LIBARMSUPPORT)
+$(CODECDIR)/%.codec: $(CODECDIR)/%.o
$(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \
$(filter %.o, $^) \
$(filter %.a, $+) \
diff --git a/apps/plugins/imageviewer/imageviewer.make b/apps/plugins/imageviewer/imageviewer.make
index 76cc3e266d..7f7d94320a 100644
--- a/apps/plugins/imageviewer/imageviewer.make
+++ b/apps/plugins/imageviewer/imageviewer.make
@@ -47,7 +47,7 @@ else
endif
# rule to create reference map for image decoder
-$(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(LIBARMSUPPORT) $(PLUGINLIB) $(PLUGINBITMAPLIB)
+$(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS)
$(call PRINTS,LD $(@F))$(CC) $(IMGDECFLAGS) -o /dev/null \
$(filter %.o, $^) \
$(filter %.a, $+) \
diff --git a/apps/plugins/mikmod/mikmod.make b/apps/plugins/mikmod/mikmod.make
index c975e1e5c7..38a95c3695 100644
--- a/apps/plugins/mikmod/mikmod.make
+++ b/apps/plugins/mikmod/mikmod.make
@@ -20,7 +20,7 @@ OTHER_SRC += $(MIKMOD_SRC)
MIKMODCFLAGS = $(PLUGINFLAGS) -I$(MIKMODSRCDIR) -O2
-$(MIKMODBUILDDIR)/mikmod.rock: $(MIKMOD_OBJ) $(CODECDIR)/libtlsf.a
+$(MIKMODBUILDDIR)/mikmod.rock: $(MIKMOD_OBJ)
# new rule needed to use extra compile flags
$(MIKMODBUILDDIR)/%.o: $(MIKMODSRCDIR)/%.c
diff --git a/apps/plugins/pdbox/pdbox.make b/apps/plugins/pdbox/pdbox.make
index 0e40232321..239e1c0852 100644
--- a/apps/plugins/pdbox/pdbox.make
+++ b/apps/plugins/pdbox/pdbox.make
@@ -18,7 +18,7 @@ PDBOX_OBJ := $(call c2obj, $(PDBOX_SRC))
# add source files to OTHERSRC to get automatic dependencies
OTHER_SRC += $(PDBOX_SRC)
-$(PDBOXBUILDDIR)/pdbox.rock: $(PDBOX_OBJ) $(MPEG_OBJ) $(CODECDIR)/libtlsf.a
+$(PDBOXBUILDDIR)/pdbox.rock: $(PDBOX_OBJ) $(MPEG_OBJ)
PDBOXFLAGS = $(PLUGINFLAGS) -fno-strict-aliasing
PDBOXLDFLAGS = $(PLUGINLDFLAGS)
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
index 272b1b8e93..3ea6d96432 100644
--- a/apps/plugins/plugins.make
+++ b/apps/plugins/plugins.make
@@ -53,6 +53,8 @@ else
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
endif
+PLUGIN_LIBS := $(EXTRA_LIBS) $(TLSFLIB) $(PLUGINLIB) $(PLUGINBITMAPLIB)
+
# include
.make from each subdir (yay!)
$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
@@ -65,7 +67,7 @@ PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
$(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
# dependency for all plugins
-$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(LIBARMSUPPORT) $(PLUGINLIB) $(PLUGINBITMAPLIB) $(PLUGIN_CRT0) $(LIBSETJMP)
+$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS) $(PLUGIN_CRT0)
$(PLUGINLIB): $(PLUGINLIB_OBJ)
$(SILENT)$(shell rm -f $@)
@@ -85,7 +87,7 @@ $(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 $(PLUGINLIB)
+$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a $(PLUGIN_LIBS)
# Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
ifeq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
@@ -129,7 +131,7 @@ endif
$(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/
-$(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(LIBARMSUPPORT) $(PLUGINLIB) $(PLUGINBITMAPLIB) $(LIBSETJMP) $(PLUGIN_CRT0)
+$(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGIN_LIBS)
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
$(filter %.o, $^) \
$(filter %.a, $+) \
diff --git a/firmware/target/hosted/ypr0/ypr0.make b/firmware/target/hosted/ypr0/ypr0.make
index d74b9058f5..68f53902ad 100644
--- a/firmware/target/hosted/ypr0/ypr0.make
+++ b/firmware/target/hosted/ypr0/ypr0.make
@@ -13,13 +13,11 @@ SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS)
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
-
-$(BUILDDIR)/rockbox.elf : $$(OBJ) $$(RBCODEC_LIB) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(UNWARMINDER)
+$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \
- $(RBCODEC_LIB) \
- -L$(BUILDDIR)/apps/codecs $(VOICESPEEXLIB:lib%.a=-l%) \
- -L$(BUILDDIR)/lib -lskin_parser \
+ -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
+ -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \
$(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
$(BUILDDIR)/rockbox : $(BUILDDIR)/rockbox.elf
diff --git a/lib/arm_support/arm_support.make b/lib/arm_support/arm_support.make
index a3775ee3b0..054d723e62 100644
--- a/lib/arm_support/arm_support.make
+++ b/lib/arm_support/arm_support.make
@@ -6,14 +6,16 @@
# \/ \/ \/ \/ \/
#
-ARMSUPPORT_DIR = $(ROOTDIR)/lib/arm_support
-ARMSUPPORT_SRC = $(ARMSUPPORT_DIR)/support-arm.S
-ARMSUPPORT_OBJ := $(call c2obj, $(ARMSUPPORT_SRC))
+ARMSUPPORTLIB_DIR := $(ROOTDIR)/lib/arm_support
+ARMSUPPORTLIB_SRC := $(ARMSUPPORTLIB_DIR)/support-arm.S
+ARMSUPPORTLIB_OBJ := $(call c2obj, $(ARMSUPPORTLIB_SRC))
+ARMSUPPORTLIB := $(BUILDDIR)/lib/libarm_support.a
-OTHER_SRC += $(ARMSUPPORT_SRC)
+OTHER_SRC += $(ARMSUPPORTLIB_SRC)
+# both core and plugins link this
+CORE_LIBS += $(ARMSUPPORTLIB)
+PLUGIN_LIBS += $(ARMSUPPORTLIB)
-LIBARMSUPPORT := $(BUILDDIR)/lib/libarm_support.a
-
-$(LIBARMSUPPORT): $(ARMSUPPORT_OBJ)
+$(ARMSUPPORTLIB): $(ARMSUPPORTLIB_OBJ)
$(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/lib/libsetjmp/libsetjmp.make b/lib/libsetjmp/libsetjmp.make
index b7d4cad25f..f8df7513c9 100644
--- a/lib/libsetjmp/libsetjmp.make
+++ b/lib/libsetjmp/libsetjmp.make
@@ -6,16 +6,16 @@
# \/ \/ \/ \/ \/
#
-SETJMP_DIR = $(ROOTDIR)/lib/libsetjmp
-SETJMP_SRC = $(call preprocess, $(SETJMP_DIR)/SOURCES)
-SETJMP_OBJ := $(call c2obj, $(SETJMP_SRC))
+SETJMPLIB_DIR = $(ROOTDIR)/lib/libsetjmp
+SETJMPLIB_SRC = $(call preprocess, $(SETJMPLIB_DIR)/SOURCES)
+SETJMPLIB_OBJ := $(call c2obj, $(SETJMPLIB_SRC))
-OTHER_SRC += $(SETJMP_SRC)
+SETJMPLIB = $(BUILDDIR)/lib/libsetjmp.a
-LIBSETJMP = $(BUILDDIR)/lib/libsetjmp.a
+INCLUDES += -I$(SETJMPLIB_DIR)
+OTHER_SRC += $(SETJMPLIB_SRC)
+EXTRA_LIBS += $(SETJMPLIB)
-INCLUDES += -I$(SETJMP_DIR)
-
-$(LIBSETJMP): $(SETJMP_OBJ)
+$(SETJMPLIB): $(SETJMPLIB_OBJ)
$(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/lib/rbcodec/rbcodec.make b/lib/rbcodec/rbcodec.make
index afa289ba28..cd669d22c9 100644
--- a/lib/rbcodec/rbcodec.make
+++ b/lib/rbcodec/rbcodec.make
@@ -5,15 +5,15 @@
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
-RBCODEC_LIB = $(RBCODEC_BLD)/librbcodec.a
-RBCODEC_SRC := $(call preprocess, $(RBCODEC_DIR)/SOURCES)
-RBCODEC_OBJ := $(call c2obj, $(RBCODEC_SRC))
-INCLUDES += -I$(RBCODEC_DIR) -I$(RBCODEC_DIR)/dsp -I$(RBCODEC_DIR)/metadata
-OTHER_SRC += $(RBCODEC_SRC)
+# RBCODEC_BLD is defined in the calling Makefile
+RBCODECLIB_DIR := $(ROOTDIR)/lib/rbcodec
+RBCODECLIB_SRC := $(call preprocess, $(RBCODECLIB_DIR)/SOURCES)
+RBCODECLIB_OBJ := $(call c2obj, $(RBCODECLIB_SRC))
+RBCODECLIB := $(BUILDDIR)/lib/librbcodec.a
-$(RBCODEC_BLD)/%.o: $(RBCODEC_DIR)/%.c
- $(SILENT)mkdir -p $(dir $@)
- $(call PRINTS,CC $<)$(CC) $(CFLAGS) $(RBCODEC_CFLAGS) -c $< -o $@
+INCLUDES += -I$(RBCODECLIB_DIR) -I$(RBCODECLIB_DIR)/dsp -I$(RBCODECLIB_DIR)/metadata
+OTHER_SRC += $(RBCODECLIB_SRC)
+CORE_LIBS += $(RBCODECLIB)
-$(RBCODEC_LIB): $(RBCODEC_OBJ)
+$(RBCODECLIB): $(RBCODECLIB_OBJ)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/lib/skin_parser/skin_parser.make b/lib/skin_parser/skin_parser.make
index 0be85f3e58..42104a2822 100644
--- a/lib/skin_parser/skin_parser.make
+++ b/lib/skin_parser/skin_parser.make
@@ -5,16 +5,16 @@
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
#
-SKINP_DIR = $(ROOTDIR)/lib/skin_parser
-SKINP_SRC = $(call preprocess, $(SKINP_DIR)/SOURCES)
-SKINP_OBJ := $(call c2obj, $(SKINP_SRC))
+SKINPARSLIB_DIR = $(ROOTDIR)/lib/skin_parser
+SKINPARSLIB_SRC = $(call preprocess, $(SKINPARSLIB_DIR)/SOURCES)
+SKINPARSLIB_OBJ := $(call c2obj, $(SKINPARSLIB_SRC))
-OTHER_SRC += $(SKINP_SRC)
+SKINPARSLIB = $(BUILDDIR)/lib/libskin_parser.a
-SKINLIB = $(BUILDDIR)/lib/libskin_parser.a
+INCLUDES += -I$(SKINPARSLIB_DIR)
+OTHER_SRC += $(SKINPARSLIB_SRC)
+CORE_LIBS += $(SKINPARSLIB)
-INCLUDES += -I$(SKINP_DIR)
-
-$(SKINLIB): $(SKINP_OBJ)
+$(SKINPARSLIB): $(SKINPARSLIB_OBJ)
$(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/lib/unwarminder/unwarminder.make b/lib/unwarminder/unwarminder.make
index f570d49640..5093156f54 100644
--- a/lib/unwarminder/unwarminder.make
+++ b/lib/unwarminder/unwarminder.make
@@ -6,16 +6,17 @@
# \/ \/ \/ \/ \/
#
-UNWARM_DIR = $(ROOTDIR)/lib/unwarminder
-UNWARM_SRC = $(call preprocess, $(UNWARM_DIR)/SOURCES)
-UNWARM_OBJ := $(call c2obj, $(UNWARM_SRC))
+UNWARMLIB_DIR = $(ROOTDIR)/lib/unwarminder
+UNWARMLIB_SRC = $(call preprocess, $(UNWARMLIB_DIR)/SOURCES)
+UNWARMLIB_OBJ := $(call c2obj, $(UNWARMLIB_SRC))
-OTHER_SRC += $(UNWARM_SRC)
+OTHER_SRC += $(UNWARMLIB_SRC)
-UNWARMINDER = $(BUILDDIR)/lib/libunwarminder.a
+UNWARMLIB = $(BUILDDIR)/lib/libunwarminder.a
+CORE_LIBS += $(UNWARMLIB)
-INCLUDES += -I$(UNWARM_DIR)
+INCLUDES += -I$(UNWARMLIB_DIR)
-$(UNWARMINDER): $(UNWARM_OBJ)
+$(UNWARMLIB): $(UNWARMLIB_OBJ)
$(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
diff --git a/tools/functions.make b/tools/functions.make
index 26fc471c3c..db7bbe9680 100644
--- a/tools/functions.make
+++ b/tools/functions.make
@@ -26,6 +26,8 @@ asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(
c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
+a2lnk = $(patsubst lib%.a,-l%,$(notdir $(1)))
+
# 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:" \
diff --git a/tools/root.make b/tools/root.make
index 1bac0d6600..eb7e7480d3 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -58,8 +58,9 @@ endif
all: $(DEPFILE) build
-# Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC &
-# ASMDEFS_SRC but they also define special dependencies and compile rules
+# Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC,
+# ASMDEFS_SRC, CORE_LIBS and EXTRA_LIBS. But they also define special
+# dependencies and compile rules
include $(TOOLSDIR)/tools.make
ifeq (,$(findstring checkwps,$(APPSDIR)))
@@ -95,10 +96,8 @@ else ifneq (,$(findstring database,$(APP_TYPE)))
else ifneq (,$(findstring warble,$(APP_TYPE)))
include $(ROOTDIR)/lib/rbcodec/test/warble.make
else
- RBCODEC_DIR = $(ROOTDIR)/lib/rbcodec
- RBCODEC_BLD = $(BUILDDIR)/lib/rbcodec
include $(APPSDIR)/apps.make
- include $(RBCODEC_DIR)/rbcodec.make
+ include $(ROOTDIR)/lib/rbcodec/rbcodec.make
include $(APPSDIR)/lang/lang.make
ifdef SOFTWARECODECS
@@ -179,12 +178,6 @@ ifeq (,$(findstring bootloader,$(APPSDIR)))
OBJ += $(LANG_O)
-ifeq (arm,$(ARCH))
- UNWARMINDER_LINK := -lunwarminder
-else
- UNWARMINDER_LINK :=
-endif
-
ifndef APP_TYPE
## target build
@@ -194,12 +187,6 @@ LINKRAM := $(BUILDDIR)/ram.link
ROMLDS := $(FIRMDIR)/rom.lds
LINKROM := $(BUILDDIR)/rom.link
-ifeq (arm,$(ARCH))
- LIBARMSUPPORT_LINK := -larm_support
-else
- LIBARMSUPPORT_LINK :=
-endif
-
$(LINKRAM): $(RAMLDS) $(CONFIGFILE)
$(call PRINTS,PP $(@F))
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
@@ -208,23 +195,21 @@ $(LINKROM): $(ROMLDS)
$(call PRINTS,PP $(@F))
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
-$(BUILDDIR)/rockbox.elf : $$(OBJ) $$(FIRMLIB) $$(RBCODEC_LIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(LIBARMSUPPORT) $$(UNWARMINDER) $$(LINKRAM)
+$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKRAM)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \
- -L$(RBCODEC_BLD) -lrbcodec \
- -L$(BUILDDIR)/lib -lskin_parser $(LIBARMSUPPORT_LINK) \
- $(UNWARMINDER_LINK) -L$(BUILDDIR)/apps/codecs \
- $(VOICESPEEXLIB:lib%.a=-l%) -lgcc $(BOOTBOXLDOPTS) \
- $(GLOBAL_LDOPTS) -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map
+ -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
+ -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
+ -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \
+ -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map
-$(BUILDDIR)/rombox.elf : $$(OBJ) $$(FIRMLIB) $$(RBCODEC_LIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(LIBARMSUPPORT) $$(UNWARMINDER) $$(LINKROM)
+$(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \
- -L$(RBCODEC_BLD) -lrbcodec \
- -L$(BUILDDIR)/lib -lskin_parser $(LIBARMSUPPORT_LINK) \
- $(UNWARMINDER_LINK) -L$(BUILDDIR)/apps/codecs \
- $(VOICESPEEXLIB:lib%.a=-l%) -lgcc $(GLOBAL_LDOPTS) \
- -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map
+ -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
+ -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
+ -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \
+ -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map
$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
$(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make
index be57e3c216..77cd51494a 100644
--- a/uisimulator/uisimulator.make
+++ b/uisimulator/uisimulator.make
@@ -30,7 +30,7 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP)
$(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
-$(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(RBCODEC_LIB) $(SKINLIB) $(UNWARMINDER)
+$(BUILDDIR)/$(BINARY): $$(OBJ) $(FIRMLIB) $(CORE_LIBS) $(SIMLIB)
$(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) \
-Wl,-Map,$(BUILDDIR)/rockbox.map