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
/libwmapro
/libwmapro.make
41 include $(APPSDIR
)/codecs
/libcook
/libcook.make
42 include $(APPSDIR
)/codecs
/librm
/librm.make
43 include $(APPSDIR
)/codecs
/libatrac
/libatrac.make
44 include $(APPSDIR
)/codecs
/libpcm
/libpcm.make
45 include $(APPSDIR
)/codecs
/libtta
/libtta.make
47 # compile flags for codecs
48 CODECFLAGS
= $(CFLAGS
) -fstrict-aliasing
-I
$(APPSDIR
)/codecs \
49 -I
$(APPSDIR
)/codecs
/lib
-DCODEC
52 CONFIGFILE
:= $(FIRMDIR
)/export/config
/$(MODELNAME
).h
53 CODEC_LDS
:= $(APPSDIR
)/plugins
/plugin.lds
# codecs and plugins use same file
54 CODECLINK_LDS
:= $(CODECDIR
)/codec.link
57 CODEC_CRT0
:= $(CODECDIR
)/codec_crt0.o
59 $(CODECS
): $(CODEC_CRT0
) $(CODECLINK_LDS
)
61 $(CODECLINK_LDS
): $(CODEC_LDS
) $(CONFIGFILE
)
62 $(call PRINTS
,PP
$(@F
))
63 $(shell mkdir
-p
$(dir $@
))
64 $(call preprocess2file
, $<, $@
, -DCODEC
)
66 # codec/library dependencies
67 $(CODECDIR
)/spc.codec
: $(CODECDIR
)/libspc.a
68 $(CODECDIR
)/mpa.codec
: $(CODECDIR
)/libmad.a
69 $(CODECDIR
)/a52.codec
: $(CODECDIR
)/liba52.a
70 $(CODECDIR
)/flac.codec
: $(CODECDIR
)/libffmpegFLAC.a
71 $(CODECDIR
)/vorbis.codec
: $(CODECDIR
)/libtremor.a
$(TLSFLIB
)
72 $(CODECDIR
)/speex.codec
: $(CODECDIR
)/libspeex.a
73 $(CODECDIR
)/mpc.codec
: $(CODECDIR
)/libmusepack.a
74 $(CODECDIR
)/wavpack.codec
: $(CODECDIR
)/libwavpack.a
75 $(CODECDIR
)/alac.codec
: $(CODECDIR
)/libalac.a
$(CODECDIR
)/libm4a.a
76 $(CODECDIR
)/aac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/libm4a.a
77 $(CODECDIR
)/shorten.codec
: $(CODECDIR
)/libffmpegFLAC.a
78 $(CODECDIR
)/ape-pre.map
: $(CODECDIR
)/libdemac-pre.a
79 $(CODECDIR
)/ape.codec
: $(CODECDIR
)/libdemac.a
80 $(CODECDIR
)/wma.codec
: $(CODECDIR
)/libwma.a
$(CODECDIR
)/libasf.a
81 $(CODECDIR
)/wmapro.codec
: $(CODECDIR
)/libwmapro.a
$(CODECDIR
)/libasf.a
82 $(CODECDIR
)/wavpack_enc.codec
: $(CODECDIR
)/libwavpack.a
83 $(CODECDIR
)/asap.codec
: $(CODECDIR
)/libasap.a
84 $(CODECDIR
)/cook.codec
: $(CODECDIR
)/libcook.a
$(CODECDIR
)/librm.a
85 $(CODECDIR
)/raac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/librm.a
86 $(CODECDIR
)/a52_rm.codec
: $(CODECDIR
)/liba52.a
$(CODECDIR
)/librm.a
87 $(CODECDIR
)/atrac3_rm.codec
: $(CODECDIR
)/libatrac.a
$(CODECDIR
)/librm.a
88 $(CODECDIR
)/atrac3_oma.codec
: $(CODECDIR
)/libatrac.a
89 $(CODECDIR
)/aiff.codec
: $(CODECDIR
)/libpcm.a
90 $(CODECDIR
)/wav.codec
: $(CODECDIR
)/libpcm.a
91 $(CODECDIR
)/smaf.codec
: $(CODECDIR
)/libpcm.a
92 $(CODECDIR
)/au.codec
: $(CODECDIR
)/libpcm.a
93 $(CODECDIR
)/vox.codec
: $(CODECDIR
)/libpcm.a
94 $(CODECDIR
)/wav64.codec
: $(CODECDIR
)/libpcm.a
95 $(CODECDIR
)/tta.codec
: $(CODECDIR
)/libtta.a
97 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
99 # libfaad and libmusepack both contain a huffman.h file, with different
100 # content. So we compile them with special command lines:
102 # pattern rule for compiling codecs
103 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
104 $(SILENT
)mkdir
-p
$(dir $@
)
105 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
106 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
108 # pattern rule for compiling codecs
109 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
110 $(SILENT
)mkdir
-p
$(dir $@
)
111 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
112 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
115 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
117 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
118 CODECFLAGS
+= -UDEBUG
-DNDEBUG
120 CODECLDFLAGS
+= $(GLOBAL_LDOPTS
)
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
$@