2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 include $(TOOLSDIR
)/functions.make
12 DEFINES
= -DROCKBOX
-DMEMORYSIZE
=$(MEMORYSIZE
) $(TARGET
) \
13 -DTARGET_ID
=$(TARGET_ID
) -DTARGET_NAME
=\"$(MODELNAME
)\" $(BUILDDATE
) \
14 $(EXTRA_DEFINES
) # <-- -DSIMULATOR or not
15 INCLUDES
= -I
$(BUILDDIR
) -I
$(BUILDDIR
)/lang
$(TARGET_INC
)
17 CFLAGS
= $(INCLUDES
) $(DEFINES
) $(GCCOPTS
)
18 PPCFLAGS
= $(filter-out -g
-Dmain
=SDL_main
,$(CFLAGS
)) # cygwin sdl-config fix
19 ASMFLAGS
= -D__ASSEMBLER__
# work around gcc 3.4.x bug with -std=gnu99, only meant for .S files
21 TOOLS
= $(TOOLSDIR
)/rdf2binary
$(TOOLSDIR
)/convbdf \
22 $(TOOLSDIR
)/codepages
$(TOOLSDIR
)/scramble
$(TOOLSDIR
)/bmp2rb \
23 $(TOOLSDIR
)/uclpack
$(TOOLSDIR
)/mkboot
$(TOOLSDIR
)/iaudio_bl_flash.c \
24 $(TOOLSDIR
)/iaudio_bl_flash.h
26 ifeq ($(MODELNAME
),archosplayer
)
27 TOOLS
+= $(TOOLSDIR
)/player_unifont
32 # for sims, set simdisk/ as default
33 ifeq ($(APP_TYPE
),sdl-sim
)
35 else ifeq ($(APP_TYPE
),sdl-app
)
39 INSTALL
= --install="$(RBPREFIX)"
41 # /dev/null as magic to tell it wasn't set, error out later in buildzip.pl
42 INSTALL
= --install=/dev
/null
46 INSTALL
= --install="$(RBPREFIX)"
49 RBINFO
= $(BUILDDIR
)/rockbox-info.txt
51 # list suffixes to be understood by $*
52 .SUFFIXES
: .rock .codec .map .elf .c .S .o .bmp .a
54 .PHONY
: all clean tags zip tools manual bin build
info langs
56 ifeq (,$(filter clean veryclean reconf
tags voice voicetools manual manual-pdf manual-html manual-zhtml manual-txt manual-ztxt manual-zip help fontzip
,$(MAKECMDGOALS
)))
58 DEPFILE
= $(BUILDDIR
)/make.dep
64 # Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC,
65 # ASMDEFS_SRC, CORE_LIBS and EXTRA_LIBS. But they also define special
66 # dependencies and compile rules
67 include $(TOOLSDIR
)/tools.make
69 ifeq (,$(findstring checkwps
,$(APP_TYPE
)))
70 ifeq (,$(findstring database
,$(APP_TYPE
)))
71 ifeq (,$(findstring warble
,$(APP_TYPE
)))
72 include $(FIRMDIR
)/firmware.make
73 include $(ROOTDIR
)/apps
/bitmaps
/bitmaps.make
74 ifeq (,$(findstring bootloader
,$(APPSDIR
)))
75 include $(ROOTDIR
)/lib
/skin_parser
/skin_parser.make
76 include $(ROOTDIR
)/lib
/tlsf
/libtlsf.make
82 #included before codecs.make and plugins.make so they see them)
84 include $(ROOTDIR
)/lib
/libsetjmp
/libsetjmp.make
85 ifeq (arch_arm
,$(ARCH
))
86 include $(ROOTDIR
)/lib
/arm_support
/arm_support.make
90 ifeq (arch_arm
,$(ARCH
))
91 include $(ROOTDIR
)/lib
/unwarminder
/unwarminder.make
94 ifneq (,$(findstring bootloader
,$(APPSDIR
)))
95 include $(APPSDIR
)/bootloader.make
96 else ifneq (,$(findstring bootbox
,$(APPSDIR
)))
97 BOOTBOXLDOPTS
= -Wl
,--gc-sections
98 include $(APPSDIR
)/bootbox.make
99 else ifneq (,$(findstring checkwps
,$(APP_TYPE
)))
100 include $(APPSDIR
)/checkwps.make
101 include $(ROOTDIR
)/lib
/skin_parser
/skin_parser.make
102 else ifneq (,$(findstring database
,$(APP_TYPE
)))
103 include $(APPSDIR
)/database.make
104 else ifneq (,$(findstring warble
,$(APP_TYPE
)))
105 include $(ROOTDIR
)/lib
/rbcodec
/test/warble.make
106 include $(ROOTDIR
)/lib
/tlsf
/libtlsf.make
107 include $(ROOTDIR
)/lib
/rbcodec
/rbcodec.make
109 include $(APPSDIR
)/apps.make
110 include $(ROOTDIR
)/lib
/rbcodec
/rbcodec.make
111 include $(APPSDIR
)/lang
/lang.make
114 include $(APPSDIR
)/plugins
/bitmaps
/pluginbitmaps.make
115 include $(APPSDIR
)/plugins
/plugins.make
118 ifneq (,$(findstring sdl
,$(APP_TYPE
)))
119 include $(ROOTDIR
)/uisimulator
/uisimulator.make
122 ifneq (,$(findstring ypr0
,$(APP_TYPE
)))
123 include $(ROOTDIR
)/firmware
/target
/hosted
/ypr0
/ypr0.make
126 ifneq (,$(findstring android
, $(APP_TYPE
)))
127 include $(ROOTDIR
)/android
/android.make
130 ifneq (,$(findstring pandora
, $(MODELNAME
)))
131 include $(ROOTDIR
)/packaging
/pandora
/pandora.make
138 OBJ
+= $(BMP
:.bmp
=.o
)
139 OBJ
:= $(subst $(ROOTDIR
),$(BUILDDIR
),$(OBJ
))
141 build
: $(TOOLS
) $(BUILDDIR
)/$(BINARY
) $(CODECS
) $(ROCKS
) $(ARCHOSROM
) $(RBINFO
)
143 $(RBINFO
): $(BUILDDIR
)/$(BINARY
)
144 $(SILENT
)echo Creating
$(@F
)
145 $(SILENT
)$(TOOLSDIR
)/mkinfo.pl
$@
148 $(call PRINTS
,Generating dependencies
)
149 $(call mkdepfile
,$(DEPFILE
)_
,$(SRC
))
150 $(call mkdepfile
,$(DEPFILE
)_
,$(OTHER_SRC
:%.lua
=))
151 $(call mkdepfile
,$(DEPFILE
)_
,$(ASMDEFS_SRC
))
152 $(call bmpdepfile
,$(DEPFILE
)_
,$(BMP
) $(PBMP
))
153 @mv
$(DEPFILE
)_
$(DEPFILE
)
155 bin
: $(DEPFILE
) $(TOOLS
) $(BUILDDIR
)/$(BINARY
) $(RBINFO
)
156 rocks
: $(DEPFILE
) $(TOOLS
) $(ROCKS
)
157 codecs
: $(DEPFILE
) $(TOOLS
) $(CODECS
)
163 $(SILENT
)rm -rf
$(TOOLS
)
166 $(SILENT
)echo Cleaning build directory
167 $(SILENT
)rm -rf rockbox.zip rockbox
.7z rockbox.
tar rockbox.
tar.gz \
168 rockbox.
tar.bz2 TAGS apps firmware tools comsim sim lang lib \
169 manual
*.pdf
*.a credits.raw rockbox.ipod bitmaps \
170 pluginbitmaps UI256.bmp rockbox-full.zip html txt \
171 rockbox-manual
*.zip sysfont.h rockbox-info.txt voicefontids \
172 *.wav
*.mp3
*.voice
$(CLEANOBJS
) \
173 $(LINKRAM
) $(LINKROM
) rockbox.elf rockbox.map rockbox.bin \
174 make.dep rombox.elf rombox.map rombox.bin rombox.ucl romstart.txt \
175 $(BINARY
) $(FLASHFILE
) uisimulator bootloader flash
$(BOOTLINK
) \
178 #### linking the binaries: ####
182 ifeq (,$(findstring bootloader
,$(APPSDIR
)))
190 CONFIGFILE
:= $(FIRMDIR
)/export/config
/$(MODELNAME
).h
191 RAMLDS
:= $(FIRMDIR
)/target
/$(CPU
)/$(MANUFACTURER
)/app.lds
192 LINKRAM
:= $(BUILDDIR
)/ram.link
193 ROMLDS
:= $(FIRMDIR
)/rom.lds
194 LINKROM
:= $(BUILDDIR
)/rom.link
196 $(LINKRAM
): $(RAMLDS
) $(CONFIGFILE
)
197 $(call PRINTS
,PP
$(@F
))
198 $(call preprocess2file
,$<,$@
,-DLOADADDRESS
=$(LOADADDRESS
))
200 $(LINKROM
): $(ROMLDS
)
201 $(call PRINTS
,PP
$(@F
))
202 $(call preprocess2file
,$<,$@
,-DLOADADDRESS
=$(LOADADDRESS
))
204 $(BUILDDIR
)/rockbox.elf
: $$(OBJ
) $(FIRMLIB
) $(VOICESPEEXLIB
) $(CORE_LIBS
) $$(LINKRAM
)
205 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJ
) \
206 -L
$(BUILDDIR
)/firmware
-lfirmware \
207 -L
$(RBCODEC_BLD
)/codecs
$(call a2lnk
, $(VOICESPEEXLIB
)) \
208 -L
$(BUILDDIR
)/lib
$(call a2lnk
, $(CORE_LIBS
)) \
209 -lgcc
$(BOOTBOXLDOPTS
) $(GLOBAL_LDOPTS
) \
210 -T
$(LINKRAM
) -Wl
,-Map
,$(BUILDDIR
)/rockbox.map
212 $(BUILDDIR
)/rombox.elf
: $$(OBJ
) $(FIRMLIB
) $(VOICESPEEXLIB
) $(CORE_LIBS
) $$(LINKROM
)
213 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJ
) \
214 -L
$(BUILDDIR
)/firmware
-lfirmware \
215 -L
$(RBCODEC_BLD
)/codecs
$(call a2lnk
, $(VOICESPEEXLIB
)) \
216 -L
$(BUILDDIR
)/lib
$(call a2lnk
, $(CORE_LIBS
)) \
217 -lgcc
$(BOOTBOXLDOPTS
) $(GLOBAL_LDOPTS
) \
218 -T
$(LINKROM
) -Wl
,-Map
,$(BUILDDIR
)/rombox.map
220 $(BUILDDIR
)/rockbox.bin
: $(BUILDDIR
)/rockbox.elf
221 $(call PRINTS
,OC
$(@F
))$(call objcopy
,$<,$@
)
223 $(BUILDDIR
)/rombox.bin
: $(BUILDDIR
)/rombox.elf
224 $(call PRINTS
,OC
$(@F
))$(call objcopy
,$<,$@
)
227 # If there's a flashfile defined for this target (rockbox.ucl for Archos
228 # models) Then check if the mkfirmware script fails, as then it is (likely)
229 # because the image is too big and we need to create a compressed image
232 $(BUILDDIR
)/$(BINARY
) : $(BUILDDIR
)/rockbox.bin
$(FLASHFILE
)
233 $(call PRINTS
,SCRAMBLE
$(notdir $@
))($(MKFIRMWARE
) $< $@
; \
235 if
test -n
"$(FLASHFILE)"; then \
236 if
test "$$stat" -ne
0; then \
237 echo
"Image too big, making a compressed version!"; \
238 $(MAKE
) -C
$(FIRMDIR
)/decompressor OBJDIR
=$(BUILDDIR
)/firmware
/decompressor
; \
239 $(MKFIRMWARE
) $(BUILDDIR
)/firmware
/decompressor
/compressed.bin
$@
; \
244 $(BUILDDIR
)/rockbox.ucl
: $(BUILDDIR
)/rockbox.bin
245 $(call PRINTS
,UCLPACK
$(@F
))$(TOOLSDIR
)/uclpack
--best
--2e
-b1048576
$< $@
>/dev
/null
247 MAXINFILE
= $(BUILDDIR
)/temp.txt
248 MAXOUTFILE
= $(BUILDDIR
)/romstart.txt
250 $(BUILDDIR
)/rombox.ucl
: $(BUILDDIR
)/rombox.bin
$(MAXOUTFILE
)
251 $(call PRINTS
,UCLPACK
$(@F
))$(TOOLSDIR
)/uclpack
--none
$< $@
>/dev
/null
; \
252 perl
$(TOOLSDIR
)/romsizetest.pl
`cat $(MAXOUTFILE)` $<; \
253 if
test $$?
-ne
0; then \
254 echo
"removing UCL file again, making it a fake one"; \
259 $(call PRINTS
,Creating
$(@F
))
260 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
261 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
262 $(call preprocess2file
,$(MAXINFILE
),$(MAXOUTFILE
))
263 $(SILENT
)rm $(MAXINFILE
)
266 $(BUILDDIR
)/rombox.iriver
: $(BUILDDIR
)/rombox.bin
267 $(call PRINTS
,Build ROM file
)$(MKFIRMWARE
) $< $@
274 $(SILENT
)$(MAKE
) -C
$(TOOLSDIR
) CC
=$(HOSTCC
) AR
=$(HOSTAR
) rbspeexenc voicefont wavtrim
278 $(SILENT
)etags
-o
$(BUILDDIR
)/TAGS
$(filter-out %.o
,$(SRC
) $(OTHER_SRC
))
281 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
1 -o rockbox-fonts.zip
$(TARGET
) $(BINARY
)
283 zip
: $(BUILDDIR
)/rockbox.zip
286 $(BUILDDIR
)/rockbox.zip
:
288 $(BUILDDIR
)/rockbox.zip
: build
290 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" $(TARGET
) $(BINARY
)
293 $(SILENT
)find .
-name
"*.map" | xargs zip rockbox-maps.zip
296 $(SILENT
)find .
-name
"*.elf" | xargs zip rockbox-elfs.zip
299 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
2 -o rockbox-full.zip
$(TARGET
) $(BINARY
)
302 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -o
"rockbox.7z" -z
"7za a -mx=9" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" $(TARGET
) $(BINARY
)
305 $(SILENT
)rm -f rockbox.
tar
306 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -o
"rockbox.tar" -z
"tar -cf" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" $(TARGET
) $(BINARY
)
309 $(SILENT
)bzip2
-f9 rockbox.
tar
312 $(SILENT
)gzip
-f9 rockbox.
tar
315 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-pdf
317 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-html
318 manual-zhtml
: manual-zip
320 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-txt
322 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-txt-zip
324 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-zip
328 voice
: voicetools
$(BUILDDIR
)/apps
/features
329 $(SILENT
)for f in
`cat $(BUILDDIR)/apps/features`; do feat
="$$feat:$$f" ; done
; \
330 for lang in
`echo $(VOICELANGUAGE) |sed "s/,/ /g"`; do
$(TOOLSDIR
)/voice.pl
-V
-l
=$$lang -t
=$(MODELNAME
)$$feat -i
=$(TARGET_ID
) -e
="$(ENCODER)" -E
="$(ENC_OPTS)" -s
=$(TTS_ENGINE
) -S
="$(TTS_OPTS)"; done \
334 ifeq (,$(findstring android
, $(APP_TYPE
)))
335 bininstall
: $(BUILDDIR
)/$(BINARY
)
336 @echo
"Installing your rockbox binary in your '$(RBPREFIX)' dir"
337 $(SILENT
)cp
$(BINARY
) "$(RBPREFIX)/.rockbox/"
340 @echo
"Installing your build in your '$(RBPREFIX)' dir"
341 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
"$(MODELNAME)" -i
"$(TARGET_ID)" $(INSTALL
) -z
"zip -r0" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
0 $(TARGET
) $(BINARY
)
344 @echo
"Installing a full setup in your '$(RBPREFIX)' dir"
345 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
"$(MODELNAME)" -i
"$(TARGET_ID)" $(INSTALL
) -z
"zip -r0" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
2 $(TARGET
) $(BINARY
)
348 @echo
"Installing a full setup with links in your '$(RBPREFIX)' dir"
349 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
"$(MODELNAME)" -i
"$(TARGET_ID)" $(INSTALL
) -z
"zip -r0" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
2 $(TARGET
) $(BINARY
) -l
353 @echo
"A few helpful make targets"
355 @echo
"all - builds a full Rockbox (default), including tools"
356 @echo
"bin - builds only the Rockbox.<target name> file"
357 @echo
"rocks - builds only plugins"
358 @echo
"codecs - builds only codecs"
359 @echo
"dep - regenerates make dependency database"
360 @echo
"clean - cleans a build directory (not tools)"
361 @echo
"veryclean - cleans the build and tools directories"
362 @echo
"manual - builds a manual (pdf)"
363 @echo
"manual-html - HTML manual"
364 @echo
"manual-zip - HTML manual (zipped)"
365 @echo
"manual-txt - txt manual"
366 @echo
"fullzip - creates a rockbox.zip of your build with fonts"
367 @echo
"zip - creates a rockbox.zip of your build (no fonts)"
368 @echo
"gzip - creates a rockbox.tar.gz of your build (no fonts)"
369 @echo
"bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
370 @echo
"7zip - creates a rockbox.7z of your build (no fonts)"
371 @echo
"fontzip - creates rockbox-fonts.zip"
372 @echo
"mapzip - creates rockbox-maps.zip with all .map files"
373 @echo
"elfzip - creates rockbox-elfs.zip with all .elf files"
374 @echo
"pnd - creates rockbox.pnd archive (Pandora builds only)"
375 @echo
"tools - builds the tools only"
376 @echo
"voice - creates the voice clips (voice builds only)"
377 @echo
"voicetools - builds the voice tools only"
378 @echo
"install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))"
379 @echo
"fullinstall - installs your build (like install, but with fonts)"
380 @echo
"symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)"
381 @echo
"reconf - rerun configure with the same selection"
383 ### general compile rules:
385 # when source and object are in different locations (normal):
386 $(BUILDDIR
)/%.o
: $(ROOTDIR
)/%.c
387 $(SILENT
)mkdir
-p
$(dir $@
)
388 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) -c
$< -o
$@
390 $(BUILDDIR
)/%.o
: $(ROOTDIR
)/%.S
391 $(SILENT
)mkdir
-p
$(dir $@
)
392 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) $(ASMFLAGS
) -c
$< -o
$@
394 # generated definitions for use in .S files
395 $(BUILDDIR
)/%_asmdefs.h
: $(ROOTDIR
)/%_asmdefs.c
396 $(call PRINTS
,ASMDEFS
$(@F
))
397 $(SILENT
)mkdir
-p
$(dir $@
)
398 $(call asmdefs2file
,$<,$@
)
400 # when source and object are both in BUILDDIR (generated code):
402 $(SILENT
)mkdir
-p
$(dir $@
)
403 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) -c
$< -o
$@
406 $(SILENT
)mkdir
-p
$(dir $@
)
407 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) $(ASMFLAGS
) -c
$< -o
$@
409 Makefile
: $(TOOLSDIR
)/configure
410 ifneq (reconf
,$(MAKECMDGOALS
))
411 $(SILENT
)echo
"*** tools/configure is newer than Makefile. You should run 'make reconf'."
415 $(SILENT
$)$(TOOLSDIR
)/configure
$(CONFIGURE_OPTIONS
)