blob: 0075ed2137f9a6da99580e45d0e8bd39379a9b63 [file] [log] [blame]
Björn Stenbergc6b3d382008-11-20 11:27:31 +00001# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
Björn Stenberga091d202008-11-25 19:54:23 +00007# $Id$
Björn Stenbergc6b3d382008-11-20 11:27:31 +00008#
9
10include $(TOOLSDIR)/functions.make
11
Andree Buschmann5d849a92011-02-02 17:43:32 +000012DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) $(TARGET) \
Rafaël Carré5d236b22010-05-27 09:41:46 +000013 -DTARGET_ID=$(TARGET_ID) -DTARGET_NAME=\"$(MODELNAME)\" $(BUILDDATE) \
Björn Stenbergc6b3d382008-11-20 11:27:31 +000014 $(EXTRA_DEFINES) # <-- -DSIMULATOR or not
Tom Ross4fb58642009-03-02 06:13:18 +000015INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC)
Björn Stenbergc6b3d382008-11-20 11:27:31 +000016
17CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
Jens Arnoldeef14e32010-03-20 08:53:27 +000018PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
Thomas Martitz0bf1bd12010-12-27 17:27:59 +000019ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files
Michael Sevakis95e23de2013-04-16 17:47:58 -040020CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build
Björn Stenbergc6b3d382008-11-20 11:27:31 +000021
22TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
23 $(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \
Maurus Cuelenaere19204622010-02-16 21:55:42 +000024 $(TOOLSDIR)/uclpack $(TOOLSDIR)/mkboot $(TOOLSDIR)/iaudio_bl_flash.c \
Frank Gevaerts36d98fa2011-03-09 21:50:43 +000025 $(TOOLSDIR)/iaudio_bl_flash.h
Björn Stenbergc6b3d382008-11-20 11:27:31 +000026
Jens Arnold266dc522012-05-18 23:24:57 +020027ifeq ($(MODELNAME),archosplayer)
28 TOOLS += $(TOOLSDIR)/player_unifont
29endif
Thomas Martitz7ed1a5f2009-04-12 01:28:33 +000030
31ifeq (,$(PREFIX))
Thomas Martitz9c0b2472010-08-01 16:15:27 +000032ifdef APP_TYPE
Thomas Martitz7ed1a5f2009-04-12 01:28:33 +000033# for sims, set simdisk/ as default
Thomas Martitz9c0b2472010-08-01 16:15:27 +000034ifeq ($(APP_TYPE),sdl-sim)
35RBPREFIX = simdisk
36else ifeq ($(APP_TYPE),sdl-app)
37RBPREFIX = /usr/local
38endif
39
40INSTALL = --install="$(RBPREFIX)"
Thomas Martitz7ed1a5f2009-04-12 01:28:33 +000041else
42# /dev/null as magic to tell it wasn't set, error out later in buildzip.pl
43INSTALL = --install=/dev/null
44endif
45else
Thomas Martitz9c0b2472010-08-01 16:15:27 +000046RBPREFIX = $(PREFIX)
47INSTALL = --install="$(RBPREFIX)"
Thomas Martitz7ed1a5f2009-04-12 01:28:33 +000048endif
49
Björn Stenberg8a7c4af2008-11-21 13:21:25 +000050RBINFO = $(BUILDDIR)/rockbox-info.txt
51
Björn Stenbergc6b3d382008-11-20 11:27:31 +000052# list suffixes to be understood by $*
53.SUFFIXES: .rock .codec .map .elf .c .S .o .bmp .a
54
55.PHONY: all clean tags zip tools manual bin build info langs
56
Jens Arnold08f51a52009-03-10 19:06:14 +000057ifeq (,$(filter clean veryclean reconf tags voice voicetools manual manual-pdf manual-html manual-zhtml manual-txt manual-ztxt manual-zip help fontzip ,$(MAKECMDGOALS)))
Björn Stenberg34332cf2008-11-26 23:21:30 +000058# none of the above
Björn Stenbergc6b3d382008-11-20 11:27:31 +000059DEPFILE = $(BUILDDIR)/make.dep
60
Björn Stenberg34332cf2008-11-26 23:21:30 +000061endif
62
Björn Stenbergc6b3d382008-11-20 11:27:31 +000063all: $(DEPFILE) build
64
Thomas Martitzf269aa02012-03-26 22:24:57 +020065# Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC,
Björn Stenberg1501df02013-01-24 16:01:28 +010066# ASMDEFS_SRC and CORE_LIBS. But they also define special dependencies and
67# compile rules
Björn Stenbergc6b3d382008-11-20 11:27:31 +000068include $(TOOLSDIR)/tools.make
Björn Stenbergffaf2462009-09-01 14:53:37 +000069
Frank Gevaerts215ac632012-03-27 01:22:51 +020070ifeq (,$(findstring checkwps,$(APP_TYPE)))
71 ifeq (,$(findstring database,$(APP_TYPE)))
72 ifeq (,$(findstring warble,$(APP_TYPE)))
Thomas Martitz83cb2e52012-03-27 00:16:09 +020073 include $(FIRMDIR)/firmware.make
74 include $(ROOTDIR)/apps/bitmaps/bitmaps.make
Dominik Riebeling96236852013-03-13 21:40:04 +010075 ifeq (arch_arm,$(ARCH))
Amaury Pouly1d121e82017-02-23 11:33:19 +010076 # some targets don't use the unwarminder because they have the glibc backtrace
77 ifeq (,$(filter sonynwz,$(APP_TYPE)))
78 include $(ROOTDIR)/lib/unwarminder/unwarminder.make
79 endif
Dominik Riebeling96236852013-03-13 21:40:04 +010080 endif
Björn Stenberg1501df02013-01-24 16:01:28 +010081 ifeq (,$(findstring bootloader,$(APPSDIR)))
Thomas Martitz83cb2e52012-03-27 00:16:09 +020082 include $(ROOTDIR)/lib/skin_parser/skin_parser.make
Thomas Martitzc56950e2012-03-27 16:27:02 +020083 include $(ROOTDIR)/lib/tlsf/libtlsf.make
Thomas Martitz83cb2e52012-03-27 00:16:09 +020084 endif
Thomas Martitz045c69c2012-03-26 23:55:02 +020085 endif
Yoshihisa Uchidaec39c052010-02-25 12:28:30 +000086 endif
Björn Stenbergffaf2462009-09-01 14:53:37 +000087endif
Björn Stenbergc6b3d382008-11-20 11:27:31 +000088
Thomas Martitzcf333a62012-01-17 07:36:08 +010089#included before codecs.make and plugins.make so they see them)
Thomas Martitz46454ac2010-08-24 12:38:42 +000090ifndef APP_TYPE
91 include $(ROOTDIR)/lib/libsetjmp/libsetjmp.make
Thomas Martitz7b1a3692012-03-28 22:57:13 +020092 ifeq (arch_arm,$(ARCH))
Thomas Martitzcf333a62012-01-17 07:36:08 +010093 include $(ROOTDIR)/lib/arm_support/arm_support.make
94 endif
Thomas Martitz46454ac2010-08-24 12:38:42 +000095endif
96
Michael Sevakis95e23de2013-04-16 17:47:58 -040097ifeq (,$(findstring bootloader,$(APPSDIR)))
98 ifeq (,$(findstring checkwps,$(APP_TYPE)))
99 include $(ROOTDIR)/lib/fixedpoint/fixedpoint.make
100 endif
101endif
102
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000103ifneq (,$(findstring bootloader,$(APPSDIR)))
Amaury Pouly1d121e82017-02-23 11:33:19 +0100104 ifneq (,$(findstring sonynwz,$(APP_TYPE)))
105 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
Marcin Bukatd5568092017-04-27 11:36:40 +0200106 else ifneq (,$(findstring rocker,$(APP_TYPE)))
107 include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make
Amaury Pouly1d121e82017-02-23 11:33:19 +0100108 else
109 include $(APPSDIR)/bootloader.make
110 endif
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000111else ifneq (,$(findstring bootbox,$(APPSDIR)))
112 include $(APPSDIR)/bootbox.make
Frank Gevaerts466a7c62012-03-03 19:37:40 +0100113else ifneq (,$(findstring checkwps,$(APP_TYPE)))
Maurus Cuelenaere8bff5642009-08-21 20:28:26 +0000114 include $(APPSDIR)/checkwps.make
Thomas Martitzd5f43912012-03-26 23:57:20 +0200115 include $(ROOTDIR)/lib/skin_parser/skin_parser.make
Frank Gevaerts466a7c62012-03-03 19:37:40 +0100116else ifneq (,$(findstring database,$(APP_TYPE)))
Frank Gevaerts6e115722009-10-07 16:54:15 +0000117 include $(APPSDIR)/database.make
Frank Gevaerts466a7c62012-03-03 19:37:40 +0100118else ifneq (,$(findstring warble,$(APP_TYPE)))
119 include $(ROOTDIR)/lib/rbcodec/test/warble.make
Thomas Martitza8b3d502012-03-29 00:01:44 +0200120 include $(ROOTDIR)/lib/tlsf/libtlsf.make
Thomas Martitz83cb2e52012-03-27 00:16:09 +0200121 include $(ROOTDIR)/lib/rbcodec/rbcodec.make
Michael Sevakis95e23de2013-04-16 17:47:58 -0400122else # core
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000123 include $(APPSDIR)/apps.make
124 include $(APPSDIR)/lang/lang.make
Michael Sevakis95e23de2013-04-16 17:47:58 -0400125 include $(ROOTDIR)/lib/rbcodec/rbcodec.make
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000126
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000127 ifdef ENABLEDPLUGINS
128 include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make
129 include $(APPSDIR)/plugins/plugins.make
130 endif
131
Thomas Martitzf8381d92010-09-02 00:24:40 +0000132 ifneq (,$(findstring sdl,$(APP_TYPE)))
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000133 include $(ROOTDIR)/uisimulator/uisimulator.make
134 endif
Thomas Martitzf8381d92010-09-02 00:24:40 +0000135
Thomas Martitz249bba02011-12-24 11:56:46 +0000136 ifneq (,$(findstring ypr0,$(APP_TYPE)))
Lorenzo Miori60592162013-02-23 16:59:49 +0100137 include $(ROOTDIR)/firmware/target/hosted/samsungypr/ypr0/ypr0.make
Thomas Martitz249bba02011-12-24 11:56:46 +0000138 endif
139
Lorenzo Miorie876f4d2013-09-10 22:48:34 +0200140 ifneq (,$(findstring ypr1,$(APP_TYPE)))
141 include $(ROOTDIR)/firmware/target/hosted/samsungypr/ypr1/ypr1.make
142 endif
143
Amaury Pouly1d121e82017-02-23 11:33:19 +0100144 ifneq (,$(findstring sonynwz,$(APP_TYPE)))
145 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
146 endif
147
Marcin Bukatd5568092017-04-27 11:36:40 +0200148 ifneq (,$(findstring rocker,$(APP_TYPE)))
149 include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make
150 endif
151
Udo Schläpferdbabd0d2015-02-02 21:44:29 +0100152 ifneq (,$(findstring android_ndk, $(APP_TYPE)))
153 include $(ROOTDIR)/firmware/target/hosted/ibasso/android_ndk.make
154 else
155 ifneq (,$(findstring android, $(APP_TYPE)))
156 include $(ROOTDIR)/android/android.make
157 endif
Thomas Martitzf8381d92010-09-02 00:24:40 +0000158 endif
Thomas Jarosch986a92f2011-06-09 20:58:03 +0000159
160 ifneq (,$(findstring pandora, $(MODELNAME)))
161 include $(ROOTDIR)/packaging/pandora/pandora.make
162 endif
163
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000164endif # bootloader
165
Michael Sevakis95e23de2013-04-16 17:47:58 -0400166# One or more subdir makefiles requested --gc-sections?
167ifdef CORE_GCSECTIONS
168 # Do not use '--gc-sections' when compiling sdl-sim
169 ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
170 CORE_LDOPTS += -Wl,--gc-sections
171 endif
172endif # CORE_GCSECTIONS
173
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000174OBJ := $(SRC:.c=.o)
175OBJ := $(OBJ:.S=.o)
176OBJ += $(BMP:.bmp=.o)
Amaury Poulyb9596552017-05-12 19:50:56 +1000177OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(OBJ))
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000178
Björn Stenberg8a7c4af2008-11-21 13:21:25 +0000179build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO)
180
181$(RBINFO): $(BUILDDIR)/$(BINARY)
182 $(SILENT)echo Creating $(@F)
183 $(SILENT)$(TOOLSDIR)/mkinfo.pl $@
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000184
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000185$(DEPFILE) dep:
186 $(call PRINTS,Generating dependencies)
Rafaël Carré27c509f2010-08-21 18:07:12 +0000187 $(call mkdepfile,$(DEPFILE)_,$(SRC))
188 $(call mkdepfile,$(DEPFILE)_,$(OTHER_SRC:%.lua=))
189 $(call mkdepfile,$(DEPFILE)_,$(ASMDEFS_SRC))
190 $(call bmpdepfile,$(DEPFILE)_,$(BMP) $(PBMP))
Maurus Cuelenaeree8da4472009-02-04 20:59:27 +0000191 @mv $(DEPFILE)_ $(DEPFILE)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000192
Thomas Martitz64f4b872009-04-03 13:44:47 +0000193bin: $(DEPFILE) $(TOOLS) $(BUILDDIR)/$(BINARY) $(RBINFO)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000194rocks: $(DEPFILE) $(TOOLS) $(ROCKS)
195codecs: $(DEPFILE) $(TOOLS) $(CODECS)
Maurus Cuelenaerecf313862009-03-11 16:13:46 +0000196tools: $(TOOLS)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000197
198-include $(DEPFILE)
199
200veryclean: clean
201 $(SILENT)rm -rf $(TOOLS)
202
Thomas Martitza9944012010-09-12 16:35:02 +0000203clean::
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000204 $(SILENT)echo Cleaning build directory
Björn Stenberg046776c2008-11-22 23:34:24 +0000205 $(SILENT)rm -rf rockbox.zip rockbox.7z rockbox.tar rockbox.tar.gz \
Rafaël Carré1da9b712010-06-19 06:11:22 +0000206 rockbox.tar.bz2 TAGS apps firmware tools comsim sim lang lib \
Björn Stenberg046776c2008-11-22 23:34:24 +0000207 manual *.pdf *.a credits.raw rockbox.ipod bitmaps \
208 pluginbitmaps UI256.bmp rockbox-full.zip html txt \
209 rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids \
Tom Ross4fb58642009-03-02 06:13:18 +0000210 *.wav *.mp3 *.voice $(CLEANOBJS) \
Björn Stenberg046776c2008-11-22 23:34:24 +0000211 $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin \
Jens Arnold89b41572008-11-28 22:22:47 +0000212 make.dep rombox.elf rombox.map rombox.bin rombox.ucl romstart.txt \
Maurus Cuelenaere0b92c0f2011-03-11 15:45:49 +0000213 $(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \
Dominik Riebelingfc68a0d2011-05-29 18:44:42 +0000214 rockbox.apk
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000215
216#### linking the binaries: ####
217
218.SECONDEXPANSION:
219
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000220ifeq (,$(findstring bootloader,$(APPSDIR)))
221# not bootloader
222
Björn Stenberg6b962702008-11-21 15:27:16 +0000223OBJ += $(LANG_O)
224
Thomas Martitz57613ea2010-07-10 13:49:49 +0000225ifndef APP_TYPE
Björn Stenberg6b962702008-11-21 15:27:16 +0000226
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000227## target build
Rafaël Carréa9e2a712010-01-24 15:32:23 +0000228CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h
Marcin Bukata02f8632014-01-10 16:12:38 +0100229ifeq ($(wildcard $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/app.lds),)
230RAMLDS := $(FIRMDIR)/target/$(CPU)/app.lds
231else
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000232RAMLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/app.lds
Marcin Bukata02f8632014-01-10 16:12:38 +0100233endif
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000234LINKRAM := $(BUILDDIR)/ram.link
235ROMLDS := $(FIRMDIR)/rom.lds
236LINKROM := $(BUILDDIR)/rom.link
237
Rafaël Carréa9e2a712010-01-24 15:32:23 +0000238$(LINKRAM): $(RAMLDS) $(CONFIGFILE)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000239 $(call PRINTS,PP $(@F))
240 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
241
242$(LINKROM): $(ROMLDS)
243 $(call PRINTS,PP $(@F))
244 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
245
Dominik Riebeling736c3782013-05-04 22:16:08 +0200246# Note: make sure -Wl,--gc-sections comes before -T in the linker options.
247# Having the latter first caused crashes on (at least) mini2g.
Thomas Martitzf269aa02012-03-26 22:24:57 +0200248$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKRAM)
Björn Stenberga3864b02008-11-20 15:04:30 +0000249 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
250 -L$(BUILDDIR)/firmware -lfirmware \
Sean Bartellf40bfc92011-06-25 21:32:25 -0400251 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
Thomas Martitzf269aa02012-03-26 22:24:57 +0200252 -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
Dominik Riebeling736c3782013-05-04 22:16:08 +0200253 -lgcc $(CORE_LDOPTS) -T$(LINKRAM) \
254 -Wl,-Map,$(BUILDDIR)/rockbox.map
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000255
Thomas Martitzf269aa02012-03-26 22:24:57 +0200256$(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000257 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
Thomas Martitzcf333a62012-01-17 07:36:08 +0100258 -L$(BUILDDIR)/firmware -lfirmware \
Sean Bartellf40bfc92011-06-25 21:32:25 -0400259 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
Thomas Martitzf269aa02012-03-26 22:24:57 +0200260 -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \
Dominik Riebeling736c3782013-05-04 22:16:08 +0200261 -lgcc $(CORE_LDOPTS) -T$(LINKROM) \
262 -Wl,-Map,$(BUILDDIR)/rombox.map
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000263
264$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
Thomas Martitz4b56ee02012-04-04 21:43:22 +0200265 $(call PRINTS,OC $(@F))$(call objcopy,$<,$@)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000266
267$(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf
Thomas Martitz4b56ee02012-04-04 21:43:22 +0200268 $(call PRINTS,OC $(@F))$(call objcopy,$<,$@)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000269
270#
271# If there's a flashfile defined for this target (rockbox.ucl for Archos
272# models) Then check if the mkfirmware script fails, as then it is (likely)
273# because the image is too big and we need to create a compressed image
274# instead.
275#
276$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE)
277 $(call PRINTS,SCRAMBLE $(notdir $@))($(MKFIRMWARE) $< $@; \
278 stat=$$?; \
279 if test -n "$(FLASHFILE)"; then \
280 if test "$$stat" -ne 0; then \
281 echo "Image too big, making a compressed version!"; \
282 $(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
283 $(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
284 fi \
285 fi )
286
287# archos
288$(BUILDDIR)/rockbox.ucl: $(BUILDDIR)/rockbox.bin
Daniel Stenberg2e6d6042009-02-23 08:45:16 +0000289 $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000290
291MAXINFILE = $(BUILDDIR)/temp.txt
292MAXOUTFILE = $(BUILDDIR)/romstart.txt
293
294$(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE)
295 $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --none $< $@ >/dev/null; \
296 perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
297 if test $$? -ne 0; then \
298 echo "removing UCL file again, making it a fake one"; \
299 echo "fake" > $@; \
300 fi
301
302$(MAXOUTFILE):
303 $(call PRINTS,Creating $(@F))
Rafaël Carré27c509f2010-08-21 18:07:12 +0000304 $(SILENT)echo '#include "config.h"' > $(MAXINFILE)
305 $(SILENT)echo "ROM_START" >> $(MAXINFILE)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000306 $(call preprocess2file,$(MAXINFILE),$(MAXOUTFILE))
307 $(SILENT)rm $(MAXINFILE)
308
309# iriver
310$(BUILDDIR)/rombox.iriver: $(BUILDDIR)/rombox.bin
311 $(call PRINTS,Build ROM file)$(MKFIRMWARE) $< $@
312
Thomas Martitz57613ea2010-07-10 13:49:49 +0000313endif # !APP_TYPE
Björn Stenberg6b962702008-11-21 15:27:16 +0000314endif # !bootloader
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000315
316
317voicetools:
318 $(SILENT)$(MAKE) -C $(TOOLSDIR) CC=$(HOSTCC) AR=$(HOSTAR) rbspeexenc voicefont wavtrim
319
320tags:
321 $(SILENT)rm -f TAGS
322 $(SILENT)etags -o $(BUILDDIR)/TAGS $(filter-out %.o,$(SRC) $(OTHER_SRC))
323
324fontzip:
Dave Chapman376c9f32011-02-27 11:37:39 +0000325 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 1 -o rockbox-fonts.zip $(TARGET) $(BINARY)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000326
Björn Stenbergc3cf8bc2011-06-06 22:00:44 +0000327zip: $(BUILDDIR)/rockbox.zip
328
Björn Stenberg35cd4082011-06-22 14:14:49 +0000329ifdef NODEPS
330$(BUILDDIR)/rockbox.zip:
331else
Björn Stenbergc3cf8bc2011-06-06 22:00:44 +0000332$(BUILDDIR)/rockbox.zip: build
Björn Stenberg35cd4082011-06-22 14:14:49 +0000333endif
Solomon Peachyebaddc62018-08-31 13:39:25 -0400334 $(call PRINTS,ZIP $(notdir $@))
Dave Chapman376c9f32011-02-27 11:37:39 +0000335 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(TARGET) $(BINARY)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000336
337mapzip:
338 $(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
339
Alex Parker745406a2011-02-20 19:56:53 +0000340elfzip:
341 $(SILENT)find . -name "*.elf" | xargs zip rockbox-elfs.zip
342
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000343fullzip:
Dave Chapman376c9f32011-02-27 11:37:39 +0000344 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 2 -o rockbox-full.zip $(TARGET) $(BINARY)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000345
3467zip:
Dave Chapman376c9f32011-02-27 11:37:39 +0000347 $(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)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000348
349tar:
350 $(SILENT)rm -f rockbox.tar
Dave Chapman376c9f32011-02-27 11:37:39 +0000351 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -i \"$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(TARGET) $(BINARY)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000352
353bzip2: tar
354 $(SILENT)bzip2 -f9 rockbox.tar
355
356gzip: tar
357 $(SILENT)gzip -f9 rockbox.tar
358
359manual manual-pdf:
360 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-pdf
361manual-html:
362 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-html
363manual-zhtml: manual-zip
364manual-txt:
365 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt
366manual-ztxt:
367 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt-zip
368manual-zip:
369 $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-zip
370
371ifdef TTS_ENGINE
372
Frank Gevaerts94aa0d72010-06-30 16:29:55 +0000373voice: voicetools $(BUILDDIR)/apps/features
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000374 $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
375 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 \
376
377endif
378
Antoine Celleriera448d8b2011-01-24 17:06:04 +0000379ifeq (,$(findstring android, $(APP_TYPE)))
Thomas Martitz46137eb2014-02-22 23:17:16 +0100380
Michael Sevakis7d1a47c2013-08-05 22:02:45 -0400381simext1:
Thomas Martitz46137eb2014-02-22 23:17:16 +0100382 $(SILENT)mkdir -p $@
383
Rafaël Carré89eb19d2010-06-19 08:46:18 +0000384bininstall: $(BUILDDIR)/$(BINARY)
Thomas Martitz9c0b2472010-08-01 16:15:27 +0000385 @echo "Installing your rockbox binary in your '$(RBPREFIX)' dir"
386 $(SILENT)cp $(BINARY) "$(RBPREFIX)/.rockbox/"
Rafaël Carré53367ba2010-06-19 08:43:53 +0000387
Michael Sevakis7d1a47c2013-08-05 22:02:45 -0400388install: simext1
Michael Chicoinec6bcd912010-08-08 00:03:08 +0000389 @echo "Installing your build in your '$(RBPREFIX)' dir"
Dave Chapman376c9f32011-02-27 11:37:39 +0000390 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m "$(MODELNAME)" -i "$(TARGET_ID)" $(INSTALL) -z "zip -r0" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 0 $(TARGET) $(BINARY)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000391
Michael Sevakis7d1a47c2013-08-05 22:02:45 -0400392fullinstall: simext1
Michael Chicoinec6bcd912010-08-08 00:03:08 +0000393 @echo "Installing a full setup in your '$(RBPREFIX)' dir"
Dave Chapman376c9f32011-02-27 11:37:39 +0000394 $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m "$(MODELNAME)" -i "$(TARGET_ID)" $(INSTALL) -z "zip -r0" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 2 $(TARGET) $(BINARY)
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000395
Michael Sevakis7d1a47c2013-08-05 22:02:45 -0400396symlinkinstall: simext1
Michael Stummvoll1f06ca42010-12-28 10:30:46 +0000397 @echo "Installing a full setup with links in your '$(RBPREFIX)' dir"
Dave Chapman376c9f32011-02-27 11:37:39 +0000398 $(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
Antoine Celleriera448d8b2011-01-24 17:06:04 +0000399endif
Michael Stummvoll1f06ca42010-12-28 10:30:46 +0000400
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000401help:
402 @echo "A few helpful make targets"
403 @echo ""
Michael Stummvoll1f06ca42010-12-28 10:30:46 +0000404 @echo "all - builds a full Rockbox (default), including tools"
405 @echo "bin - builds only the Rockbox.<target name> file"
406 @echo "rocks - builds only plugins"
407 @echo "codecs - builds only codecs"
408 @echo "dep - regenerates make dependency database"
409 @echo "clean - cleans a build directory (not tools)"
410 @echo "veryclean - cleans the build and tools directories"
411 @echo "manual - builds a manual (pdf)"
412 @echo "manual-html - HTML manual"
413 @echo "manual-zip - HTML manual (zipped)"
414 @echo "manual-txt - txt manual"
415 @echo "fullzip - creates a rockbox.zip of your build with fonts"
416 @echo "zip - creates a rockbox.zip of your build (no fonts)"
417 @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
418 @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
419 @echo "7zip - creates a rockbox.7z of your build (no fonts)"
420 @echo "fontzip - creates rockbox-fonts.zip"
421 @echo "mapzip - creates rockbox-maps.zip with all .map files"
Alex Parkerd0a0d022011-02-26 20:50:12 +0000422 @echo "elfzip - creates rockbox-elfs.zip with all .elf files"
Thomas Jarosch986a92f2011-06-09 20:58:03 +0000423 @echo "pnd - creates rockbox.pnd archive (Pandora builds only)"
Michael Stummvoll1f06ca42010-12-28 10:30:46 +0000424 @echo "tools - builds the tools only"
425 @echo "voice - creates the voice clips (voice builds only)"
426 @echo "voicetools - builds the voice tools only"
427 @echo "install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))"
428 @echo "fullinstall - installs your build (like install, but with fonts)"
429 @echo "symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)"
430 @echo "reconf - rerun configure with the same selection"
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000431
432### general compile rules:
433
434# when source and object are in different locations (normal):
435$(BUILDDIR)/%.o: $(ROOTDIR)/%.c
436 $(SILENT)mkdir -p $(dir $@)
437 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
438
439$(BUILDDIR)/%.o: $(ROOTDIR)/%.S
440 $(SILENT)mkdir -p $(dir $@)
Thomas Martitz0bf1bd12010-12-27 17:27:59 +0000441 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) $(ASMFLAGS) -c $< -o $@
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000442
Andrew Mahone668a7692009-07-13 00:40:35 +0000443# generated definitions for use in .S files
444$(BUILDDIR)/%_asmdefs.h: $(ROOTDIR)/%_asmdefs.c
445 $(call PRINTS,ASMDEFS $(@F))
446 $(SILENT)mkdir -p $(dir $@)
447 $(call asmdefs2file,$<,$@)
448
Björn Stenbergc6b3d382008-11-20 11:27:31 +0000449# when source and object are both in BUILDDIR (generated code):
450%.o: %.c
451 $(SILENT)mkdir -p $(dir $@)
452 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
453
454%.o: %.S
455 $(SILENT)mkdir -p $(dir $@)
Thomas Martitz0bf1bd12010-12-27 17:27:59 +0000456 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) $(ASMFLAGS) -c $< -o $@
Daniel Stenberg4ef890e2009-01-09 23:15:27 +0000457
Björn Stenbergfc537252009-01-10 22:23:27 +0000458Makefile: $(TOOLSDIR)/configure
Antoine Cellerieref0c9da2009-08-02 09:45:51 +0000459ifneq (reconf,$(MAKECMDGOALS))
Björn Stenberg6d871d52009-01-10 22:36:41 +0000460 $(SILENT)echo "*** tools/configure is newer than Makefile. You should run 'make reconf'."
Antoine Cellerieref0c9da2009-08-02 09:45:51 +0000461endif
Björn Stenberg6d871d52009-01-10 22:36:41 +0000462
463reconf:
Thomas Martitz9c0b2472010-08-01 16:15:27 +0000464 $(SILENT$)$(TOOLSDIR)/configure $(CONFIGURE_OPTIONS)