3rd part of FS#12176. Gain setting migrated to fixed point for libgme.
[kugel-rb.git] / apps / codecs / codecs.make
blob19ff60ba3ab6a197fd00ac9752a94ef5ec13c895
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
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
24 # the codec libraries
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
46 include $(APPSDIR)/codecs/libgme/libay.make
47 include $(APPSDIR)/codecs/libgme/libgbs.make
48 include $(APPSDIR)/codecs/libgme/libhes.make
49 include $(APPSDIR)/codecs/libgme/libnsf.make
50 include $(APPSDIR)/codecs/libgme/libsgc.make
51 include $(APPSDIR)/codecs/libgme/libvgm.make
52 include $(APPSDIR)/codecs/libgme/libkss.make
54 # compile flags for codecs
55 CODECFLAGS = $(CFLAGS) -fstrict-aliasing -I$(APPSDIR)/codecs \
56 -I$(APPSDIR)/codecs/lib -DCODEC
58 ifndef APP_TYPE
59 CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h
60 CODEC_LDS := $(APPSDIR)/plugins/plugin.lds # codecs and plugins use same file
61 CODECLINK_LDS := $(CODECDIR)/codec.link
62 endif
64 CODEC_CRT0 := $(CODECDIR)/codec_crt0.o
66 $(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS)
68 $(CODECLINK_LDS): $(CODEC_LDS) $(CONFIGFILE)
69 $(call PRINTS,PP $(@F))
70 $(shell mkdir -p $(dir $@))
71 $(call preprocess2file, $<, $@, -DCODEC)
73 # codec/library dependencies
74 $(CODECDIR)/spc.codec : $(CODECDIR)/libspc.a
75 $(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a
76 $(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a
77 $(CODECDIR)/flac.codec : $(CODECDIR)/libffmpegFLAC.a
78 $(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a $(TLSFLIB)
79 $(CODECDIR)/speex.codec : $(CODECDIR)/libspeex.a
80 $(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a
81 $(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.a
82 $(CODECDIR)/alac.codec : $(CODECDIR)/libalac.a $(CODECDIR)/libm4a.a
83 $(CODECDIR)/aac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/libm4a.a
84 $(CODECDIR)/shorten.codec : $(CODECDIR)/libffmpegFLAC.a
85 $(CODECDIR)/ape-pre.map : $(CODECDIR)/libdemac-pre.a
86 $(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a
87 $(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a $(CODECDIR)/libasf.a
88 $(CODECDIR)/wmapro.codec : $(CODECDIR)/libwmapro.a $(CODECDIR)/libasf.a
89 $(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a
90 $(CODECDIR)/asap.codec : $(CODECDIR)/libasap.a
91 $(CODECDIR)/cook.codec : $(CODECDIR)/libcook.a $(CODECDIR)/librm.a
92 $(CODECDIR)/raac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/librm.a
93 $(CODECDIR)/a52_rm.codec : $(CODECDIR)/liba52.a $(CODECDIR)/librm.a
94 $(CODECDIR)/atrac3_rm.codec : $(CODECDIR)/libatrac.a $(CODECDIR)/librm.a
95 $(CODECDIR)/atrac3_oma.codec : $(CODECDIR)/libatrac.a
96 $(CODECDIR)/aiff.codec : $(CODECDIR)/libpcm.a
97 $(CODECDIR)/wav.codec : $(CODECDIR)/libpcm.a
98 $(CODECDIR)/smaf.codec : $(CODECDIR)/libpcm.a
99 $(CODECDIR)/au.codec : $(CODECDIR)/libpcm.a
100 $(CODECDIR)/vox.codec : $(CODECDIR)/libpcm.a
101 $(CODECDIR)/wav64.codec : $(CODECDIR)/libpcm.a
102 $(CODECDIR)/tta.codec : $(CODECDIR)/libtta.a
103 $(CODECDIR)/ay.codec : $(CODECDIR)/libay.a
104 $(CODECDIR)/gbs.codec : $(CODECDIR)/libgbs.a
105 $(CODECDIR)/hes.codec : $(CODECDIR)/libhes.a
106 $(CODECDIR)/nsf.codec : $(CODECDIR)/libnsf.a
107 $(CODECDIR)/sgc.codec : $(CODECDIR)/libsgc.a
108 $(CODECDIR)/vgm.codec : $(CODECDIR)/libvgm.a
109 $(CODECDIR)/kss.codec : $(CODECDIR)/libkss.a
111 $(CODECS): $(CODECLIB) # this must be last in codec dependency list
113 # libfaad and libmusepack both contain a huffman.h file, with different
114 # content. So we compile them with special command lines:
116 # pattern rule for compiling codecs
117 $(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.c
118 $(SILENT)mkdir -p $(dir $@)
119 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
120 -I$(dir $<) $(CODECFLAGS) -c $< -o $@
122 # pattern rule for compiling codecs
123 $(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.S
124 $(SILENT)mkdir -p $(dir $@)
125 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
126 -I$(dir $<) $(CODECFLAGS) $(ASMFLAGS) -c $< -o $@
128 ifdef APP_TYPE
129 CODECLDFLAGS = $(SHARED_LDFLAG) # <-- from Makefile
130 CODECFLAGS += $(SHARED_CFLAGS) # <-- from Makefile
131 else
132 CODECLDFLAGS = -T$(CODECLINK_LDS) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map
133 CODECFLAGS += -UDEBUG -DNDEBUG
134 endif
135 CODECLDFLAGS += $(GLOBAL_LDOPTS)
137 $(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECLIB)
138 $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \
139 $(filter %.o, $^) \
140 $(filter-out $(CODECLIB),$(filter %.a, $+)) \
141 $(CODECLIB) \
142 -lgcc $(subst .map,-pre.map,$(CODECLDFLAGS))
144 $(CODECDIR)/%.codec: $(CODECDIR)/%.o $(LIBSETJMP)
145 $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \
146 $(filter %.o, $^) \
147 $(filter %.a, $+) \
148 -lgcc $(CODECLDFLAGS)
149 ifdef APP_TYPE
150 $(SILENT)cp $(CODECDIR)/$*.elf $@
151 else
152 $(SILENT)$(OC) -O binary $(CODECDIR)/$*.elf $@
153 endif