2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
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
21 include $(APPSDIR
)/codecs
/demac
/libdemac.make
22 include $(APPSDIR
)/codecs
/liba52
/liba52.make
23 include $(APPSDIR
)/codecs
/libalac
/libalac.make
24 include $(APPSDIR
)/codecs
/libasap
/libasap.make
25 include $(APPSDIR
)/codecs
/libfaad
/libfaad.make
26 include $(APPSDIR
)/codecs
/libffmpegFLAC
/libffmpegFLAC.make
27 include $(APPSDIR
)/codecs
/libm4a
/libm4a.make
28 include $(APPSDIR
)/codecs
/libmad
/libmad.make
29 include $(APPSDIR
)/codecs
/libmusepack
/libmusepack.make
30 include $(APPSDIR
)/codecs
/libspc
/libspc.make
31 include $(APPSDIR
)/codecs
/libspeex
/libspeex.make
32 include $(APPSDIR
)/codecs
/libtremor
/libtremor.make
33 include $(APPSDIR
)/codecs
/libwavpack
/libwavpack.make
34 include $(APPSDIR
)/codecs
/libwma
/libwma.make
36 # compile flags for codecs
37 CODECFLAGS
= $(CFLAGS
) -I
$(APPSDIR
)/codecs
-I
$(APPSDIR
)/codecs
/lib \
40 CODEC_LDS
:= $(APPSDIR
)/plugins
/plugin.lds
# codecs and plugins use same file
41 CODECLINK_LDS
:= $(CODECDIR
)/codec.link
42 CODEC_CRT0
:= $(CODECDIR
)/codec_crt0.o
44 CODECLIBS
:= $(DEMACLIB
) $(A52LIB
) $(ALACLIB
) $(ASAPLIB
) \
45 $(FAADLIB
) $(FFMPEGFLACLIB
) $(M4ALIB
) $(MADLIB
) $(MUSEPACKLIB
) \
46 $(SPCLIB
) $(SPEEXLIB
) $(TREMORLIB
) $(WAVPACKLIB
) $(WMALIB
) \
49 $(CODECS
): $(CODEC_CRT0
) $(CODECLINK_LDS
)
51 $(CODECLINK_LDS
): $(CODEC_LDS
)
52 $(call PRINTS
,PP
$(@F
))
53 $(call preprocess2file
, $<, $@
)
55 # codec/library dependencies
56 $(CODECDIR
)/spc.codec
: $(CODECDIR
)/libspc.a
57 $(CODECDIR
)/mpa.codec
: $(CODECDIR
)/libmad.a
58 $(CODECDIR
)/a52.codec
: $(CODECDIR
)/liba52.a
59 $(CODECDIR
)/flac.codec
: $(CODECDIR
)/libffmpegFLAC.a
60 $(CODECDIR
)/vorbis.codec
: $(CODECDIR
)/libtremor.a
61 $(CODECDIR
)/speex.codec
: $(CODECDIR
)/libspeex.a
62 $(CODECDIR
)/mpc.codec
: $(CODECDIR
)/libmusepack.a
63 $(CODECDIR
)/wavpack.codec
: $(CODECDIR
)/libwavpack.a
64 $(CODECDIR
)/alac.codec
: $(CODECDIR
)/libalac.a
$(CODECDIR
)/libm4a.a
65 $(CODECDIR
)/aac.codec
: $(CODECDIR
)/libfaad.a
$(CODECDIR
)/libm4a.a
66 $(CODECDIR
)/shorten.codec
: $(CODECDIR
)/libffmpegFLAC.a
67 $(CODECDIR
)/ape.codec
: $(CODECDIR
)/libdemac.a
68 $(CODECDIR
)/wma.codec
: $(CODECDIR
)/libwma.a
69 $(CODECDIR
)/wavpack_enc.codec
: $(CODECDIR
)/libwavpack.a
70 $(CODECDIR
)/asap.codec
: $(CODECDIR
)/libasap.a
72 $(CODECS
): $(CODECLIB
) # this must be last in codec dependency list
74 # libfaad and libmusepack both contain a huffman.h file, with different
75 # content. So we compile them with special command lines:
77 # pattern rule for compiling codecs
78 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.c
79 $(SILENT
)mkdir
-p
$(dir $@
)
80 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
81 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
83 # pattern rule for compiling codecs
84 $(CODECDIR
)/%.o
: $(ROOTDIR
)/apps
/codecs
/%.S
85 $(SILENT
)mkdir
-p
$(dir $@
)
86 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) \
87 -I
$(dir $<) $(CODECFLAGS
) -c
$< -o
$@
90 CODECLDFLAGS
= $(SHARED_FLAG
) # <-- from Makefile
92 CODECLDFLAGS
= -T
$(CODECLINK_LDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(CODECDIR
)/$*.map
93 CODECFLAGS
+= -UDEBUG
-DNDEBUG
96 $(CODECDIR
)/%.codec
: $(CODECDIR
)/%.o
97 $(call PRINTS
,LD
$(@F
))$(CC
) $(CODECFLAGS
) -o
$(CODECDIR
)/$*.elf \
100 -lgcc
$(CODECLDFLAGS
)
102 $(SILENT
)$(shell cp
$(BUILDDIR
)/$*.elf
$@
)
104 $(SILENT
)$(OC
) -O binary
$(CODECDIR
)/$*.elf
$@