Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
Björn Stenberg | a091d20 | 2008-11-25 19:54:23 +0000 | [diff] [blame] | 7 | # $Id$ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 8 | # |
| 9 | |
| 10 | include $(TOOLSDIR)/functions.make |
| 11 | |
Andree Buschmann | 5d849a9 | 2011-02-02 17:43:32 +0000 | [diff] [blame] | 12 | DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) $(TARGET) \ |
Rafaël Carré | 5d236b2 | 2010-05-27 09:41:46 +0000 | [diff] [blame] | 13 | -DTARGET_ID=$(TARGET_ID) -DTARGET_NAME=\"$(MODELNAME)\" $(BUILDDATE) \ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 14 | $(EXTRA_DEFINES) # <-- -DSIMULATOR or not |
Tom Ross | 4fb5864 | 2009-03-02 06:13:18 +0000 | [diff] [blame] | 15 | INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 16 | |
| 17 | CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS) |
Jens Arnold | eef14e3 | 2010-03-20 08:53:27 +0000 | [diff] [blame] | 18 | PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix |
Thomas Martitz | 0bf1bd1 | 2010-12-27 17:27:59 +0000 | [diff] [blame] | 19 | ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 20 | |
| 21 | TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \ |
| 22 | $(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \ |
Maurus Cuelenaere | 1920462 | 2010-02-16 21:55:42 +0000 | [diff] [blame] | 23 | $(TOOLSDIR)/uclpack $(TOOLSDIR)/mkboot $(TOOLSDIR)/iaudio_bl_flash.c \ |
Frank Gevaerts | 36d98fa | 2011-03-09 21:50:43 +0000 | [diff] [blame] | 24 | $(TOOLSDIR)/iaudio_bl_flash.h |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 25 | |
Thomas Martitz | 7ed1a5f | 2009-04-12 01:28:33 +0000 | [diff] [blame] | 26 | |
| 27 | ifeq (,$(PREFIX)) |
Thomas Martitz | 9c0b247 | 2010-08-01 16:15:27 +0000 | [diff] [blame] | 28 | ifdef APP_TYPE |
Thomas Martitz | 7ed1a5f | 2009-04-12 01:28:33 +0000 | [diff] [blame] | 29 | # for sims, set simdisk/ as default |
Thomas Martitz | 9c0b247 | 2010-08-01 16:15:27 +0000 | [diff] [blame] | 30 | ifeq ($(APP_TYPE),sdl-sim) |
| 31 | RBPREFIX = simdisk |
| 32 | else ifeq ($(APP_TYPE),sdl-app) |
| 33 | RBPREFIX = /usr/local |
| 34 | endif |
| 35 | |
| 36 | INSTALL = --install="$(RBPREFIX)" |
Thomas Martitz | 7ed1a5f | 2009-04-12 01:28:33 +0000 | [diff] [blame] | 37 | else |
| 38 | # /dev/null as magic to tell it wasn't set, error out later in buildzip.pl |
| 39 | INSTALL = --install=/dev/null |
| 40 | endif |
| 41 | else |
Thomas Martitz | 9c0b247 | 2010-08-01 16:15:27 +0000 | [diff] [blame] | 42 | RBPREFIX = $(PREFIX) |
| 43 | INSTALL = --install="$(RBPREFIX)" |
Thomas Martitz | 7ed1a5f | 2009-04-12 01:28:33 +0000 | [diff] [blame] | 44 | endif |
| 45 | |
Björn Stenberg | 8a7c4af | 2008-11-21 13:21:25 +0000 | [diff] [blame] | 46 | RBINFO = $(BUILDDIR)/rockbox-info.txt |
| 47 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 48 | # list suffixes to be understood by $* |
| 49 | .SUFFIXES: .rock .codec .map .elf .c .S .o .bmp .a |
| 50 | |
| 51 | .PHONY: all clean tags zip tools manual bin build info langs |
| 52 | |
Jens Arnold | 08f51a5 | 2009-03-10 19:06:14 +0000 | [diff] [blame] | 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))) |
Björn Stenberg | 34332cf | 2008-11-26 23:21:30 +0000 | [diff] [blame] | 54 | # none of the above |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 55 | DEPFILE = $(BUILDDIR)/make.dep |
| 56 | |
Björn Stenberg | 34332cf | 2008-11-26 23:21:30 +0000 | [diff] [blame] | 57 | endif |
| 58 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 59 | all: $(DEPFILE) build |
| 60 | |
Andrew Mahone | 668a769 | 2009-07-13 00:40:35 +0000 | [diff] [blame] | 61 | # Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC & |
| 62 | # ASMDEFS_SRC but they also define special dependencies and compile rules |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 63 | include $(TOOLSDIR)/tools.make |
Björn Stenberg | ffaf246 | 2009-09-01 14:53:37 +0000 | [diff] [blame] | 64 | |
| 65 | ifeq (,$(findstring checkwps,$(APPSDIR))) |
Yoshihisa Uchida | ec39c05 | 2010-02-25 12:28:30 +0000 | [diff] [blame] | 66 | ifeq (,$(findstring database,$(APPSDIR))) |
Rafaël Carré | a2029a7 | 2010-07-25 15:22:47 +0000 | [diff] [blame] | 67 | include $(FIRMDIR)/firmware.make |
Björn Stenberg | ccaec76 | 2010-06-17 11:10:00 +0000 | [diff] [blame] | 68 | include $(ROOTDIR)/lib/skin_parser/skin_parser.make |
Yoshihisa Uchida | ec39c05 | 2010-02-25 12:28:30 +0000 | [diff] [blame] | 69 | include $(ROOTDIR)/apps/bitmaps/bitmaps.make |
| 70 | endif |
Björn Stenberg | ffaf246 | 2009-09-01 14:53:37 +0000 | [diff] [blame] | 71 | endif |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 72 | |
Thomas Martitz | 46454ac | 2010-08-24 12:38:42 +0000 | [diff] [blame] | 73 | #included before codecs.make and plugins.make so they see $(LIBSETJMP) |
| 74 | ifndef APP_TYPE |
| 75 | include $(ROOTDIR)/lib/libsetjmp/libsetjmp.make |
| 76 | endif |
| 77 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 78 | ifneq (,$(findstring bootloader,$(APPSDIR))) |
| 79 | include $(APPSDIR)/bootloader.make |
| 80 | else ifneq (,$(findstring bootbox,$(APPSDIR))) |
Björn Stenberg | d834a0c | 2008-11-20 16:17:22 +0000 | [diff] [blame] | 81 | BOOTBOXLDOPTS = -Wl,--gc-sections |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 82 | include $(APPSDIR)/bootbox.make |
Maurus Cuelenaere | 8bff564 | 2009-08-21 20:28:26 +0000 | [diff] [blame] | 83 | else ifneq (,$(findstring checkwps,$(APPSDIR))) |
| 84 | include $(APPSDIR)/checkwps.make |
Jonathan Gordon | 2d31d77 | 2010-07-29 12:37:48 +0000 | [diff] [blame] | 85 | include $(ROOTDIR)/lib/skin_parser/skin_parser.make |
Frank Gevaerts | 6e11572 | 2009-10-07 16:54:15 +0000 | [diff] [blame] | 86 | else ifneq (,$(findstring database,$(APPSDIR))) |
| 87 | include $(APPSDIR)/database.make |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 88 | else |
| 89 | include $(APPSDIR)/apps.make |
| 90 | include $(APPSDIR)/lang/lang.make |
| 91 | |
| 92 | ifdef SOFTWARECODECS |
| 93 | include $(APPSDIR)/codecs/codecs.make |
| 94 | endif |
| 95 | |
| 96 | ifdef ENABLEDPLUGINS |
| 97 | include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make |
| 98 | include $(APPSDIR)/plugins/plugins.make |
| 99 | endif |
| 100 | |
Thomas Martitz | f8381d9 | 2010-09-02 00:24:40 +0000 | [diff] [blame] | 101 | ifneq (,$(findstring sdl,$(APP_TYPE))) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 102 | include $(ROOTDIR)/uisimulator/uisimulator.make |
| 103 | endif |
Thomas Martitz | f8381d9 | 2010-09-02 00:24:40 +0000 | [diff] [blame] | 104 | |
Thomas Martitz | 249bba0 | 2011-12-24 11:56:46 +0000 | [diff] [blame] | 105 | ifneq (,$(findstring ypr0,$(APP_TYPE))) |
| 106 | include $(ROOTDIR)/firmware/target/hosted/ypr0/ypr0.make |
| 107 | endif |
| 108 | |
Thomas Martitz | f8381d9 | 2010-09-02 00:24:40 +0000 | [diff] [blame] | 109 | ifneq (,$(findstring android, $(APP_TYPE))) |
| 110 | include $(ROOTDIR)/android/android.make |
| 111 | endif |
Thomas Jarosch | 986a92f | 2011-06-09 20:58:03 +0000 | [diff] [blame] | 112 | |
| 113 | ifneq (,$(findstring pandora, $(MODELNAME))) |
| 114 | include $(ROOTDIR)/packaging/pandora/pandora.make |
| 115 | endif |
| 116 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 117 | endif # bootloader |
| 118 | |
| 119 | OBJ := $(SRC:.c=.o) |
| 120 | OBJ := $(OBJ:.S=.o) |
| 121 | OBJ += $(BMP:.bmp=.o) |
Jonas Häggqvist | a2008f9 | 2009-04-11 23:20:09 +0000 | [diff] [blame] | 122 | OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(OBJ)) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 123 | |
Björn Stenberg | 8a7c4af | 2008-11-21 13:21:25 +0000 | [diff] [blame] | 124 | build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO) |
| 125 | |
| 126 | $(RBINFO): $(BUILDDIR)/$(BINARY) |
| 127 | $(SILENT)echo Creating $(@F) |
| 128 | $(SILENT)$(TOOLSDIR)/mkinfo.pl $@ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 129 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 130 | $(DEPFILE) dep: |
| 131 | $(call PRINTS,Generating dependencies) |
Rafaël Carré | 27c509f | 2010-08-21 18:07:12 +0000 | [diff] [blame] | 132 | $(call mkdepfile,$(DEPFILE)_,$(SRC)) |
| 133 | $(call mkdepfile,$(DEPFILE)_,$(OTHER_SRC:%.lua=)) |
| 134 | $(call mkdepfile,$(DEPFILE)_,$(ASMDEFS_SRC)) |
| 135 | $(call bmpdepfile,$(DEPFILE)_,$(BMP) $(PBMP)) |
Maurus Cuelenaere | e8da447 | 2009-02-04 20:59:27 +0000 | [diff] [blame] | 136 | @mv $(DEPFILE)_ $(DEPFILE) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 137 | |
Thomas Martitz | 64f4b87 | 2009-04-03 13:44:47 +0000 | [diff] [blame] | 138 | bin: $(DEPFILE) $(TOOLS) $(BUILDDIR)/$(BINARY) $(RBINFO) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 139 | rocks: $(DEPFILE) $(TOOLS) $(ROCKS) |
| 140 | codecs: $(DEPFILE) $(TOOLS) $(CODECS) |
Maurus Cuelenaere | cf31386 | 2009-03-11 16:13:46 +0000 | [diff] [blame] | 141 | tools: $(TOOLS) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 142 | |
| 143 | -include $(DEPFILE) |
| 144 | |
| 145 | veryclean: clean |
| 146 | $(SILENT)rm -rf $(TOOLS) |
| 147 | |
Thomas Martitz | a994401 | 2010-09-12 16:35:02 +0000 | [diff] [blame] | 148 | clean:: |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 149 | $(SILENT)echo Cleaning build directory |
Björn Stenberg | 046776c | 2008-11-22 23:34:24 +0000 | [diff] [blame] | 150 | $(SILENT)rm -rf rockbox.zip rockbox.7z rockbox.tar rockbox.tar.gz \ |
Rafaël Carré | 1da9b71 | 2010-06-19 06:11:22 +0000 | [diff] [blame] | 151 | rockbox.tar.bz2 TAGS apps firmware tools comsim sim lang lib \ |
Björn Stenberg | 046776c | 2008-11-22 23:34:24 +0000 | [diff] [blame] | 152 | manual *.pdf *.a credits.raw rockbox.ipod bitmaps \ |
| 153 | pluginbitmaps UI256.bmp rockbox-full.zip html txt \ |
| 154 | rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids \ |
Tom Ross | 4fb5864 | 2009-03-02 06:13:18 +0000 | [diff] [blame] | 155 | *.wav *.mp3 *.voice $(CLEANOBJS) \ |
Björn Stenberg | 046776c | 2008-11-22 23:34:24 +0000 | [diff] [blame] | 156 | $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin \ |
Jens Arnold | 89b4157 | 2008-11-28 22:22:47 +0000 | [diff] [blame] | 157 | make.dep rombox.elf rombox.map rombox.bin rombox.ucl romstart.txt \ |
Maurus Cuelenaere | 0b92c0f | 2011-03-11 15:45:49 +0000 | [diff] [blame] | 158 | $(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \ |
Dominik Riebeling | fc68a0d | 2011-05-29 18:44:42 +0000 | [diff] [blame] | 159 | rockbox.apk |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 160 | |
| 161 | #### linking the binaries: #### |
| 162 | |
| 163 | .SECONDEXPANSION: |
| 164 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 165 | ifeq (,$(findstring bootloader,$(APPSDIR))) |
| 166 | # not bootloader |
| 167 | |
Björn Stenberg | 6b96270 | 2008-11-21 15:27:16 +0000 | [diff] [blame] | 168 | OBJ += $(LANG_O) |
| 169 | |
Thomas Martitz | 57613ea | 2010-07-10 13:49:49 +0000 | [diff] [blame] | 170 | ifndef APP_TYPE |
Björn Stenberg | 6b96270 | 2008-11-21 15:27:16 +0000 | [diff] [blame] | 171 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 172 | ## target build |
Rafaël Carré | a9e2a71 | 2010-01-24 15:32:23 +0000 | [diff] [blame] | 173 | CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 174 | RAMLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/app.lds |
| 175 | LINKRAM := $(BUILDDIR)/ram.link |
| 176 | ROMLDS := $(FIRMDIR)/rom.lds |
| 177 | LINKROM := $(BUILDDIR)/rom.link |
| 178 | |
Björn Stenberg | 6640978 | 2008-11-21 15:07:15 +0000 | [diff] [blame] | 179 | |
Rafaël Carré | a9e2a71 | 2010-01-24 15:32:23 +0000 | [diff] [blame] | 180 | $(LINKRAM): $(RAMLDS) $(CONFIGFILE) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 181 | $(call PRINTS,PP $(@F)) |
| 182 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) |
| 183 | |
| 184 | $(LINKROM): $(ROMLDS) |
| 185 | $(call PRINTS,PP $(@F)) |
| 186 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) |
| 187 | |
Björn Stenberg | ccaec76 | 2010-06-17 11:10:00 +0000 | [diff] [blame] | 188 | $(BUILDDIR)/rockbox.elf : $$(OBJ) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(LINKRAM) |
Björn Stenberg | a3864b0 | 2008-11-20 15:04:30 +0000 | [diff] [blame] | 189 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ |
| 190 | -L$(BUILDDIR)/firmware -lfirmware \ |
Björn Stenberg | 936e673 | 2010-06-24 11:47:37 +0000 | [diff] [blame] | 191 | -L$(BUILDDIR)/lib -lskin_parser \ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 192 | -L$(BUILDDIR)/apps/codecs $(VOICESPEEXLIB:lib%.a=-l%) \ |
Frank Gevaerts | b8286d4 | 2010-07-03 20:58:22 +0000 | [diff] [blame] | 193 | -lgcc $(BOOTBOXLDOPTS) $(GLOBAL_LDOPTS) \ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 194 | -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map |
| 195 | |
Björn Stenberg | ccaec76 | 2010-06-17 11:10:00 +0000 | [diff] [blame] | 196 | $(BUILDDIR)/rombox.elf : $$(OBJ) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(SKINLIB) $$(LINKROM) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 197 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ |
Frank Gevaerts | b8286d4 | 2010-07-03 20:58:22 +0000 | [diff] [blame] | 198 | $(VOICESPEEXLIB) $(FIRMLIB) -lgcc $(GLOBAL_LDOPTS) \ |
Jonathan Gordon | 2d31d77 | 2010-07-29 12:37:48 +0000 | [diff] [blame] | 199 | -L$(BUILDDIR)/lib -lskin_parser \ |
| 200 | -L$(BUILDDIR)/firmware -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rombox.map |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 201 | |
| 202 | $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf |
| 203 | $(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@ |
| 204 | |
| 205 | $(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf |
| 206 | $(call PRINTS,OC $(@F))$(OC) -O binary $< $@ |
| 207 | |
| 208 | # |
| 209 | # If there's a flashfile defined for this target (rockbox.ucl for Archos |
| 210 | # models) Then check if the mkfirmware script fails, as then it is (likely) |
| 211 | # because the image is too big and we need to create a compressed image |
| 212 | # instead. |
| 213 | # |
| 214 | $(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE) |
| 215 | $(call PRINTS,SCRAMBLE $(notdir $@))($(MKFIRMWARE) $< $@; \ |
| 216 | stat=$$?; \ |
| 217 | if test -n "$(FLASHFILE)"; then \ |
| 218 | if test "$$stat" -ne 0; then \ |
| 219 | echo "Image too big, making a compressed version!"; \ |
| 220 | $(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \ |
| 221 | $(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \ |
| 222 | fi \ |
| 223 | fi ) |
| 224 | |
| 225 | # archos |
| 226 | $(BUILDDIR)/rockbox.ucl: $(BUILDDIR)/rockbox.bin |
Daniel Stenberg | 2e6d604 | 2009-02-23 08:45:16 +0000 | [diff] [blame] | 227 | $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 228 | |
| 229 | MAXINFILE = $(BUILDDIR)/temp.txt |
| 230 | MAXOUTFILE = $(BUILDDIR)/romstart.txt |
| 231 | |
| 232 | $(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE) |
| 233 | $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --none $< $@ >/dev/null; \ |
| 234 | perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \ |
| 235 | if test $$? -ne 0; then \ |
| 236 | echo "removing UCL file again, making it a fake one"; \ |
| 237 | echo "fake" > $@; \ |
| 238 | fi |
| 239 | |
| 240 | $(MAXOUTFILE): |
| 241 | $(call PRINTS,Creating $(@F)) |
Rafaël Carré | 27c509f | 2010-08-21 18:07:12 +0000 | [diff] [blame] | 242 | $(SILENT)echo '#include "config.h"' > $(MAXINFILE) |
| 243 | $(SILENT)echo "ROM_START" >> $(MAXINFILE) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 244 | $(call preprocess2file,$(MAXINFILE),$(MAXOUTFILE)) |
| 245 | $(SILENT)rm $(MAXINFILE) |
| 246 | |
| 247 | # iriver |
| 248 | $(BUILDDIR)/rombox.iriver: $(BUILDDIR)/rombox.bin |
| 249 | $(call PRINTS,Build ROM file)$(MKFIRMWARE) $< $@ |
| 250 | |
Thomas Martitz | 57613ea | 2010-07-10 13:49:49 +0000 | [diff] [blame] | 251 | endif # !APP_TYPE |
Björn Stenberg | 6b96270 | 2008-11-21 15:27:16 +0000 | [diff] [blame] | 252 | endif # !bootloader |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 253 | |
| 254 | |
| 255 | voicetools: |
| 256 | $(SILENT)$(MAKE) -C $(TOOLSDIR) CC=$(HOSTCC) AR=$(HOSTAR) rbspeexenc voicefont wavtrim |
| 257 | |
| 258 | tags: |
| 259 | $(SILENT)rm -f TAGS |
| 260 | $(SILENT)etags -o $(BUILDDIR)/TAGS $(filter-out %.o,$(SRC) $(OTHER_SRC)) |
| 261 | |
| 262 | fontzip: |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 263 | $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 1 -o rockbox-fonts.zip $(TARGET) $(BINARY) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 264 | |
Björn Stenberg | c3cf8bc | 2011-06-06 22:00:44 +0000 | [diff] [blame] | 265 | zip: $(BUILDDIR)/rockbox.zip |
| 266 | |
Björn Stenberg | 35cd408 | 2011-06-22 14:14:49 +0000 | [diff] [blame] | 267 | ifdef NODEPS |
| 268 | $(BUILDDIR)/rockbox.zip: |
| 269 | else |
Björn Stenberg | c3cf8bc | 2011-06-06 22:00:44 +0000 | [diff] [blame] | 270 | $(BUILDDIR)/rockbox.zip: build |
Björn Stenberg | 35cd408 | 2011-06-22 14:14:49 +0000 | [diff] [blame] | 271 | endif |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 272 | $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(TARGET) $(BINARY) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 273 | |
| 274 | mapzip: |
| 275 | $(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip |
| 276 | |
Alex Parker | 745406a | 2011-02-20 19:56:53 +0000 | [diff] [blame] | 277 | elfzip: |
| 278 | $(SILENT)find . -name "*.elf" | xargs zip rockbox-elfs.zip |
| 279 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 280 | fullzip: |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 281 | $(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 Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 282 | |
| 283 | 7zip: |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 284 | $(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 Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 285 | |
| 286 | tar: |
| 287 | $(SILENT)rm -f rockbox.tar |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 288 | $(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 Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 289 | |
| 290 | bzip2: tar |
| 291 | $(SILENT)bzip2 -f9 rockbox.tar |
| 292 | |
| 293 | gzip: tar |
| 294 | $(SILENT)gzip -f9 rockbox.tar |
| 295 | |
| 296 | manual manual-pdf: |
| 297 | $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-pdf |
| 298 | manual-html: |
| 299 | $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-html |
| 300 | manual-zhtml: manual-zip |
| 301 | manual-txt: |
| 302 | $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt |
| 303 | manual-ztxt: |
| 304 | $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt-zip |
| 305 | manual-zip: |
| 306 | $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-zip |
| 307 | |
| 308 | ifdef TTS_ENGINE |
| 309 | |
Frank Gevaerts | 94aa0d7 | 2010-06-30 16:29:55 +0000 | [diff] [blame] | 310 | voice: voicetools $(BUILDDIR)/apps/features |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 311 | $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \ |
| 312 | 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 \ |
| 313 | |
| 314 | endif |
| 315 | |
Antoine Cellerier | a448d8b | 2011-01-24 17:06:04 +0000 | [diff] [blame] | 316 | ifeq (,$(findstring android, $(APP_TYPE))) |
Rafaël Carré | 89eb19d | 2010-06-19 08:46:18 +0000 | [diff] [blame] | 317 | bininstall: $(BUILDDIR)/$(BINARY) |
Thomas Martitz | 9c0b247 | 2010-08-01 16:15:27 +0000 | [diff] [blame] | 318 | @echo "Installing your rockbox binary in your '$(RBPREFIX)' dir" |
| 319 | $(SILENT)cp $(BINARY) "$(RBPREFIX)/.rockbox/" |
Rafaël Carré | 53367ba | 2010-06-19 08:43:53 +0000 | [diff] [blame] | 320 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 321 | install: |
Michael Chicoine | c6bcd91 | 2010-08-08 00:03:08 +0000 | [diff] [blame] | 322 | @echo "Installing your build in your '$(RBPREFIX)' dir" |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 323 | $(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 Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 324 | |
| 325 | fullinstall: |
Michael Chicoine | c6bcd91 | 2010-08-08 00:03:08 +0000 | [diff] [blame] | 326 | @echo "Installing a full setup in your '$(RBPREFIX)' dir" |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 327 | $(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 Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 328 | |
Michael Stummvoll | 1f06ca4 | 2010-12-28 10:30:46 +0000 | [diff] [blame] | 329 | symlinkinstall: |
| 330 | @echo "Installing a full setup with links in your '$(RBPREFIX)' dir" |
Dave Chapman | 376c9f3 | 2011-02-27 11:37:39 +0000 | [diff] [blame] | 331 | $(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 Cellerier | a448d8b | 2011-01-24 17:06:04 +0000 | [diff] [blame] | 332 | endif |
Michael Stummvoll | 1f06ca4 | 2010-12-28 10:30:46 +0000 | [diff] [blame] | 333 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 334 | help: |
| 335 | @echo "A few helpful make targets" |
| 336 | @echo "" |
Michael Stummvoll | 1f06ca4 | 2010-12-28 10:30:46 +0000 | [diff] [blame] | 337 | @echo "all - builds a full Rockbox (default), including tools" |
| 338 | @echo "bin - builds only the Rockbox.<target name> file" |
| 339 | @echo "rocks - builds only plugins" |
| 340 | @echo "codecs - builds only codecs" |
| 341 | @echo "dep - regenerates make dependency database" |
| 342 | @echo "clean - cleans a build directory (not tools)" |
| 343 | @echo "veryclean - cleans the build and tools directories" |
| 344 | @echo "manual - builds a manual (pdf)" |
| 345 | @echo "manual-html - HTML manual" |
| 346 | @echo "manual-zip - HTML manual (zipped)" |
| 347 | @echo "manual-txt - txt manual" |
| 348 | @echo "fullzip - creates a rockbox.zip of your build with fonts" |
| 349 | @echo "zip - creates a rockbox.zip of your build (no fonts)" |
| 350 | @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)" |
| 351 | @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)" |
| 352 | @echo "7zip - creates a rockbox.7z of your build (no fonts)" |
| 353 | @echo "fontzip - creates rockbox-fonts.zip" |
| 354 | @echo "mapzip - creates rockbox-maps.zip with all .map files" |
Alex Parker | d0a0d02 | 2011-02-26 20:50:12 +0000 | [diff] [blame] | 355 | @echo "elfzip - creates rockbox-elfs.zip with all .elf files" |
Thomas Jarosch | 986a92f | 2011-06-09 20:58:03 +0000 | [diff] [blame] | 356 | @echo "pnd - creates rockbox.pnd archive (Pandora builds only)" |
Michael Stummvoll | 1f06ca4 | 2010-12-28 10:30:46 +0000 | [diff] [blame] | 357 | @echo "tools - builds the tools only" |
| 358 | @echo "voice - creates the voice clips (voice builds only)" |
| 359 | @echo "voicetools - builds the voice tools only" |
| 360 | @echo "install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))" |
| 361 | @echo "fullinstall - installs your build (like install, but with fonts)" |
| 362 | @echo "symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)" |
| 363 | @echo "reconf - rerun configure with the same selection" |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 364 | |
| 365 | ### general compile rules: |
| 366 | |
| 367 | # when source and object are in different locations (normal): |
| 368 | $(BUILDDIR)/%.o: $(ROOTDIR)/%.c |
| 369 | $(SILENT)mkdir -p $(dir $@) |
| 370 | $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@ |
| 371 | |
| 372 | $(BUILDDIR)/%.o: $(ROOTDIR)/%.S |
| 373 | $(SILENT)mkdir -p $(dir $@) |
Thomas Martitz | 0bf1bd1 | 2010-12-27 17:27:59 +0000 | [diff] [blame] | 374 | $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) $(ASMFLAGS) -c $< -o $@ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 375 | |
Andrew Mahone | 668a769 | 2009-07-13 00:40:35 +0000 | [diff] [blame] | 376 | # generated definitions for use in .S files |
| 377 | $(BUILDDIR)/%_asmdefs.h: $(ROOTDIR)/%_asmdefs.c |
| 378 | $(call PRINTS,ASMDEFS $(@F)) |
| 379 | $(SILENT)mkdir -p $(dir $@) |
| 380 | $(call asmdefs2file,$<,$@) |
| 381 | |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 382 | # when source and object are both in BUILDDIR (generated code): |
| 383 | %.o: %.c |
| 384 | $(SILENT)mkdir -p $(dir $@) |
| 385 | $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@ |
| 386 | |
| 387 | %.o: %.S |
| 388 | $(SILENT)mkdir -p $(dir $@) |
Thomas Martitz | 0bf1bd1 | 2010-12-27 17:27:59 +0000 | [diff] [blame] | 389 | $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) $(ASMFLAGS) -c $< -o $@ |
Daniel Stenberg | 4ef890e | 2009-01-09 23:15:27 +0000 | [diff] [blame] | 390 | |
Björn Stenberg | fc53725 | 2009-01-10 22:23:27 +0000 | [diff] [blame] | 391 | Makefile: $(TOOLSDIR)/configure |
Antoine Cellerier | ef0c9da | 2009-08-02 09:45:51 +0000 | [diff] [blame] | 392 | ifneq (reconf,$(MAKECMDGOALS)) |
Björn Stenberg | 6d871d5 | 2009-01-10 22:36:41 +0000 | [diff] [blame] | 393 | $(SILENT)echo "*** tools/configure is newer than Makefile. You should run 'make reconf'." |
Antoine Cellerier | ef0c9da | 2009-08-02 09:45:51 +0000 | [diff] [blame] | 394 | endif |
Björn Stenberg | 6d871d5 | 2009-01-10 22:36:41 +0000 | [diff] [blame] | 395 | |
| 396 | reconf: |
Thomas Martitz | 9c0b247 | 2010-08-01 16:15:27 +0000 | [diff] [blame] | 397 | $(SILENT$)$(TOOLSDIR)/configure $(CONFIGURE_OPTIONS) |