summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-03-26 22:24:57 +0200
committerThomas Martitz <kugel@rockbox.org>2012-03-26 22:27:40 +0200
commitf269aa0060950f7b9c42216267c639a2fb556196 (patch)
tree218ad3a737f11cb18e48676f300bc22038cfa140 /tools
parent9445d4625a3d47b28d756a5763165eb73d6b4ada (diff)
build system: unify/simplify library handling a bit.
libs in $ROOT/lib now add to $(CORE_LIBS) and $(EXTRA_LIBS) and are automatically linked by the core and codecs/plugins respectively. Change-Id: Iff482c792a8c8142718f6a16a450c6e2f1497c9a
Diffstat (limited to 'tools')
-rw-r--r--tools/functions.make2
-rw-r--r--tools/root.make43
2 files changed, 16 insertions, 29 deletions
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) $< $@