2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 CODECDIR
= $(BUILDDIR
)/apps
/codecs
11 CODECS_SRC
:= $(call preprocess
, $(APPSDIR
)/codecs
/SOURCES
)
12 OTHER_SRC
+= $(CODECS_SRC
)
14 CODECS
:= $(CODECS_SRC
:.c
=.codec
)
15 CODECS
:= $(subst $(ROOTDIR
),$(BUILDDIR
),$(CODECS
))
17 # TLSF memory allocator library
18 include $(APPSDIR
)/codecs
/lib
/tlsf
/libtlsf.make
20 # the codec helper library
21 include $(APPSDIR
)/codecs
/lib
/libcodec.make
22 OTHER_INC
+= -I
$(APPSDIR
)/codecs
/lib
25 include $(APPSDIR
)/codecs
/demac
/libdemac.make
26 include $(APPSDIR
)/codecs
/liba52
/liba52.make
27 include $(APPSDIR
)/codecs
/libalac
/libalac.make
28 include $(APPSDIR
)/codecs
/libasap
/libasap.make
29 include $(APPSDIR
)/codecs
/libasf
/libasf.make
30 include $(APPSDIR
)/codecs
/libfaad
/libfaad.make
31 include $(APPSDIR
)/codecs
/libffmpegFLAC
/libffmpegFLAC.make
32 include $(APPSDIR
)/codecs
/libm4a
/libm4a.make
33 include $(APPSDIR
)/codecs
/libmad
/libmad.make
34 include $(APPSDIR
)/codecs
/libmusepack
/libmusepack.make
35 include $(APPSDIR
)/codecs
/libspc
/libspc.make
36 include $(APPSDIR
)/codecs
/libspeex
/libspeex.make
37 include $(APPSDIR
)/codecs
/libtremor
/libtremor.make
38 include $(APPSDIR
)/codecs
/libwavpack
/libwavpack.make
39 include $(APPSDIR
)/codecs
/libwma
/libwma.make
40 include $(APPSDIR
)/codecs
/libcook
/libcook.make
41 include $(APPSDIR
)/codecs
/librm
/librm.make
42 include $(APPSDIR
)/codecs
/libatrac
/libatrac.make
43 include $(APPSDIR
)/codecs
/libpcm
/libpcm.make
44 include $(APPSDIR
)/codecs
/libtta
/libtta.make
46 # compile flags for codecs
47 CODECFLAGS
= $(filter-out -fno-strict-aliasing
,$(CFLAGS
)) -fstrict-aliasing \
48 -I
$(APPSDIR
)/codecs
-I
$(APPSDIR
)/codecs
/lib
-DCODEC
51 CONFIGFILE
:= $(FIRMDIR
)/export/config
/$(MODELNAME
).h
52 CODEC_LDS
:= $(APPSDIR
)/plugins
/plugin.lds
# codecs and plugins use same file
53 CODECLINK_LDS
:= $(CODECDIR
)/codec.link
56 CODEC_CRT0
:= $(CODECDIR
)/codec_crt0.o
58 CODECLIBS
:= $(DEMACLIB
) $(A52LIB
) $(ALACLIB
) $(ASAPLIB
) \
59 $(FAADLIB
) $(FFMPEGFLACLIB
) $(M4ALIB
) $(MADLIB
) $(MUSEPACKLIB
) \
60 $(SPCLIB
) $(SPEEXLIB
) $(TREMORLIB
) $(WAVPACKLIB
) $(WMALIB
) $(COOKLIB
) \
64 $(CODECS
): $(CODEC_CRT0
) $(CODECLINK_LDS
)
66 $(CODECLINK_LDS
): $(CODEC_LDS
) $(CONFIGFILE
)
67 $(call PRINTS
,PP
$(@F
))
68 $(shell mkdir
-p
$(dir $@
))
69 $(call preprocess2file
, $<, $@
, -DCODEC
)
71 # codec/library dependencies
72 $(CODECDIR
)/spc.codec
: $(CODECDIR
)/libspc.a
73 $(CODECDIR
)/mpa.codec
: $(CODECDIR
)/libmad.a
74 $(CODECDIR
)/a52.codec
: $(CODECDIR
)/liba52.a
75 $(CODECDIR
)/flac.codec
: $(CODECDIR
)/libffmpegFLAC.a
76 $(CODECDIR
)/vorbis.codec
: $(CODECDIR
)/libtremor.a
$(TLSFLIB
)
77 $(CODECDIR
)/speex.codec
: $(CODECDIR
)/libspeex.a
78 $(CODECDIR
)/mpc.codec
: $(CODECDIR
)/libmusepack.a
79 $(CODECDIR
)/wavpack.codec
: $(CODECDIR
)/libwavpack.a
80 $(CODECDIR
)/alac.codec
: $(CODECDIR
)/libalac.a
$(CODECDIR
)/libm4a.a
81 $(CODECDIR
)/aac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/libm4a.a
82 $(CODECDIR
)/shorten.codec
: $(CODECDIR
)/libffmpegFLAC.a
83 $(CODECDIR
)/ape-pre.map
: $(CODECDIR
)/libdemac-pre.a
84 $(CODECDIR
)/ape.codec
: $(CODECDIR
)/libdemac.a
85 $(CODECDIR
)/wma.codec
: $(CODECDIR
)/libwma.a
$(CODECDIR
)/libasf.a
86 $(CODECDIR
)/wmapro.codec
: $(CODECDIR
)/libwma.a
$(CODECDIR
)/libasf.a
87 $(CODECDIR
)/wavpack_enc.codec
: $(CODECDIR
)/libwavpack.a
88 $(CODECDIR
)/asap.codec
: $(CODECDIR
)/libasap.a
89 $(CODECDIR
)/cook.codec
: $(CODECDIR
)/libcook.a
$(CODECDIR
)/librm.a
90 $(CODECDIR
)/raac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/librm.a
91 $(CODECDIR
)/a52_rm.codec
: $(CODECDIR
)/liba52.a
$(CODECDIR
)/librm.a
92 $(CODECDIR
)/atrac3_rm.codec
: $(CODECDIR
)/libatrac.a
$(CODECDIR
)/librm.a
93 $(CODECDIR
)/atrac3_oma.codec
: $(CODECDIR
)/libatrac.a
94 $(CODECDIR
)/aiff.codec
: $(CODECDIR
)/libpcm.a
95 $(CODECDIR
)/wav.codec
: $(CODECDIR
)/libpcm.a
96 $(CODECDIR
)/smaf.codec
: $(CODECDIR
)/libpcm.a
97 $(CODECDIR
)/au.codec
: $(CODECDIR
)/libpcm.a
98 $(CODECDIR
)/vox.codec
: $(CODECDIR
)/libpcm.a
99 $(CODECDIR
)/wav64.codec
: $(CODECDIR
)/libpcm.a
100 $(CODECDIR
)/tta.codec
: $(CODECDIR
)/libtta.a
102 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
104 # libfaad and libmusepack both contain a huffman.h file, with different
105 # content. So we compile them with special command lines:
107 # pattern rule for compiling codecs
108 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
109 $(SILENT
)mkdir
-p
$(dir $@
)
110 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
111 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
113 # pattern rule for compiling codecs
114 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
115 $(SILENT
)mkdir
-p
$(dir $@
)
116 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
117 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
120 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
122 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
123 CODECFLAGS
+= -UDEBUG
-DNDEBUG
126 $(CODECDIR
)/%-pre.map
: $(CODEC_CRT0
) $(CODECLINK_LDS
) $(CODECDIR
)/%.o
$(CODECLIB
)
127 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*-pre.elf \
129 $(filter-out $(CODECLIB
),$(filter %.a
, $+)) \
131 -lgcc
$(subst .map
,-pre.map
,$(CODECLDFLAGS
))
133 $(CODECDIR
)/%.codec
: $(CODECDIR
)/%.o
134 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*.elf \
137 -lgcc
$(CODECLDFLAGS
)
139 $(SILENT
)cp
$(CODECDIR
)/$*.elf
$@
141 $(SILENT
)$(OC
) -O binary
$(CODECDIR
)/$*.elf
$@