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
/libfaad
/libfaad.make
30 include $(APPSDIR
)/codecs
/libffmpegFLAC
/libffmpegFLAC.make
31 include $(APPSDIR
)/codecs
/libm4a
/libm4a.make
32 include $(APPSDIR
)/codecs
/libmad
/libmad.make
33 include $(APPSDIR
)/codecs
/libmusepack
/libmusepack.make
34 include $(APPSDIR
)/codecs
/libspc
/libspc.make
35 include $(APPSDIR
)/codecs
/libspeex
/libspeex.make
36 include $(APPSDIR
)/codecs
/libtremor
/libtremor.make
37 include $(APPSDIR
)/codecs
/libwavpack
/libwavpack.make
38 include $(APPSDIR
)/codecs
/libwma
/libwma.make
39 include $(APPSDIR
)/codecs
/libcook
/libcook.make
40 include $(APPSDIR
)/codecs
/librm
/librm.make
41 include $(APPSDIR
)/codecs
/libatrac
/libatrac.make
42 include $(APPSDIR
)/codecs
/libpcm
/libpcm.make
44 # compile flags for codecs
45 CODECFLAGS
= $(filter-out -fno-strict-aliasing
,$(CFLAGS
)) -fstrict-aliasing \
46 -I
$(APPSDIR
)/codecs
-I
$(APPSDIR
)/codecs
/lib
-DCODEC
49 CONFIGFILE
:= $(FIRMDIR
)/export/config
/$(MODELNAME
).h
50 CODEC_LDS
:= $(APPSDIR
)/plugins
/plugin.lds
# codecs and plugins use same file
51 CODECLINK_LDS
:= $(CODECDIR
)/codec.link
54 CODEC_CRT0
:= $(CODECDIR
)/codec_crt0.o
56 CODECLIBS
:= $(DEMACLIB
) $(A52LIB
) $(ALACLIB
) $(ASAPLIB
) \
57 $(FAADLIB
) $(FFMPEGFLACLIB
) $(M4ALIB
) $(MADLIB
) $(MUSEPACKLIB
) \
58 $(SPCLIB
) $(SPEEXLIB
) $(TREMORLIB
) $(WAVPACKLIB
) $(WMALIB
) $(COOKLIB
) \
62 $(CODECS
): $(CODEC_CRT0
) $(CODECLINK_LDS
)
64 $(CODECLINK_LDS
): $(CODEC_LDS
) $(CONFIGFILE
)
65 $(call PRINTS
,PP
$(@F
))
66 $(shell mkdir
-p
$(dir $@
))
67 $(call preprocess2file
, $<, $@
, -DCODEC
)
69 # codec/library dependencies
70 $(CODECDIR
)/spc.codec
: $(CODECDIR
)/libspc.a
71 $(CODECDIR
)/mpa.codec
: $(CODECDIR
)/libmad.a
72 $(CODECDIR
)/a52.codec
: $(CODECDIR
)/liba52.a
73 $(CODECDIR
)/flac.codec
: $(CODECDIR
)/libffmpegFLAC.a
74 $(CODECDIR
)/vorbis.codec
: $(CODECDIR
)/libtremor.a
$(TLSFLIB
)
75 $(CODECDIR
)/speex.codec
: $(CODECDIR
)/libspeex.a
76 $(CODECDIR
)/mpc.codec
: $(CODECDIR
)/libmusepack.a
77 $(CODECDIR
)/wavpack.codec
: $(CODECDIR
)/libwavpack.a
78 $(CODECDIR
)/alac.codec
: $(CODECDIR
)/libalac.a
$(CODECDIR
)/libm4a.a
79 $(CODECDIR
)/aac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/libm4a.a
80 $(CODECDIR
)/shorten.codec
: $(CODECDIR
)/libffmpegFLAC.a
81 $(CODECDIR
)/ape-pre.map
: $(CODECDIR
)/libdemac-pre.a
82 $(CODECDIR
)/ape.codec
: $(CODECDIR
)/libdemac.a
83 $(CODECDIR
)/wma.codec
: $(CODECDIR
)/libwma.a
84 $(CODECDIR
)/wavpack_enc.codec
: $(CODECDIR
)/libwavpack.a
85 $(CODECDIR
)/asap.codec
: $(CODECDIR
)/libasap.a
86 $(CODECDIR
)/cook.codec
: $(CODECDIR
)/libcook.a
$(CODECDIR
)/librm.a
87 $(CODECDIR
)/raac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/librm.a
88 $(CODECDIR
)/a52_rm.codec
: $(CODECDIR
)/liba52.a
$(CODECDIR
)/librm.a
89 $(CODECDIR
)/atrac3_rm.codec
: $(CODECDIR
)/libatrac.a
$(CODECDIR
)/librm.a
90 $(CODECDIR
)/atrac3_oma.codec
: $(CODECDIR
)/libatrac.a
91 $(CODECDIR
)/aiff.codec
: $(CODECDIR
)/libpcm.a
92 $(CODECDIR
)/wav.codec
: $(CODECDIR
)/libpcm.a
93 $(CODECDIR
)/smaf.codec
: $(CODECDIR
)/libpcm.a
94 $(CODECDIR
)/au.codec
: $(CODECDIR
)/libpcm.a
95 $(CODECDIR
)/vox.codec
: $(CODECDIR
)/libpcm.a
96 $(CODECDIR
)/wav64.codec
: $(CODECDIR
)/libpcm.a
98 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
100 # libfaad and libmusepack both contain a huffman.h file, with different
101 # content. So we compile them with special command lines:
103 # pattern rule for compiling codecs
104 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
105 $(SILENT
)mkdir
-p
$(dir $@
)
106 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
107 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
109 # pattern rule for compiling codecs
110 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
111 $(SILENT
)mkdir
-p
$(dir $@
)
112 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
113 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
116 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
118 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
119 CODECFLAGS
+= -UDEBUG
-DNDEBUG
122 $(CODECDIR
)/%-pre.map
: $(CODEC_CRT0
) $(CODECLINK_LDS
) $(CODECDIR
)/%.o
$(CODECLIB
)
123 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*-pre.elf \
125 $(filter-out $(CODECLIB
),$(filter %.a
, $+)) \
127 -lgcc
$(subst .map
,-pre.map
,$(CODECLDFLAGS
))
129 $(CODECDIR
)/%.codec
: $(CODECDIR
)/%.o
130 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*.elf \
133 -lgcc
$(CODECLDFLAGS
)
135 $(SILENT
)cp
$(CODECDIR
)/$*.elf
$@
137 $(SILENT
)$(OC
) -O binary
$(CODECDIR
)/$*.elf
$@