2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
= -I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export -I
$(FIRMDIR
)/common \
11 -I
$(FIRMDIR
)/drivers
-I
$(APPSDIR
) -Ilib
-I
$(BUILDDIR
)
12 CFLAGS
= $(INCLUDES
) $(GCCOPTS
) $(TARGET_INC
) $(TARGET
) $(EXTRA_DEFINES
) \
13 -DTARGET_ID
=$(TARGET_ID
) -DMEM
=${MEMORYSIZE} -DCODEC
16 INCLUDES
+= $(patsubst %,-I
$(APPSDIR
)/%,$(subst :, ,$(APPEXTRA
)))
20 CODECLIBS
= -lmad
-la52
-lffmpegFLAC
-lTremor
-lwavpack
-lmusepack
-lalac
-lfaad
-lm4a
-lspeex
-ldemac
23 # we "borrow" the plugin LDS file
24 LDS
:= $(APPSDIR
)/plugins
/plugin.lds
26 LINKCODEC
:= $(OBJDIR
)/codeclink.lds
27 DEPFILE
= $(OBJDIR
)/dep-codecs
29 # This sets up 'SRC' based on the files mentioned in SOURCES
30 include $(TOOLSDIR
)/makesrc.inc
32 ROCKS
:= $(SRC
:%.c
=$(OBJDIR
)/%.codec
)
34 ELFS
:= $(SRC
:%.c
=$(OBJDIR
)/%.elf
)
35 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
36 # as created by the cross-compiler for win32:
37 DEFS
:= $(SRC
:%.c
=$(OBJDIR
)/%.def
)
40 CODECDEPS
= $(LINKCODEC
) $(BUILDDIR
)/libcodec.a
42 .PHONY
: libmad liba52 libffmpegFLAC libTremor libspeex libwavpack libmusepack libalac libfaad libm4a libdemac
44 OUTPUT
= $(SOFTWARECODECS
)
46 all: $(LINKCODEC
) $(ROCKS
)
49 $(BUILDDIR
)/%.a
: % $(CODECDEPS
)
51 $(OBJDIR
)/wav.elf
: $(OBJDIR
)/wav.o
$(OBJDIR
)/codec_crt0.o
52 $(OBJDIR
)/sid.elf
: $(OBJDIR
)/sid.o
$(OBJDIR
)/codec_crt0.o
53 $(OBJDIR
)/adx.elf
: $(OBJDIR
)/adx.o
$(OBJDIR
)/codec_crt0.o
54 $(OBJDIR
)/nsf.elf
: $(OBJDIR
)/nsf.o
$(OBJDIR
)/codec_crt0.o
55 $(OBJDIR
)/spc.elf
: $(OBJDIR
)/spc.o
$(OBJDIR
)/codec_crt0.o
56 $(OBJDIR
)/aiff.elf
: $(OBJDIR
)/aiff.o
$(OBJDIR
)/codec_crt0.o
57 $(OBJDIR
)/mpa.elf
: $(OBJDIR
)/mpa.o
$(BUILDDIR
)/libmad.a
$(OBJDIR
)/codec_crt0.o
58 $(OBJDIR
)/a52.elf
: $(OBJDIR
)/a52.o
$(BUILDDIR
)/liba52.a
$(OBJDIR
)/codec_crt0.o
59 $(OBJDIR
)/flac.elf
: $(OBJDIR
)/flac.o
$(BUILDDIR
)/libffmpegFLAC.a
$(OBJDIR
)/codec_crt0.o
60 $(OBJDIR
)/vorbis.elf
: $(OBJDIR
)/vorbis.o
$(BUILDDIR
)/libTremor.a
$(OBJDIR
)/codec_crt0.o
61 $(OBJDIR
)/speex.elf
: $(OBJDIR
)/speex.o
$(BUILDDIR
)/libspeex.a
$(OBJDIR
)/codec_crt0.o
62 $(OBJDIR
)/mpc.elf
: $(OBJDIR
)/mpc.o
$(BUILDDIR
)/libmusepack.a
$(OBJDIR
)/codec_crt0.o
63 $(OBJDIR
)/wavpack.elf
: $(OBJDIR
)/wavpack.o
$(BUILDDIR
)/libwavpack.a
$(OBJDIR
)/codec_crt0.o
64 $(OBJDIR
)/alac.elf
: $(OBJDIR
)/alac.o
$(BUILDDIR
)/libalac.a
$(BUILDDIR
)/libm4a.a
$(OBJDIR
)/codec_crt0.o
65 $(OBJDIR
)/aac.elf
: $(OBJDIR
)/aac.o
$(BUILDDIR
)/libfaad.a
$(BUILDDIR
)/libm4a.a
$(OBJDIR
)/codec_crt0.o
66 $(OBJDIR
)/shorten.elf
: $(OBJDIR
)/shorten.o
$(BUILDDIR
)/libffmpegFLAC.a
$(OBJDIR
)/codec_crt0.o
67 $(OBJDIR
)/ape.elf
: $(OBJDIR
)/ape.o
$(BUILDDIR
)/libdemac.a
$(OBJDIR
)/codec_crt0.o
68 $(OBJDIR
)/aiff_enc.elf
: $(OBJDIR
)/aiff_enc.o
$(OBJDIR
)/codec_crt0.o
69 $(OBJDIR
)/mp3_enc.elf
: $(OBJDIR
)/mp3_enc.o
$(OBJDIR
)/codec_crt0.o
70 $(OBJDIR
)/wav_enc.elf
: $(OBJDIR
)/wav_enc.o
$(OBJDIR
)/codec_crt0.o
71 $(OBJDIR
)/wavpack_enc.elf
: $(OBJDIR
)/wavpack_enc.o
$(BUILDDIR
)/libwavpack.a
$(OBJDIR
)/codec_crt0.o
73 $(OBJDIR
)/%.elf
: $(OBJDIR
)/codec_crt0.o
74 $(call PRINTS
,LD
$(@F
))$(CC
) $(CFLAGS
) -o
$@
$^
-L
$(BUILDDIR
) -lcodec
-lgcc \
75 -T
$(LINKCODEC
) -Wl
,-Map
,$(OBJDIR
)/$*.map
77 $(OBJDIR
)/%.codec
: $(OBJDIR
)/%.elf
78 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
82 ###################################################
83 # This is the X11 simulator version
85 $(OBJDIR
)/%.codec
: $(OBJDIR
)/%.o
$(OBJDIR
)/codec_crt0.o
$(BUILDDIR
)/libcodec.a
$(OUTPUT
)
86 $(call PRINTS
,LD
$(@F
))$(CC
) $(CFLAGS
) $(SHARED_FLAG
) $< $(OBJDIR
)/codec_crt0.o
-L
$(BUILDDIR
) $(CODECLIBS
) -lcodec
-o
$@
87 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
88 # 'x' must be kept or you'll have "Win32 error 5"
89 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
90 # #define ERROR_ACCESS_DENIED 5L
95 else # end of x11-simulator
97 ###################################################
98 # This is the SDL simulator version
100 $(OBJDIR
)/%.codec
: $(OBJDIR
)/%.o
$(OBJDIR
)/codec_crt0.o
$(BUILDDIR
)/libcodec.a
$(OUTPUT
)
101 $(call PRINTS
,LD
$(@F
))$(CC
) $(CFLAGS
) $(SHARED_FLAG
) $< $(OBJDIR
)/codec_crt0.o
-L
$(BUILDDIR
) $(CODECLIBS
) -lcodec
-o
$@
102 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
103 # 'x' must be kept or you'll have "Win32 error 5"
104 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
105 # #define ERROR_ACCESS_DENIED 5L
110 else # end of sdl-simulator
111 ###################################################
112 # This is the win32 simulator version
113 DLLTOOLFLAGS
= --export-all
114 DLLWRAPFLAGS
= -s
--entry _DllMain@
12 --target
=i386-mingw32
-mno-cygwin
116 $(OBJDIR
)/%.codec
: $(OBJDIR
)/%.o
$(OBJDIR
)/codec_crt0.o
$(BUILDDIR
)/libcodec.a
$(OUTPUT
)
117 $(call PRINTS
,DLL
$(@F
))$(DLLTOOL
) $(DLLTOOLFLAGS
) -z
$(OBJDIR
)/$*.def
$< $(OBJDIR
)/codec_crt0.o
118 $(SILENT
)$(DLLWRAP
) $(DLLWRAPFLAGS
) --def
$(OBJDIR
)/$*.def
$< $(OBJDIR
)/codec_crt0.o\
119 $(BUILDDIR
)/libcodec.a
$(patsubst -l
%,$(BUILDDIR
)/lib
%.a
,$(CODECLIBS
)) \
121 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
122 # 'x' must be kept or you'll have "Win32 error 5"
123 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
124 # #define ERROR_ACCESS_DENIED 5L
128 endif # end of win32-simulator
131 endif # end of simulator section
133 include $(TOOLSDIR
)/make.inc
135 $(BUILDDIR
)/libcodec.a
:
136 $(SILENT
)mkdir
-p
$(OBJDIR
)/lib
137 $(call PRINTS
,MAKE in codecs
/lib
)$(MAKE
) -C lib OBJDIR
=$(OBJDIR
)/lib
140 $(call PRINTS
,build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) -DCODEC
$(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
- >$@
142 $(BUILDDIR
)/libmad.a
: libmad
145 $(SILENT
)mkdir
-p
$(OBJDIR
)/libmad
146 $(call PRINTS
,MAKE in libmad
)$(MAKE
) -C libmad OBJDIR
=$(OBJDIR
)/libmad OUTPUT
=$(BUILDDIR
)/libmad.a
148 $(BUILDDIR
)/liba52.a
: liba52
151 $(SILENT
)mkdir
-p
$(OBJDIR
)/liba52
152 $(call PRINTS
,MAKE in liba52
)$(MAKE
) -C liba52 OBJDIR
=$(OBJDIR
)/liba52 OUTPUT
=$(BUILDDIR
)/liba52.a
154 $(BUILDDIR
)/libffmpegFLAC.a
: libffmpegFLAC
157 $(SILENT
)mkdir
-p
$(OBJDIR
)/libffmpegFLAC
158 $(call PRINTS
,MAKE in libffmpegFLAC
)$(MAKE
) -C libffmpegFLAC OBJDIR
=$(OBJDIR
)/libffmpegFLAC OUTPUT
=$(BUILDDIR
)/libffmpegFLAC.a
160 $(BUILDDIR
)/libTremor.a
: libTremor
163 $(SILENT
)mkdir
-p
$(OBJDIR
)/Tremor
164 $(call PRINTS
,MAKE in Tremor
)$(MAKE
) -C Tremor OBJDIR
=$(OBJDIR
)/Tremor OUTPUT
=$(BUILDDIR
)/libTremor.a
166 $(BUILDDIR
)/libspeex.a
: libspeex
169 $(SILENT
)mkdir
-p
$(OBJDIR
)/libspeex
170 $(call PRINTS
,MAKE in libspeex
)$(MAKE
) -C libspeex OBJDIR
=$(OBJDIR
)/libspeex OUTPUT
=$(BUILDDIR
)/libspeex.a
172 $(BUILDDIR
)/libwavpack.a
: libwavpack
175 $(SILENT
)mkdir
-p
$(OBJDIR
)/libwavpack
176 $(call PRINTS
,MAKE in libwavpack
)$(MAKE
) -C libwavpack OBJDIR
=$(OBJDIR
)/libwavpack OUTPUT
=$(BUILDDIR
)/libwavpack.a
178 $(BUILDDIR
)/libmusepack.a
: libmusepack
181 $(SILENT
)mkdir
-p
$(OBJDIR
)/libmusepack
182 $(call PRINTS
,MAKE in libmusepack
)$(MAKE
) -C libmusepack OBJDIR
=$(OBJDIR
)/libmusepack OUTPUT
=$(BUILDDIR
)/libmusepack.a
184 $(BUILDDIR
)/libalac.a
: libalac
187 $(SILENT
)mkdir
-p
$(OBJDIR
)/libalac
188 $(call PRINTS
,MAKE in libalac
)$(MAKE
) -C libalac OBJDIR
=$(OBJDIR
)/libalac OUTPUT
=$(BUILDDIR
)/libalac.a
190 $(BUILDDIR
)/libm4a.a
: libm4a
193 $(SILENT
)mkdir
-p
$(OBJDIR
)/libm4a
194 $(call PRINTS
,MAKE in libm4a
)$(MAKE
) -C libm4a OBJDIR
=$(OBJDIR
)/libm4a OUTPUT
=$(BUILDDIR
)/libm4a.a
196 $(BUILDDIR
)/libfaad.a
: libfaad
199 $(SILENT
)mkdir
-p
$(OBJDIR
)/libfaad
200 $(call PRINTS
,MAKE in libfaad
)$(MAKE
) -C libfaad OBJDIR
=$(OBJDIR
)/libfaad OUTPUT
=$(BUILDDIR
)/libfaad.a
202 $(BUILDDIR
)/libdemac.a
: libdemac
205 $(SILENT
)mkdir
-p
$(OBJDIR
)/libdemac
206 $(call PRINTS
,MAKE in libdemac
)$(MAKE
) -C demac
/libdemac OBJDIR
=$(OBJDIR
)/libdemac OUTPUT
=$(BUILDDIR
)/libdemac.a
209 $(call PRINTS
,cleaning codecs
)rm -fr
$(OBJDIR
)/libmad
$(BUILDDIR
)/libmad.a
$(OBJDIR
)/liba52
$(BUILDDIR
)/liba52.a
$(OBJDIR
)/libffmpegFLAC
$(BUILDDIR
)/libffmpegFLAC.a
$(OBJDIR
)/Tremor
$(BUILDDIR
)/libTremor.a
$(OBJDIR
)/libspeex
$(BUILDDIR
)/libSpeex.a
$(OBJDIR
)/libwavpack
$(BUILDDIR
)/libwavpack.a
$(OBJDIR
)/libmusepack
$(BUILDDIR
)/libmusepack.a
$(OBJDIR
)/libalac
$(BUILDDIR
)/libalac.a
$(OBJDIR
)/libfaad
$(BUILDDIR
)/libfaad.a
$(OBJDIR
)/libm4a
$(BUILDDIR
)/libm4a.a
$(OBJDIR
)/libdemac
$(BUILDDIR
)/libdemac.a
210 $(SILENT
)$(MAKE
) -C libmad
clean OBJDIR
=$(OBJDIR
)/libmad
211 $(SILENT
)$(MAKE
) -C liba52
clean OBJDIR
=$(OBJDIR
)/liba52
212 $(SILENT
)$(MAKE
) -C libffmpegFLAC
clean OBJDIR
=$(OBJDIR
)/libffmpegFLAC
213 $(SILENT
)$(MAKE
) -C Tremor
clean OBJDIR
=$(OBJDIR
)/Tremor
214 $(SILENT
)$(MAKE
) -C libspeex
clean OBJDIR
=$(OBJDIR
)/libspeex
215 $(SILENT
)$(MAKE
) -C libwavpack
clean OBJDIR
=$(OBJDIR
)/libwavpack
216 $(SILENT
)$(MAKE
) -C libmusepack
clean OBJDIR
=$(OBJDIR
)/libmusepack
217 $(SILENT
)$(MAKE
) -C libalac
clean OBJDIR
=$(OBJDIR
)/libalac
218 $(SILENT
)$(MAKE
) -C libfaad
clean OBJDIR
=$(OBJDIR
)/libfaad
219 $(SILENT
)$(MAKE
) -C libm4a
clean OBJDIR
=$(OBJDIR
)/libm4a
220 $(SILENT
)$(MAKE
) -C demac
/libdemac
clean OBJDIR
=$(OBJDIR
)/libdemac
221 $(SILENT
)$(MAKE
) -C lib
clean OBJDIR
=$(OBJDIR
)/lib
223 ifneq ($(MAKECMDGOALS
),clean)