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
29 # for sims, set simdisk/ as default
30 ifeq ($(APP_TYPE
),sdl-sim
)
32 else ifeq ($(APP_TYPE
),sdl-app
)
36 INSTALL
= --install="$(RBPREFIX)"
38 # /dev/null as magic to tell it wasn't set, error out later in buildzip.pl
39 INSTALL
= --install=/dev
/null
43 INSTALL
= --install="$(RBPREFIX)"
46 RBINFO
= $(BUILDDIR
)/rockbox-info.txt
48 # list suffixes to be understood by $*
49 .SUFFIXES
: .rock .codec .map .elf .c .S .o .bmp .a
51 .PHONY
: all clean tags zip tools manual bin build
info langs
53 ifeq (,$(filter clean veryclean reconf
tags voice voicetools manual manual-pdf manual-html manual-zhtml manual-txt manual-ztxt manual-zip help fontzip
,$(MAKECMDGOALS
)))
55 DEPFILE
= $(BUILDDIR
)/make.dep
61 # Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC,
62 # ASMDEFS_SRC, CORE_LIBS and EXTRA_LIBS. But they also define special
63 # dependencies and compile rules
64 include $(TOOLSDIR
)/tools.make
66 ifeq (,$(findstring checkwps
,$(APP_TYPE
)))
67 ifeq (,$(findstring database
,$(APP_TYPE
)))
68 ifeq (,$(findstring warble
,$(APP_TYPE
)))
69 include $(FIRMDIR
)/firmware.make
70 include $(ROOTDIR
)/apps
/bitmaps
/bitmaps.make
71 ifeq (,$(findstring bootloader
,$(APPSDIR
)))
72 include $(ROOTDIR
)/lib
/skin_parser
/skin_parser.make
73 include $(ROOTDIR
)/lib
/tlsf
/libtlsf.make
79 #included before codecs.make and plugins.make so they see them)
81 include $(ROOTDIR
)/lib
/libsetjmp
/libsetjmp.make
82 ifeq (arch_arm
,$(ARCH
))
83 include $(ROOTDIR
)/lib
/arm_support
/arm_support.make
87 ifeq (arch_arm
,$(ARCH
))
88 include $(ROOTDIR
)/lib
/unwarminder
/unwarminder.make
91 ifneq (,$(findstring bootloader
,$(APPSDIR
)))
92 include $(APPSDIR
)/bootloader.make
93 else ifneq (,$(findstring bootbox
,$(APPSDIR
)))
94 BOOTBOXLDOPTS
= -Wl
,--gc-sections
95 include $(APPSDIR
)/bootbox.make
96 else ifneq (,$(findstring checkwps
,$(APP_TYPE
)))
97 include $(APPSDIR
)/checkwps.make
98 include $(ROOTDIR
)/lib
/skin_parser
/skin_parser.make
99 else ifneq (,$(findstring database
,$(APP_TYPE
)))
100 include $(APPSDIR
)/database.make
101 else ifneq (,$(findstring warble
,$(APP_TYPE
)))
102 include $(ROOTDIR
)/lib
/rbcodec
/test/warble.make
103 include $(ROOTDIR
)/lib
/tlsf
/libtlsf.make
104 include $(ROOTDIR
)/lib
/rbcodec
/rbcodec.make
106 include $(APPSDIR
)/apps.make
107 include $(ROOTDIR
)/lib
/rbcodec
/rbcodec.make
108 include $(APPSDIR
)/lang
/lang.make
111 include $(APPSDIR
)/plugins
/bitmaps
/pluginbitmaps.make
112 include $(APPSDIR
)/plugins
/plugins.make
115 ifneq (,$(findstring sdl
,$(APP_TYPE
)))
116 include $(ROOTDIR
)/uisimulator
/uisimulator.make
119 ifneq (,$(findstring ypr0
,$(APP_TYPE
)))
120 include $(ROOTDIR
)/firmware
/target
/hosted
/ypr0
/ypr0.make
123 ifneq (,$(findstring android
, $(APP_TYPE
)))
124 include $(ROOTDIR
)/android
/android.make
127 ifneq (,$(findstring pandora
, $(MODELNAME
)))
128 include $(ROOTDIR
)/packaging
/pandora
/pandora.make
135 OBJ
+= $(BMP
:.bmp
=.o
)
136 OBJ
:= $(subst $(ROOTDIR
),$(BUILDDIR
),$(OBJ
))
138 build
: $(TOOLS
) $(BUILDDIR
)/$(BINARY
) $(CODECS
) $(ROCKS
) $(ARCHOSROM
) $(RBINFO
)
140 $(RBINFO
): $(BUILDDIR
)/$(BINARY
)
141 $(SILENT
)echo Creating
$(@F
)
142 $(SILENT
)$(TOOLSDIR
)/mkinfo.pl
$@
145 $(call PRINTS
,Generating dependencies
)
146 $(call mkdepfile
,$(DEPFILE
)_
,$(SRC
))
147 $(call mkdepfile
,$(DEPFILE
)_
,$(OTHER_SRC
:%.lua
=))
148 $(call mkdepfile
,$(DEPFILE
)_
,$(ASMDEFS_SRC
))
149 $(call bmpdepfile
,$(DEPFILE
)_
,$(BMP
) $(PBMP
))
150 @mv
$(DEPFILE
)_
$(DEPFILE
)
152 bin
: $(DEPFILE
) $(TOOLS
) $(BUILDDIR
)/$(BINARY
) $(RBINFO
)
153 rocks
: $(DEPFILE
) $(TOOLS
) $(ROCKS
)
154 codecs
: $(DEPFILE
) $(TOOLS
) $(CODECS
)
160 $(SILENT
)rm -rf
$(TOOLS
)
163 $(SILENT
)echo Cleaning build directory
164 $(SILENT
)rm -rf rockbox.zip rockbox
.7z rockbox.
tar rockbox.
tar.gz \
165 rockbox.
tar.bz2 TAGS apps firmware tools comsim sim lang lib \
166 manual
*.pdf
*.a credits.raw rockbox.ipod bitmaps \
167 pluginbitmaps UI256.bmp rockbox-full.zip html txt \
168 rockbox-manual
*.zip sysfont.h rockbox-info.txt voicefontids \
169 *.wav
*.mp3
*.voice
$(CLEANOBJS
) \
170 $(LINKRAM
) $(LINKROM
) rockbox.elf rockbox.map rockbox.bin \
171 make.dep rombox.elf rombox.map rombox.bin rombox.ucl romstart.txt \
172 $(BINARY
) $(FLASHFILE
) uisimulator bootloader flash
$(BOOTLINK
) \
175 #### linking the binaries: ####
179 ifeq (,$(findstring bootloader
,$(APPSDIR
)))
187 CONFIGFILE
:= $(FIRMDIR
)/export/config
/$(MODELNAME
).h
188 RAMLDS
:= $(FIRMDIR
)/target
/$(CPU
)/$(MANUFACTURER
)/app.lds
189 LINKRAM
:= $(BUILDDIR
)/ram.link
190 ROMLDS
:= $(FIRMDIR
)/rom.lds
191 LINKROM
:= $(BUILDDIR
)/rom.link
193 $(LINKRAM
): $(RAMLDS
) $(CONFIGFILE
)
194 $(call PRINTS
,PP
$(@F
))
195 $(call preprocess2file
,$<,$@
,-DLOADADDRESS
=$(LOADADDRESS
))
197 $(LINKROM
): $(ROMLDS
)
198 $(call PRINTS
,PP
$(@F
))
199 $(call preprocess2file
,$<,$@
,-DLOADADDRESS
=$(LOADADDRESS
))
201 $(BUILDDIR
)/rockbox.elf
: $$(OBJ
) $(FIRMLIB
) $(VOICESPEEXLIB
) $(CORE_LIBS
) $$(LINKRAM
)
202 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJ
) \
203 -L
$(BUILDDIR
)/firmware
-lfirmware \
204 -L
$(RBCODEC_BLD
)/codecs
$(call a2lnk
, $(VOICESPEEXLIB
)) \
205 -L
$(BUILDDIR
)/lib
$(call a2lnk
, $(CORE_LIBS
)) \
206 -lgcc
$(BOOTBOXLDOPTS
) $(GLOBAL_LDOPTS
) \
207 -T
$(LINKRAM
) -Wl
,-Map
,$(BUILDDIR
)/rockbox.map
209 $(BUILDDIR
)/rombox.elf
: $$(OBJ
) $(FIRMLIB
) $(VOICESPEEXLIB
) $(CORE_LIBS
) $$(LINKROM
)
210 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJ
) \
211 -L
$(BUILDDIR
)/firmware
-lfirmware \
212 -L
$(RBCODEC_BLD
)/codecs
$(call a2lnk
, $(VOICESPEEXLIB
)) \
213 -L
$(BUILDDIR
)/lib
$(call a2lnk
, $(CORE_LIBS
)) \
214 -lgcc
$(BOOTBOXLDOPTS
) $(GLOBAL_LDOPTS
) \
215 -T
$(LINKROM
) -Wl
,-Map
,$(BUILDDIR
)/rombox.map
217 $(BUILDDIR
)/rockbox.bin
: $(BUILDDIR
)/rockbox.elf
218 $(call PRINTS
,OC
$(@F
))$(call objcopy
,$<,$@
)
220 $(BUILDDIR
)/rombox.bin
: $(BUILDDIR
)/rombox.elf
221 $(call PRINTS
,OC
$(@F
))$(call objcopy
,$<,$@
)
224 # If there's a flashfile defined for this target (rockbox.ucl for Archos
225 # models) Then check if the mkfirmware script fails, as then it is (likely)
226 # because the image is too big and we need to create a compressed image
229 $(BUILDDIR
)/$(BINARY
) : $(BUILDDIR
)/rockbox.bin
$(FLASHFILE
)
230 $(call PRINTS
,SCRAMBLE
$(notdir $@
))($(MKFIRMWARE
) $< $@
; \
232 if
test -n
"$(FLASHFILE)"; then \
233 if
test "$$stat" -ne
0; then \
234 echo
"Image too big, making a compressed version!"; \
235 $(MAKE
) -C
$(FIRMDIR
)/decompressor OBJDIR
=$(BUILDDIR
)/firmware
/decompressor
; \
236 $(MKFIRMWARE
) $(BUILDDIR
)/firmware
/decompressor
/compressed.bin
$@
; \
241 $(BUILDDIR
)/rockbox.ucl
: $(BUILDDIR
)/rockbox.bin
242 $(call PRINTS
,UCLPACK
$(@F
))$(TOOLSDIR
)/uclpack
--best
--2e
-b1048576
$< $@
>/dev
/null
244 MAXINFILE
= $(BUILDDIR
)/temp.txt
245 MAXOUTFILE
= $(BUILDDIR
)/romstart.txt
247 $(BUILDDIR
)/rombox.ucl
: $(BUILDDIR
)/rombox.bin
$(MAXOUTFILE
)
248 $(call PRINTS
,UCLPACK
$(@F
))$(TOOLSDIR
)/uclpack
--none
$< $@
>/dev
/null
; \
249 perl
$(TOOLSDIR
)/romsizetest.pl
`cat $(MAXOUTFILE)` $<; \
250 if
test $$?
-ne
0; then \
251 echo
"removing UCL file again, making it a fake one"; \
256 $(call PRINTS
,Creating
$(@F
))
257 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
258 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
259 $(call preprocess2file
,$(MAXINFILE
),$(MAXOUTFILE
))
260 $(SILENT
)rm $(MAXINFILE
)
263 $(BUILDDIR
)/rombox.iriver
: $(BUILDDIR
)/rombox.bin
264 $(call PRINTS
,Build ROM file
)$(MKFIRMWARE
) $< $@
271 $(SILENT
)$(MAKE
) -C
$(TOOLSDIR
) CC
=$(HOSTCC
) AR
=$(HOSTAR
) rbspeexenc voicefont wavtrim
275 $(SILENT
)etags
-o
$(BUILDDIR
)/TAGS
$(filter-out %.o
,$(SRC
) $(OTHER_SRC
))
278 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
1 -o rockbox-fonts.zip
$(TARGET
) $(BINARY
)
280 zip
: $(BUILDDIR
)/rockbox.zip
283 $(BUILDDIR
)/rockbox.zip
:
285 $(BUILDDIR
)/rockbox.zip
: build
287 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" $(TARGET
) $(BINARY
)
290 $(SILENT
)find .
-name
"*.map" | xargs zip rockbox-maps.zip
293 $(SILENT
)find .
-name
"*.elf" | xargs zip rockbox-elfs.zip
296 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
2 -o rockbox-full.zip
$(TARGET
) $(BINARY
)
299 $(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
)
302 $(SILENT
)rm -f rockbox.
tar
303 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
\"$(MODELNAME
)\" -i
\"$(TARGET_ID
)\" -o
"rockbox.tar" -z
"tar -cf" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" $(TARGET
) $(BINARY
)
306 $(SILENT
)bzip2
-f9 rockbox.
tar
309 $(SILENT
)gzip
-f9 rockbox.
tar
312 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-pdf
314 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-html
315 manual-zhtml
: manual-zip
317 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-txt
319 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-txt-zip
321 $(SILENT
)$(MAKE
) -C
$(MANUALDIR
) OBJDIR
=$(BUILDDIR
)/manual manual-zip
325 voice
: voicetools
$(BUILDDIR
)/apps
/features
326 $(SILENT
)for f in
`cat $(BUILDDIR)/apps/features`; do feat
="$$feat:$$f" ; done
; \
327 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 \
331 ifeq (,$(findstring android
, $(APP_TYPE
)))
332 bininstall
: $(BUILDDIR
)/$(BINARY
)
333 @echo
"Installing your rockbox binary in your '$(RBPREFIX)' dir"
334 $(SILENT
)cp
$(BINARY
) "$(RBPREFIX)/.rockbox/"
337 @echo
"Installing your build in your '$(RBPREFIX)' dir"
338 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
"$(MODELNAME)" -i
"$(TARGET_ID)" $(INSTALL
) -z
"zip -r0" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
0 $(TARGET
) $(BINARY
)
341 @echo
"Installing a full setup in your '$(RBPREFIX)' dir"
342 $(SILENT
)$(TOOLSDIR
)/buildzip.pl
$(VERBOSEOPT
) --app
=$(APPLICATION
) -m
"$(MODELNAME)" -i
"$(TARGET_ID)" $(INSTALL
) -z
"zip -r0" -r
"$(ROOTDIR)" --rbdir
="$(RBDIR)" -f
2 $(TARGET
) $(BINARY
)
345 @echo
"Installing a full setup with links in your '$(RBPREFIX)' dir"
346 $(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
350 @echo
"A few helpful make targets"
352 @echo
"all - builds a full Rockbox (default), including tools"
353 @echo
"bin - builds only the Rockbox.<target name> file"
354 @echo
"rocks - builds only plugins"
355 @echo
"codecs - builds only codecs"
356 @echo
"dep - regenerates make dependency database"
357 @echo
"clean - cleans a build directory (not tools)"
358 @echo
"veryclean - cleans the build and tools directories"
359 @echo
"manual - builds a manual (pdf)"
360 @echo
"manual-html - HTML manual"
361 @echo
"manual-zip - HTML manual (zipped)"
362 @echo
"manual-txt - txt manual"
363 @echo
"fullzip - creates a rockbox.zip of your build with fonts"
364 @echo
"zip - creates a rockbox.zip of your build (no fonts)"
365 @echo
"gzip - creates a rockbox.tar.gz of your build (no fonts)"
366 @echo
"bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
367 @echo
"7zip - creates a rockbox.7z of your build (no fonts)"
368 @echo
"fontzip - creates rockbox-fonts.zip"
369 @echo
"mapzip - creates rockbox-maps.zip with all .map files"
370 @echo
"elfzip - creates rockbox-elfs.zip with all .elf files"
371 @echo
"pnd - creates rockbox.pnd archive (Pandora builds only)"
372 @echo
"tools - builds the tools only"
373 @echo
"voice - creates the voice clips (voice builds only)"
374 @echo
"voicetools - builds the voice tools only"
375 @echo
"install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))"
376 @echo
"fullinstall - installs your build (like install, but with fonts)"
377 @echo
"symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)"
378 @echo
"reconf - rerun configure with the same selection"
380 ### general compile rules:
382 # when source and object are in different locations (normal):
383 $(BUILDDIR
)/%.o
: $(ROOTDIR
)/%.c
384 $(SILENT
)mkdir
-p
$(dir $@
)
385 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) -c
$< -o
$@
387 $(BUILDDIR
)/%.o
: $(ROOTDIR
)/%.S
388 $(SILENT
)mkdir
-p
$(dir $@
)
389 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) $(ASMFLAGS
) -c
$< -o
$@
391 # generated definitions for use in .S files
392 $(BUILDDIR
)/%_asmdefs.h
: $(ROOTDIR
)/%_asmdefs.c
393 $(call PRINTS
,ASMDEFS
$(@F
))
394 $(SILENT
)mkdir
-p
$(dir $@
)
395 $(call asmdefs2file
,$<,$@
)
397 # when source and object are both in BUILDDIR (generated code):
399 $(SILENT
)mkdir
-p
$(dir $@
)
400 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) -c
$< -o
$@
403 $(SILENT
)mkdir
-p
$(dir $@
)
404 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) $(CFLAGS
) $(ASMFLAGS
) -c
$< -o
$@
406 Makefile
: $(TOOLSDIR
)/configure
407 ifneq (reconf
,$(MAKECMDGOALS
))
408 $(SILENT
)echo
"*** tools/configure is newer than Makefile. You should run 'make reconf'."
412 $(SILENT
$)$(TOOLSDIR
)/configure
$(CONFIGURE_OPTIONS
)