2008-11-20 11:27:31 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
2008-11-25 19:54:23 +00:00
|
|
|
# $Id$
|
2008-11-20 11:27:31 +00:00
|
|
|
#
|
|
|
|
|
2011-06-26 01:32:25 +00:00
|
|
|
CODECDIR = $(RBCODEC_BLD)/codecs
|
|
|
|
CODECS_SRC := $(call preprocess, $(RBCODECLIB_DIR)/codecs/SOURCES)
|
2008-11-20 11:27:31 +00:00
|
|
|
OTHER_SRC += $(CODECS_SRC)
|
|
|
|
|
|
|
|
CODECS := $(CODECS_SRC:.c=.codec)
|
2011-06-26 01:32:25 +00:00
|
|
|
CODECS := $(subst $(RBCODECLIB_DIR),$(RBCODEC_BLD),$(CODECS))
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# the codec helper library
|
2011-06-26 01:32:25 +00:00
|
|
|
include $(RBCODECLIB_DIR)/codecs/lib/libcodec.make
|
|
|
|
OTHER_INC += -I$(RBCODECLIB_DIR)/codecs/lib
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2012-03-26 20:24:57 +00:00
|
|
|
# extra libraries
|
2013-04-16 21:47:58 +00:00
|
|
|
CODEC_LIBS := $(CODECLIB) $(FIXEDPOINTLIB)
|
2012-03-26 20:24:57 +00:00
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
# the codec libraries
|
2011-06-26 01:32:25 +00:00
|
|
|
include $(RBCODECLIB_DIR)/codecs/demac/libdemac.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/liba52/liba52.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libalac/libalac.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libasap/libasap.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libasf/libasf.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libfaad/libfaad.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libffmpegFLAC/libffmpegFLAC.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libm4a/libm4a.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libmad/libmad.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libmusepack/libmusepack.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libspc/libspc.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libspeex/libspeex.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libtremor/libtremor.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libwavpack/libwavpack.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libwma/libwma.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libwmapro/libwmapro.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libcook/libcook.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/librm/librm.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libatrac/libatrac.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libpcm/libpcm.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libtta/libtta.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libay.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libgbs.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libhes.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libnsf.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libsgc.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libvgm.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libkss.make
|
|
|
|
include $(RBCODECLIB_DIR)/codecs/libgme/libemu2413.make
|
2012-07-26 12:38:32 +00:00
|
|
|
include $(RBCODECLIB_DIR)/codecs/libopus/libopus.make
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# compile flags for codecs
|
2011-06-26 01:32:25 +00:00
|
|
|
CODECFLAGS = $(CFLAGS) $(RBCODEC_CFLAGS) -fstrict-aliasing \
|
|
|
|
-I$(RBCODECLIB_DIR)/codecs -I$(RBCODECLIB_DIR)/codecs/lib -DCODEC
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2011-08-18 16:33:41 +00:00
|
|
|
# set CODECFLAGS per codec lib, since gcc takes the last -Ox and the last
|
|
|
|
# in a -ffoo -fno-foo pair, there is no need to filter them out
|
|
|
|
$(A52LIB) : CODECFLAGS += -O1
|
|
|
|
$(ALACLIB) : CODECFLAGS += -O1
|
|
|
|
$(ASAPLIB) : CODECFLAGS += -O1
|
|
|
|
$(ASFLIB) : CODECFLAGS += -O2
|
|
|
|
$(ATRACLIB) : CODECFLAGS += -O1
|
2011-08-31 10:30:08 +00:00
|
|
|
$(AYLIB) : CODECFLAGS += -O2
|
2011-08-18 16:33:41 +00:00
|
|
|
$(COOKLIB): CODECFLAGS += -O1
|
|
|
|
$(DEMACLIB) : CODECFLAGS += -O3
|
|
|
|
$(FAADLIB) : CODECFLAGS += -O2
|
|
|
|
$(FFMPEGFLACLIB) : CODECFLAGS += -O2
|
2011-08-31 10:30:08 +00:00
|
|
|
$(GBSLIB) : CODECFLAGS += -O2
|
|
|
|
$(HESLIB) : CODECFLAGS += -O2
|
|
|
|
$(KSSLIB) : CODECFLAGS += -O2
|
2011-08-18 16:33:41 +00:00
|
|
|
$(M4ALIB) : CODECFLAGS += -O3
|
|
|
|
$(MUSEPACKLIB) : CODECFLAGS += -O1
|
2011-08-31 10:30:08 +00:00
|
|
|
$(NSFLIB) : CODECFLAGS += -O2
|
2012-07-26 12:38:32 +00:00
|
|
|
$(OPUSLIB) : CODECFLAGS += -O2
|
2011-08-18 16:33:41 +00:00
|
|
|
$(PCMSLIB) : CODECFLAGS += -O1
|
|
|
|
$(RMLIB) : CODECFLAGS += -O3
|
2011-08-31 10:30:08 +00:00
|
|
|
$(SGCLIB) : CODECFLAGS += -O2
|
|
|
|
$(SPCLIB) : CODECFLAGS += -O1
|
2011-08-18 16:33:41 +00:00
|
|
|
$(TREMORLIB) : CODECFLAGS += -O2
|
|
|
|
$(TTALIB) : CODECFLAGS += -O2
|
2011-08-31 10:30:08 +00:00
|
|
|
$(VGMLIB) : CODECFLAGS += -O2
|
|
|
|
$(EMU2413LIB) : CODECFLAGS += -O3
|
2011-08-18 16:33:41 +00:00
|
|
|
$(WAVPACKLIB) : CODECFLAGS += -O1
|
|
|
|
$(WMALIB) : CODECFLAGS += -O2
|
|
|
|
$(WMAPROLIB) : CODECFLAGS += -O1
|
|
|
|
$(WMAVOICELIB) : CODECFLAGS += -O1
|
|
|
|
|
|
|
|
# fine-tuning of CODECFLAGS per cpu arch
|
2012-03-28 20:57:13 +00:00
|
|
|
ifeq ($(ARCH),arch_arm)
|
2011-08-18 16:33:41 +00:00
|
|
|
# redo per arm generation
|
|
|
|
$(ALACLIB) : CODECFLAGS += -O2
|
2011-08-31 10:30:08 +00:00
|
|
|
$(AYLIB) : CODECFLAGS += -O1
|
|
|
|
$(GBSLIB) : CODECFLAGS += -O1
|
|
|
|
$(HESLIB) : CODECFLAGS += -O1
|
|
|
|
$(KSSLIB) : CODECFLAGS += -O1
|
|
|
|
$(NSFLIB) : CODECFLAGS += -O1
|
|
|
|
$(SGCLIB) : CODECFLAGS += -O1
|
|
|
|
$(VGMLIB) : CODECFLAGS += -O1
|
|
|
|
$(EMU2413LIB) : CODECFLAGS += -O3
|
2011-08-18 16:33:41 +00:00
|
|
|
$(WAVPACKLIB) : CODECFLAGS += -O3
|
2012-03-28 20:57:13 +00:00
|
|
|
else ifeq ($(ARCH),arch_m68k)
|
2011-08-18 16:33:41 +00:00
|
|
|
$(A52LIB) : CODECFLAGS += -O2
|
|
|
|
$(ASFLIB) : CODECFLAGS += -O3
|
|
|
|
$(ATRACLIB) : CODECFLAGS += -O2
|
|
|
|
$(COOKLIB): CODECFLAGS += -O2
|
|
|
|
$(DEMACLIB) : CODECFLAGS += -O2
|
2012-04-05 11:26:08 +00:00
|
|
|
$(SPCLIB) : CODECFLAGS += -O3
|
2011-08-18 16:33:41 +00:00
|
|
|
$(WMAPROLIB) : CODECFLAGS += -O3
|
|
|
|
$(WMAVOICELIB) : CODECFLAGS += -O2
|
2012-09-27 20:57:01 +00:00
|
|
|
else ifeq ($(ARCH),arch_mips)
|
|
|
|
$(OPUSLIB) : CODECFLAGS += -fno-strict-aliasing
|
2011-08-18 16:33:41 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(MEMORYSIZE),2)
|
|
|
|
$(ASFLIB) : CODECFLAGS += -Os
|
|
|
|
$(WMALIB) : CODECFLAGS += -Os
|
|
|
|
endif
|
|
|
|
|
2010-07-10 13:49:49 +00:00
|
|
|
ifndef APP_TYPE
|
2010-01-24 15:32:23 +00:00
|
|
|
CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h
|
2009-02-09 18:31:56 +00:00
|
|
|
CODEC_LDS := $(APPSDIR)/plugins/plugin.lds # codecs and plugins use same file
|
|
|
|
CODECLINK_LDS := $(CODECDIR)/codec.link
|
|
|
|
endif
|
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
CODEC_CRT0 := $(CODECDIR)/codec_crt0.o
|
|
|
|
|
2010-02-04 08:45:38 +00:00
|
|
|
$(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2010-01-24 15:32:23 +00:00
|
|
|
$(CODECLINK_LDS): $(CODEC_LDS) $(CONFIGFILE)
|
2008-11-20 11:27:31 +00:00
|
|
|
$(call PRINTS,PP $(@F))
|
2008-11-20 13:45:57 +00:00
|
|
|
$(shell mkdir -p $(dir $@))
|
2008-11-20 15:54:47 +00:00
|
|
|
$(call preprocess2file, $<, $@, -DCODEC)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# codec/library dependencies
|
|
|
|
$(CODECDIR)/spc.codec : $(CODECDIR)/libspc.a
|
|
|
|
$(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a
|
|
|
|
$(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a
|
|
|
|
$(CODECDIR)/flac.codec : $(CODECDIR)/libffmpegFLAC.a
|
2013-01-24 15:01:28 +00:00
|
|
|
$(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a $(TLSFLIB) $(SETJMPLIB)
|
2008-11-20 11:27:31 +00:00
|
|
|
$(CODECDIR)/speex.codec : $(CODECDIR)/libspeex.a
|
|
|
|
$(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a
|
|
|
|
$(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.a
|
|
|
|
$(CODECDIR)/alac.codec : $(CODECDIR)/libalac.a $(CODECDIR)/libm4a.a
|
|
|
|
$(CODECDIR)/aac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/libm4a.a
|
|
|
|
$(CODECDIR)/shorten.codec : $(CODECDIR)/libffmpegFLAC.a
|
2010-02-04 08:45:38 +00:00
|
|
|
$(CODECDIR)/ape-pre.map : $(CODECDIR)/libdemac-pre.a
|
2008-11-20 11:27:31 +00:00
|
|
|
$(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a
|
2010-05-02 17:19:42 +00:00
|
|
|
$(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a $(CODECDIR)/libasf.a
|
2010-07-14 20:27:43 +00:00
|
|
|
$(CODECDIR)/wmapro.codec : $(CODECDIR)/libwmapro.a $(CODECDIR)/libasf.a
|
2008-11-20 11:27:31 +00:00
|
|
|
$(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a
|
|
|
|
$(CODECDIR)/asap.codec : $(CODECDIR)/libasap.a
|
2009-07-25 15:13:50 +00:00
|
|
|
$(CODECDIR)/cook.codec : $(CODECDIR)/libcook.a $(CODECDIR)/librm.a
|
2009-07-25 15:47:13 +00:00
|
|
|
$(CODECDIR)/raac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/librm.a
|
2009-08-04 15:05:56 +00:00
|
|
|
$(CODECDIR)/a52_rm.codec : $(CODECDIR)/liba52.a $(CODECDIR)/librm.a
|
2009-08-14 17:36:57 +00:00
|
|
|
$(CODECDIR)/atrac3_rm.codec : $(CODECDIR)/libatrac.a $(CODECDIR)/librm.a
|
2010-02-12 03:21:37 +00:00
|
|
|
$(CODECDIR)/atrac3_oma.codec : $(CODECDIR)/libatrac.a
|
2010-01-27 17:25:10 +00:00
|
|
|
$(CODECDIR)/aiff.codec : $(CODECDIR)/libpcm.a
|
|
|
|
$(CODECDIR)/wav.codec : $(CODECDIR)/libpcm.a
|
2010-02-24 11:46:29 +00:00
|
|
|
$(CODECDIR)/smaf.codec : $(CODECDIR)/libpcm.a
|
2010-02-28 07:22:20 +00:00
|
|
|
$(CODECDIR)/au.codec : $(CODECDIR)/libpcm.a
|
2010-02-28 08:13:30 +00:00
|
|
|
$(CODECDIR)/vox.codec : $(CODECDIR)/libpcm.a
|
2010-02-28 08:48:07 +00:00
|
|
|
$(CODECDIR)/wav64.codec : $(CODECDIR)/libpcm.a
|
2010-05-13 12:40:09 +00:00
|
|
|
$(CODECDIR)/tta.codec : $(CODECDIR)/libtta.a
|
2011-08-07 20:01:04 +00:00
|
|
|
$(CODECDIR)/ay.codec : $(CODECDIR)/libay.a
|
|
|
|
$(CODECDIR)/gbs.codec : $(CODECDIR)/libgbs.a
|
|
|
|
$(CODECDIR)/hes.codec : $(CODECDIR)/libhes.a
|
2011-08-18 21:01:08 +00:00
|
|
|
$(CODECDIR)/nsf.codec : $(CODECDIR)/libnsf.a $(CODECDIR)/libemu2413.a
|
|
|
|
$(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
|
2013-05-18 17:48:08 +00:00
|
|
|
$(CODECDIR)/opus.codec : $(CODECDIR)/libopus.a $(TLSFLIB)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2012-03-26 20:24:57 +00:00
|
|
|
$(CODECS): $(CODEC_LIBS) # this must be last in codec dependency list
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# pattern rule for compiling codecs
|
2011-06-26 01:32:25 +00:00
|
|
|
$(CODECDIR)/%.o: $(RBCODECLIB_DIR)/codecs/%.c
|
2008-11-20 11:27:31 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
|
|
|
|
-I$(dir $<) $(CODECFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
# pattern rule for compiling codecs
|
2011-06-26 01:32:25 +00:00
|
|
|
$(CODECDIR)/%.o: $(RBCODECLIB_DIR)/codecs/%.S
|
2008-11-20 11:27:31 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
|
2010-12-27 17:27:59 +00:00
|
|
|
-I$(dir $<) $(CODECFLAGS) $(ASMFLAGS) -c $< -o $@
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2010-07-10 13:49:49 +00:00
|
|
|
ifdef APP_TYPE
|
2012-01-17 14:08:08 +00:00
|
|
|
CODECLDFLAGS = $(SHARED_LDFLAG) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map
|
2011-06-07 11:56:23 +00:00
|
|
|
CODECFLAGS += $(SHARED_CFLAGS) # <-- from Makefile
|
2008-11-20 11:27:31 +00:00
|
|
|
else
|
|
|
|
CODECLDFLAGS = -T$(CODECLINK_LDS) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map
|
|
|
|
CODECFLAGS += -UDEBUG -DNDEBUG
|
|
|
|
endif
|
2010-07-03 20:58:22 +00:00
|
|
|
CODECLDFLAGS += $(GLOBAL_LDOPTS)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2012-03-26 20:24:57 +00:00
|
|
|
$(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECS_LIBS)
|
2010-02-04 08:45:38 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \
|
|
|
|
$(filter %.o, $^) \
|
2012-03-26 20:24:57 +00:00
|
|
|
$(filter-out $(CODECLIB),$(filter %.a, $+)) $(CODECLIB) \
|
2010-02-04 08:45:38 +00:00
|
|
|
-lgcc $(subst .map,-pre.map,$(CODECLDFLAGS))
|
|
|
|
|
2012-03-26 20:24:57 +00:00
|
|
|
$(CODECDIR)/%.codec: $(CODECDIR)/%.o
|
2008-11-20 11:27:31 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \
|
|
|
|
$(filter %.o, $^) \
|
2009-03-02 08:16:36 +00:00
|
|
|
$(filter %.a, $+) \
|
2008-11-20 11:27:31 +00:00
|
|
|
-lgcc $(CODECLDFLAGS)
|
2012-04-04 19:43:22 +00:00
|
|
|
$(SILENT)$(call objcopy,$(CODECDIR)/$*.elf,$@)
|