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 # the codec helper library
18 include $(APPSDIR
)/codecs
/lib
/libcodec.make
19 OTHER_INC
+= -I
$(APPSDIR
)/codecs
/lib
22 include $(APPSDIR
)/codecs
/demac
/libdemac.make
23 include $(APPSDIR
)/codecs
/liba52
/liba52.make
24 include $(APPSDIR
)/codecs
/libalac
/libalac.make
25 include $(APPSDIR
)/codecs
/libasap
/libasap.make
26 include $(APPSDIR
)/codecs
/libfaad
/libfaad.make
27 include $(APPSDIR
)/codecs
/libffmpegFLAC
/libffmpegFLAC.make
28 include $(APPSDIR
)/codecs
/libm4a
/libm4a.make
29 include $(APPSDIR
)/codecs
/libmad
/libmad.make
30 include $(APPSDIR
)/codecs
/libmusepack
/libmusepack.make
31 include $(APPSDIR
)/codecs
/libspc
/libspc.make
32 include $(APPSDIR
)/codecs
/libspeex
/libspeex.make
33 include $(APPSDIR
)/codecs
/libtremor
/libtremor.make
34 include $(APPSDIR
)/codecs
/libwavpack
/libwavpack.make
35 include $(APPSDIR
)/codecs
/libwma
/libwma.make
36 include $(APPSDIR
)/codecs
/libcook
/libcook.make
37 include $(APPSDIR
)/codecs
/librm
/librm.make
38 include $(APPSDIR
)/codecs
/libatrac
/libatrac.make
40 # compile flags for codecs
41 CODECFLAGS
= $(CFLAGS
) -I
$(APPSDIR
)/codecs
-I
$(APPSDIR
)/codecs
/lib \
45 CODEC_LDS
:= $(APPSDIR
)/plugins
/plugin.lds
# codecs and plugins use same file
46 CODECLINK_LDS
:= $(CODECDIR
)/codec.link
49 CODEC_CRT0
:= $(CODECDIR
)/codec_crt0.o
51 CODECLIBS
:= $(DEMACLIB
) $(A52LIB
) $(ALACLIB
) $(ASAPLIB
) \
52 $(FAADLIB
) $(FFMPEGFLACLIB
) $(M4ALIB
) $(MADLIB
) $(MUSEPACKLIB
) \
53 $(SPCLIB
) $(SPEEXLIB
) $(TREMORLIB
) $(WAVPACKLIB
) $(WMALIB
) $(COOKLIB
) \
57 $(CODECS
): $(CODEC_CRT0
) $(CODECLINK_LDS
)
59 $(CODECLINK_LDS
): $(CODEC_LDS
)
60 $(call PRINTS
,PP
$(@F
))
61 $(shell mkdir
-p
$(dir $@
))
62 $(call preprocess2file
, $<, $@
, -DCODEC
)
64 # codec/library dependencies
65 $(CODECDIR
)/spc.codec
: $(CODECDIR
)/libspc.a
66 $(CODECDIR
)/mpa.codec
: $(CODECDIR
)/libmad.a
67 $(CODECDIR
)/a52.codec
: $(CODECDIR
)/liba52.a
68 $(CODECDIR
)/flac.codec
: $(CODECDIR
)/libffmpegFLAC.a
69 $(CODECDIR
)/vorbis.codec
: $(CODECDIR
)/libtremor.a
70 $(CODECDIR
)/speex.codec
: $(CODECDIR
)/libspeex.a
71 $(CODECDIR
)/mpc.codec
: $(CODECDIR
)/libmusepack.a
72 $(CODECDIR
)/wavpack.codec
: $(CODECDIR
)/libwavpack.a
73 $(CODECDIR
)/alac.codec
: $(CODECDIR
)/libalac.a
$(CODECDIR
)/libm4a.a
74 $(CODECDIR
)/aac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/libm4a.a
75 $(CODECDIR
)/shorten.codec
: $(CODECDIR
)/libffmpegFLAC.a
76 $(CODECDIR
)/ape.codec
: $(CODECDIR
)/libdemac.a
77 $(CODECDIR
)/wma.codec
: $(CODECDIR
)/libwma.a
78 $(CODECDIR
)/wavpack_enc.codec
: $(CODECDIR
)/libwavpack.a
79 $(CODECDIR
)/asap.codec
: $(CODECDIR
)/libasap.a
80 $(CODECDIR
)/cook.codec
: $(CODECDIR
)/libcook.a
$(CODECDIR
)/librm.a
81 $(CODECDIR
)/raac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/librm.a
82 $(CODECDIR
)/a52_rm.codec
: $(CODECDIR
)/liba52.a
$(CODECDIR
)/librm.a
83 $(CODECDIR
)/atrac3_rm.codec
: $(CODECDIR
)/libatrac.a
$(CODECDIR
)/librm.a
85 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
87 # libfaad and libmusepack both contain a huffman.h file, with different
88 # content. So we compile them with special command lines:
90 # pattern rule for compiling codecs
91 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
92 $(SILENT
)mkdir
-p
$(dir $@
)
93 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
94 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
96 # pattern rule for compiling codecs
97 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
98 $(SILENT
)mkdir
-p
$(dir $@
)
99 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
100 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
103 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
105 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
106 CODECFLAGS
+= -UDEBUG
-DNDEBUG
109 $(CODECDIR
)/%.codec
: $(CODECDIR
)/%.o
110 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*.elf \
113 -lgcc
$(CODECLDFLAGS
)
115 $(SILENT
)cp
$(CODECDIR
)/$*.elf
$@
117 $(SILENT
)$(OC
) -O binary
$(CODECDIR
)/$*.elf
$@