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
This commit is contained in:
Thomas Martitz 2012-03-26 22:24:57 +02:00
parent 9445d4625a
commit f269aa0060
15 changed files with 79 additions and 90 deletions

View file

@ -114,7 +114,7 @@ dex: $(DEX)
classes: $(R_OBJ) $(JAVA_OBJ) 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,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
$(call PRINTS,OC $(@F))$(OC) -S -x $@ $(call PRINTS,OC $(@F))$(OC) -S -x $@

View file

@ -21,6 +21,9 @@ include $(APPSDIR)/codecs/lib/tlsf/libtlsf.make
include $(APPSDIR)/codecs/lib/libcodec.make include $(APPSDIR)/codecs/lib/libcodec.make
OTHER_INC += -I$(APPSDIR)/codecs/lib OTHER_INC += -I$(APPSDIR)/codecs/lib
# extra libraries
CODEC_LIBS := $(EXTRA_LIBS) $(TLSFLIB) $(CODECLIB)
# the codec libraries # the codec libraries
include $(APPSDIR)/codecs/demac/libdemac.make include $(APPSDIR)/codecs/demac/libdemac.make
include $(APPSDIR)/codecs/liba52/liba52.make include $(APPSDIR)/codecs/liba52/liba52.make
@ -135,7 +138,7 @@ $(CODECDIR)/spc.codec : $(CODECDIR)/libspc.a
$(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a $(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a
$(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a $(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a
$(CODECDIR)/flac.codec : $(CODECDIR)/libffmpegFLAC.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)/speex.codec : $(CODECDIR)/libspeex.a
$(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a $(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a
$(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.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)/vgm.codec : $(CODECDIR)/libvgm.a $(CODECDIR)/libemu2413.a
$(CODECDIR)/kss.codec : $(CODECDIR)/libkss.a $(CODECDIR)/libemu2413.a $(CODECDIR)/kss.codec : $(CODECDIR)/libkss.a $(CODECDIR)/libemu2413.a
$(CODECS): $(CODECLIB) # this must be last in codec dependency list $(CODECS): $(CODEC_LIBS) # 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:
# pattern rule for compiling codecs # pattern rule for compiling codecs
$(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.c $(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.c
@ -194,14 +194,13 @@ else
endif endif
CODECLDFLAGS += $(GLOBAL_LDOPTS) 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 \ $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \
$(filter %.o, $^) \ $(filter %.o, $^) \
$(filter-out $(CODECLIB),$(filter %.a, $+)) \ $(filter-out $(CODECLIB),$(filter %.a, $+)) $(CODECLIB) \
$(CODECLIB) \
-lgcc $(subst .map,-pre.map,$(CODECLDFLAGS)) -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 \ $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \
$(filter %.o, $^) \ $(filter %.o, $^) \
$(filter %.a, $+) \ $(filter %.a, $+) \

View file

@ -47,7 +47,7 @@ else
endif endif
# rule to create reference map for image decoder # 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 \ $(call PRINTS,LD $(@F))$(CC) $(IMGDECFLAGS) -o /dev/null \
$(filter %.o, $^) \ $(filter %.o, $^) \
$(filter %.a, $+) \ $(filter %.a, $+) \

View file

@ -20,7 +20,7 @@ OTHER_SRC += $(MIKMOD_SRC)
MIKMODCFLAGS = $(PLUGINFLAGS) -I$(MIKMODSRCDIR) -O2 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 # new rule needed to use extra compile flags
$(MIKMODBUILDDIR)/%.o: $(MIKMODSRCDIR)/%.c $(MIKMODBUILDDIR)/%.o: $(MIKMODSRCDIR)/%.c

View file

@ -18,7 +18,7 @@ PDBOX_OBJ := $(call c2obj, $(PDBOX_SRC))
# add source files to OTHERSRC to get automatic dependencies # add source files to OTHERSRC to get automatic dependencies
OTHER_SRC += $(PDBOX_SRC) 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 PDBOXFLAGS = $(PLUGINFLAGS) -fno-strict-aliasing
PDBOXLDFLAGS = $(PLUGINLDFLAGS) PDBOXLDFLAGS = $(PLUGINLDFLAGS)

View file

@ -53,6 +53,8 @@ else
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
endif endif
PLUGIN_LIBS := $(EXTRA_LIBS) $(TLSFLIB) $(PLUGINLIB) $(PLUGINBITMAPLIB)
# include <dir>.make from each subdir (yay!) # include <dir>.make from each subdir (yay!)
$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make)) $(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
@ -65,7 +67,7 @@ PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
$(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o $(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
# dependency for all plugins # 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) $(PLUGINLIB): $(PLUGINLIB_OBJ)
$(SILENT)$(shell rm -f $@) $(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) $(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
# special dependencies # 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 # Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
ifeq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim) ifeq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
@ -129,7 +131,7 @@ endif
$(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua $(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/ $(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 \ $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
$(filter %.o, $^) \ $(filter %.o, $^) \
$(filter %.a, $+) \ $(filter %.a, $+) \

View file

@ -13,13 +13,11 @@ SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS)
.SECONDEXPANSION: # $$(OBJ) is not populated until after this .SECONDEXPANSION: # $$(OBJ) is not populated until after this
$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS)
$(BUILDDIR)/rockbox.elf : $$(OBJ) $$(RBCODEC_LIB) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(UNWARMINDER)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \ -L$(BUILDDIR)/firmware -lfirmware \
$(RBCODEC_LIB) \ -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
-L$(BUILDDIR)/apps/codecs $(VOICESPEEXLIB:lib%.a=-l%) \ -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \
-L$(BUILDDIR)/lib -lskin_parser \
$(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
$(BUILDDIR)/rockbox : $(BUILDDIR)/rockbox.elf $(BUILDDIR)/rockbox : $(BUILDDIR)/rockbox.elf

View file

@ -6,14 +6,16 @@
# \/ \/ \/ \/ \/ # \/ \/ \/ \/ \/
# #
ARMSUPPORT_DIR = $(ROOTDIR)/lib/arm_support ARMSUPPORTLIB_DIR := $(ROOTDIR)/lib/arm_support
ARMSUPPORT_SRC = $(ARMSUPPORT_DIR)/support-arm.S ARMSUPPORTLIB_SRC := $(ARMSUPPORTLIB_DIR)/support-arm.S
ARMSUPPORT_OBJ := $(call c2obj, $(ARMSUPPORT_SRC)) 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 $(ARMSUPPORTLIB): $(ARMSUPPORTLIB_OBJ)
$(LIBARMSUPPORT): $(ARMSUPPORT_OBJ)
$(SILENT)$(shell rm -f $@) $(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null

View file

@ -6,16 +6,16 @@
# \/ \/ \/ \/ \/ # \/ \/ \/ \/ \/
# #
SETJMP_DIR = $(ROOTDIR)/lib/libsetjmp SETJMPLIB_DIR = $(ROOTDIR)/lib/libsetjmp
SETJMP_SRC = $(call preprocess, $(SETJMP_DIR)/SOURCES) SETJMPLIB_SRC = $(call preprocess, $(SETJMPLIB_DIR)/SOURCES)
SETJMP_OBJ := $(call c2obj, $(SETJMP_SRC)) 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) $(SETJMPLIB): $(SETJMPLIB_OBJ)
$(LIBSETJMP): $(SETJMP_OBJ)
$(SILENT)$(shell rm -f $@) $(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null

View file

@ -5,15 +5,15 @@
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/ # \/ \/ \/ \/ \/
RBCODEC_LIB = $(RBCODEC_BLD)/librbcodec.a # RBCODEC_BLD is defined in the calling Makefile
RBCODEC_SRC := $(call preprocess, $(RBCODEC_DIR)/SOURCES) RBCODECLIB_DIR := $(ROOTDIR)/lib/rbcodec
RBCODEC_OBJ := $(call c2obj, $(RBCODEC_SRC)) RBCODECLIB_SRC := $(call preprocess, $(RBCODECLIB_DIR)/SOURCES)
INCLUDES += -I$(RBCODEC_DIR) -I$(RBCODEC_DIR)/dsp -I$(RBCODEC_DIR)/metadata RBCODECLIB_OBJ := $(call c2obj, $(RBCODECLIB_SRC))
OTHER_SRC += $(RBCODEC_SRC) RBCODECLIB := $(BUILDDIR)/lib/librbcodec.a
$(RBCODEC_BLD)/%.o: $(RBCODEC_DIR)/%.c INCLUDES += -I$(RBCODECLIB_DIR) -I$(RBCODECLIB_DIR)/dsp -I$(RBCODECLIB_DIR)/metadata
$(SILENT)mkdir -p $(dir $@) OTHER_SRC += $(RBCODECLIB_SRC)
$(call PRINTS,CC $<)$(CC) $(CFLAGS) $(RBCODEC_CFLAGS) -c $< -o $@ CORE_LIBS += $(RBCODECLIB)
$(RBCODEC_LIB): $(RBCODEC_OBJ) $(RBCODECLIB): $(RBCODECLIB_OBJ)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null

View file

@ -5,16 +5,16 @@
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/ # \/ \/ \/ \/ \/
# #
SKINP_DIR = $(ROOTDIR)/lib/skin_parser SKINPARSLIB_DIR = $(ROOTDIR)/lib/skin_parser
SKINP_SRC = $(call preprocess, $(SKINP_DIR)/SOURCES) SKINPARSLIB_SRC = $(call preprocess, $(SKINPARSLIB_DIR)/SOURCES)
SKINP_OBJ := $(call c2obj, $(SKINP_SRC)) 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) $(SKINPARSLIB): $(SKINPARSLIB_OBJ)
$(SKINLIB): $(SKINP_OBJ)
$(SILENT)$(shell rm -f $@) $(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null

View file

@ -6,16 +6,17 @@
# \/ \/ \/ \/ \/ # \/ \/ \/ \/ \/
# #
UNWARM_DIR = $(ROOTDIR)/lib/unwarminder UNWARMLIB_DIR = $(ROOTDIR)/lib/unwarminder
UNWARM_SRC = $(call preprocess, $(UNWARM_DIR)/SOURCES) UNWARMLIB_SRC = $(call preprocess, $(UNWARMLIB_DIR)/SOURCES)
UNWARM_OBJ := $(call c2obj, $(UNWARM_SRC)) 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 $@) $(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null

View file

@ -26,6 +26,8 @@ asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(
c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1)))) 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) # 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) | \ mkdepfile = $(SILENT)perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \
sed -e "s: lang.h: lang/lang.h:" \ sed -e "s: lang.h: lang/lang.h:" \

View file

@ -58,8 +58,9 @@ endif
all: $(DEPFILE) build all: $(DEPFILE) build
# Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC & # Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC,
# ASMDEFS_SRC but they also define special dependencies and compile rules # ASMDEFS_SRC, CORE_LIBS and EXTRA_LIBS. But they also define special
# dependencies and compile rules
include $(TOOLSDIR)/tools.make include $(TOOLSDIR)/tools.make
ifeq (,$(findstring checkwps,$(APPSDIR))) ifeq (,$(findstring checkwps,$(APPSDIR)))
@ -95,10 +96,8 @@ else ifneq (,$(findstring database,$(APP_TYPE)))
else ifneq (,$(findstring warble,$(APP_TYPE))) else ifneq (,$(findstring warble,$(APP_TYPE)))
include $(ROOTDIR)/lib/rbcodec/test/warble.make include $(ROOTDIR)/lib/rbcodec/test/warble.make
else else
RBCODEC_DIR = $(ROOTDIR)/lib/rbcodec
RBCODEC_BLD = $(BUILDDIR)/lib/rbcodec
include $(APPSDIR)/apps.make include $(APPSDIR)/apps.make
include $(RBCODEC_DIR)/rbcodec.make include $(ROOTDIR)/lib/rbcodec/rbcodec.make
include $(APPSDIR)/lang/lang.make include $(APPSDIR)/lang/lang.make
ifdef SOFTWARECODECS ifdef SOFTWARECODECS
@ -179,12 +178,6 @@ ifeq (,$(findstring bootloader,$(APPSDIR)))
OBJ += $(LANG_O) OBJ += $(LANG_O)
ifeq (arm,$(ARCH))
UNWARMINDER_LINK := -lunwarminder
else
UNWARMINDER_LINK :=
endif
ifndef APP_TYPE ifndef APP_TYPE
## target build ## target build
@ -194,12 +187,6 @@ LINKRAM := $(BUILDDIR)/ram.link
ROMLDS := $(FIRMDIR)/rom.lds ROMLDS := $(FIRMDIR)/rom.lds
LINKROM := $(BUILDDIR)/rom.link LINKROM := $(BUILDDIR)/rom.link
ifeq (arm,$(ARCH))
LIBARMSUPPORT_LINK := -larm_support
else
LIBARMSUPPORT_LINK :=
endif
$(LINKRAM): $(RAMLDS) $(CONFIGFILE) $(LINKRAM): $(RAMLDS) $(CONFIGFILE)
$(call PRINTS,PP $(@F)) $(call PRINTS,PP $(@F))
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
@ -208,23 +195,21 @@ $(LINKROM): $(ROMLDS)
$(call PRINTS,PP $(@F)) $(call PRINTS,PP $(@F))
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) $(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) \ $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \ -L$(BUILDDIR)/firmware -lfirmware \
-L$(RBCODEC_BLD) -lrbcodec \ -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
-L$(BUILDDIR)/lib -lskin_parser $(LIBARMSUPPORT_LINK) \ -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
$(UNWARMINDER_LINK) -L$(BUILDDIR)/apps/codecs \ -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \
$(VOICESPEEXLIB:lib%.a=-l%) -lgcc $(BOOTBOXLDOPTS) \ -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map
$(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) \ $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
-L$(BUILDDIR)/firmware -lfirmware \ -L$(BUILDDIR)/firmware -lfirmware \
-L$(RBCODEC_BLD) -lrbcodec \ -L$(BUILDDIR)/apps/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
-L$(BUILDDIR)/lib -lskin_parser $(LIBARMSUPPORT_LINK) \ -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
$(UNWARMINDER_LINK) -L$(BUILDDIR)/apps/codecs \ -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \
$(VOICESPEEXLIB:lib%.a=-l%) -lgcc $(GLOBAL_LDOPTS) \ -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map
-T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map
$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
$(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@ $(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@

View file

@ -30,7 +30,7 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP)
$(SILENT)$(shell rm -f $@) $(SILENT)$(shell rm -f $@)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null $(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) \ $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) \
-Wl,-Map,$(BUILDDIR)/rockbox.map -Wl,-Map,$(BUILDDIR)/rockbox.map