diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-03-26 22:24:57 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-03-26 22:27:40 +0200 |
commit | f269aa0060950f7b9c42216267c639a2fb556196 (patch) | |
tree | 218ad3a737f11cb18e48676f300bc22038cfa140 /tools | |
parent | 9445d4625a3d47b28d756a5763165eb73d6b4ada (diff) | |
download | rockbox-f269aa0060950f7b9c42216267c639a2fb556196.tar.gz rockbox-f269aa0060950f7b9c42216267c639a2fb556196.zip |
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.make | 2 | ||||
-rw-r--r-- | tools/root.make | 43 |
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 $( | |||
26 | 26 | ||
27 | c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1)))) | 27 | c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1)))) |
28 | 28 | ||
29 | a2lnk = $(patsubst lib%.a,-l%,$(notdir $(1))) | ||
30 | |||
29 | # calculate dependencies for a list of source files $(2) and output them to $(1) | 31 | # calculate dependencies for a list of source files $(2) and output them to $(1) |
30 | mkdepfile = $(SILENT)perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \ | 32 | mkdepfile = $(SILENT)perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \ |
31 | sed -e "s: lang.h: lang/lang.h:" \ | 33 | 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 | |||
58 | 58 | ||
59 | all: $(DEPFILE) build | 59 | all: $(DEPFILE) build |
60 | 60 | ||
61 | # Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC & | 61 | # Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC, |
62 | # ASMDEFS_SRC but they also define special dependencies and compile rules | 62 | # ASMDEFS_SRC, CORE_LIBS and EXTRA_LIBS. But they also define special |
63 | # dependencies and compile rules | ||
63 | include $(TOOLSDIR)/tools.make | 64 | include $(TOOLSDIR)/tools.make |
64 | 65 | ||
65 | ifeq (,$(findstring checkwps,$(APPSDIR))) | 66 | ifeq (,$(findstring checkwps,$(APPSDIR))) |
@@ -95,10 +96,8 @@ else ifneq (,$(findstring database,$(APP_TYPE))) | |||
95 | else ifneq (,$(findstring warble,$(APP_TYPE))) | 96 | else ifneq (,$(findstring warble,$(APP_TYPE))) |
96 | include $(ROOTDIR)/lib/rbcodec/test/warble.make | 97 | include $(ROOTDIR)/lib/rbcodec/test/warble.make |
97 | else | 98 | else |
98 | RBCODEC_DIR = $(ROOTDIR)/lib/rbcodec | ||
99 | RBCODEC_BLD = $(BUILDDIR)/lib/rbcodec | ||
100 | include $(APPSDIR)/apps.make | 99 | include $(APPSDIR)/apps.make |
101 | include $(RBCODEC_DIR)/rbcodec.make | 100 | include $(ROOTDIR)/lib/rbcodec/rbcodec.make |
102 | include $(APPSDIR)/lang/lang.make | 101 | include $(APPSDIR)/lang/lang.make |
103 | 102 | ||
104 | ifdef SOFTWARECODECS | 103 | ifdef SOFTWARECODECS |
@@ -179,12 +178,6 @@ ifeq (,$(findstring bootloader,$(APPSDIR))) | |||
179 | 178 | ||
180 | OBJ += $(LANG_O) | 179 | OBJ += $(LANG_O) |
181 | 180 | ||
182 | ifeq (arm,$(ARCH)) | ||
183 | UNWARMINDER_LINK := -lunwarminder | ||
184 | else | ||
185 | UNWARMINDER_LINK := | ||
186 | endif | ||
187 | |||
188 | ifndef APP_TYPE | 181 | ifndef APP_TYPE |
189 | 182 | ||
190 | ## target build | 183 | ## target build |
@@ -194,12 +187,6 @@ LINKRAM := $(BUILDDIR)/ram.link | |||
194 | ROMLDS := $(FIRMDIR)/rom.lds | 187 | ROMLDS := $(FIRMDIR)/rom.lds |
195 | LINKROM := $(BUILDDIR)/rom.link | 188 | LINKROM := $(BUILDDIR)/rom.link |
196 | 189 | ||
197 | ifeq (arm,$(ARCH)) | ||
198 | LIBARMSUPPORT_LINK := -larm_support | ||
199 | else | ||
200 | LIBARMSUPPORT_LINK := | ||
201 | endif | ||
202 | |||
203 | $(LINKRAM): $(RAMLDS) $(CONFIGFILE) | 190 | $(LINKRAM): $(RAMLDS) $(CONFIGFILE) |
204 | $(call PRINTS,PP $(@F)) | 191 | $(call PRINTS,PP $(@F)) |
205 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) | 192 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) |
@@ -208,23 +195,21 @@ $(LINKROM): $(ROMLDS) | |||
208 | $(call PRINTS,PP $(@F)) | 195 | $(call PRINTS,PP $(@F)) |
209 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) | 196 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) |
210 | 197 | ||
211 | $(BUILDDIR)/rockbox.elf : $$(OBJ) $$(FIRMLIB) $$(RBCODEC_LIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(LIBARMSUPPORT) $$(UNWARMINDER) $$(LINKRAM) | 198 | $(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKRAM) |
212 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ | 199 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ |
213 | -L$(BUILDDIR)/firmware -lfirmware \ | 200 | -L$(BUILDDIR)/firmware -lfirmware \ |
214 | -L$(RBCODEC_BLD) -lrbcodec \ | 201 | -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ |
215 | -L$(BUILDDIR)/lib -lskin_parser $(LIBARMSUPPORT_LINK) \ | 202 | -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ |
216 | $(UNWARMINDER_LINK) -L$(BUILDDIR)/apps/codecs \ | 203 | -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \ |
217 | $(VOICESPEEXLIB:lib%.a=-l%) -lgcc $(BOOTBOXLDOPTS) \ | 204 | -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map |
218 | $(GLOBAL_LDOPTS) -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map | ||
219 | 205 | ||
220 | $(BUILDDIR)/rombox.elf : $$(OBJ) $$(FIRMLIB) $$(RBCODEC_LIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(LIBARMSUPPORT) $$(UNWARMINDER) $$(LINKROM) | 206 | $(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM) |
221 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ | 207 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ |
222 | -L$(BUILDDIR)/firmware -lfirmware \ | 208 | -L$(BUILDDIR)/firmware -lfirmware \ |
223 | -L$(RBCODEC_BLD) -lrbcodec \ | 209 | -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ |
224 | -L$(BUILDDIR)/lib -lskin_parser $(LIBARMSUPPORT_LINK) \ | 210 | -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ |
225 | $(UNWARMINDER_LINK) -L$(BUILDDIR)/apps/codecs \ | 211 | -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \ |
226 | $(VOICESPEEXLIB:lib%.a=-l%) -lgcc $(GLOBAL_LDOPTS) \ | 212 | -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map |
227 | -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map | ||
228 | 213 | ||
229 | $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf | 214 | $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf |
230 | $(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@ | 215 | $(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@ |