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
81 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
83 # libfaad and libmusepack both contain a huffman.h file, with different
84 # content. So we compile them with special command lines:
86 # pattern rule for compiling codecs
87 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
88 $(SILENT
)mkdir
-p
$(dir $@
)
89 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
90 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
92 # pattern rule for compiling codecs
93 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
94 $(SILENT
)mkdir
-p
$(dir $@
)
95 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
96 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
99 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
101 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
102 CODECFLAGS
+= -UDEBUG
-DNDEBUG
105 $(CODECDIR
)/%.codec
: $(CODECDIR
)/%.o
106 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*.elf \
109 -lgcc
$(CODECLDFLAGS
)
111 $(SILENT
)cp
$(CODECDIR
)/$*.elf
$@
113 $(SILENT
)$(OC
) -O binary
$(CODECDIR
)/$*.elf
$@