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
39 # compile flags for codecs
40 CODECFLAGS
= $(CFLAGS
) -I
$(APPSDIR
)/codecs
-I
$(APPSDIR
)/codecs
/lib \
44 CODEC_LDS
:= $(APPSDIR
)/plugins
/plugin.lds
# codecs and plugins use same file
45 CODECLINK_LDS
:= $(CODECDIR
)/codec.link
48 CODEC_CRT0
:= $(CODECDIR
)/codec_crt0.o
50 CODECLIBS
:= $(DEMACLIB
) $(A52LIB
) $(ALACLIB
) $(ASAPLIB
) \
51 $(FAADLIB
) $(FFMPEGFLACLIB
) $(M4ALIB
) $(MADLIB
) $(MUSEPACKLIB
) \
52 $(SPCLIB
) $(SPEEXLIB
) $(TREMORLIB
) $(WAVPACKLIB
) $(WMALIB
) $(COOKLIB
) \
55 $(CODECS
): $(CODEC_CRT0
) $(CODECLINK_LDS
)
57 $(CODECLINK_LDS
): $(CODEC_LDS
)
58 $(call PRINTS
,PP
$(@F
))
59 $(shell mkdir
-p
$(dir $@
))
60 $(call preprocess2file
, $<, $@
, -DCODEC
)
62 # codec/library dependencies
63 $(CODECDIR
)/spc.codec
: $(CODECDIR
)/libspc.a
64 $(CODECDIR
)/mpa.codec
: $(CODECDIR
)/libmad.a
65 $(CODECDIR
)/a52.codec
: $(CODECDIR
)/liba52.a
66 $(CODECDIR
)/flac.codec
: $(CODECDIR
)/libffmpegFLAC.a
67 $(CODECDIR
)/vorbis.codec
: $(CODECDIR
)/libtremor.a
68 $(CODECDIR
)/speex.codec
: $(CODECDIR
)/libspeex.a
69 $(CODECDIR
)/mpc.codec
: $(CODECDIR
)/libmusepack.a
70 $(CODECDIR
)/wavpack.codec
: $(CODECDIR
)/libwavpack.a
71 $(CODECDIR
)/alac.codec
: $(CODECDIR
)/libalac.a
$(CODECDIR
)/libm4a.a
72 $(CODECDIR
)/aac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/libm4a.a
73 $(CODECDIR
)/shorten.codec
: $(CODECDIR
)/libffmpegFLAC.a
74 $(CODECDIR
)/ape.codec
: $(CODECDIR
)/libdemac.a
75 $(CODECDIR
)/wma.codec
: $(CODECDIR
)/libwma.a
76 $(CODECDIR
)/wavpack_enc.codec
: $(CODECDIR
)/libwavpack.a
77 $(CODECDIR
)/asap.codec
: $(CODECDIR
)/libasap.a
78 $(CODECDIR
)/cook.codec
: $(CODECDIR
)/libcook.a
$(CODECDIR
)/librm.a
79 $(CODECDIR
)/raac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/librm.a
80 $(CODECDIR
)/a52_rm.codec
: $(CODECDIR
)/liba52.a
$(CODECDIR
)/librm.a
82 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
84 # libfaad and libmusepack both contain a huffman.h file, with different
85 # content. So we compile them with special command lines:
87 # pattern rule for compiling codecs
88 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
89 $(SILENT
)mkdir
-p
$(dir $@
)
90 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
91 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
93 # pattern rule for compiling codecs
94 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
95 $(SILENT
)mkdir
-p
$(dir $@
)
96 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
97 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
100 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
102 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
103 CODECFLAGS
+= -UDEBUG
-DNDEBUG
106 $(CODECDIR
)/%.codec
: $(CODECDIR
)/%.o
107 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*.elf \
110 -lgcc
$(CODECLDFLAGS
)
112 $(SILENT
)cp
$(CODECDIR
)/$*.elf
$@
114 $(SILENT
)$(OC
) -O binary
$(CODECDIR
)/$*.elf
$@