2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
= $(TARGET_INC
) -I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export -I.
-I
$(BUILDDIR
) \
11 -I
$(BUILDDIR
)/bitmaps
-I
$(OBJDIR
)
13 DEPFILE
= $(OBJDIR
)/dep-apps
14 LDS
:= $(FIRMDIR
)/app.lds
15 ROMLDS
:= $(FIRMDIR
)/rom.lds
25 # Set up the bitmap libraries
28 ifneq ($(strip $(BMP2RB_MONO
)),)
29 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsmono.a
30 LINKBITMAPS
+= -lbitmapsmono
32 ifneq ($(strip $(BMP2RB_NATIVE
)),)
33 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsnative.a
34 LINKBITMAPS
+= -lbitmapsnative
36 ifneq ($(strip $(BMP2RB_REMOTEMONO
)),)
37 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsremotemono.a
38 LINKBITMAPS
+= -lbitmapsremotemono
40 ifneq ($(strip $(BMP2RB_REMOTENATIVE
)),)
41 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsremotenative.a
42 LINKBITMAPS
+= -lbitmapsremotenative
45 # This sets up 'SRC' based on the files mentioned in SOURCES
46 include $(TOOLSDIR
)/makesrc.inc
53 DIRS
+= $(subst :, ,$(APPEXTRA
))
54 INCLUDES
+= $(patsubst %,-I
%,$(subst :, ,$(APPEXTRA
)))
57 CFLAGS
= $(INCLUDES
) $(GCCOPTS
) $(TARGET
) $(BUILDDATE
) $(DEFINES
) -DTARGET_ID
=$(TARGET_ID
) \
58 -DAPPSVERSION
=\"$(VERSION
)\" $(EXTRA_DEFINES
) -DMEM
=${MEMORYSIZE} \
59 -DTARGET_NAME
=\"$(ARCHOS
)\"
61 OBJS2
:= $(OBJDIR
)/lang.o
$(patsubst %.c
, $(OBJDIR
)/%.o
, $(SRC
))
62 OBJS
= $(patsubst %.S
, $(OBJDIR
)/%.o
, $(OBJS2
))
64 LINKFILE
= $(OBJDIR
)/linkage.lds
65 LINKROM
= $(OBJDIR
)/linkrom.lds
66 MAXINFILE
= $(OBJDIR
)/romstart.temp
67 MAXOUTFILE
= $(OBJDIR
)/romstart
69 LIBROCKBOX
= $(BUILDDIR
)/librockbox.a
74 all: $(BUILDDIR
)/$(BINARY
) $(CODECS
) $(ROCKS
)
77 # regular target build
80 REALBIN
= $(OBJDIR
)/rockbox.elf
82 # this is not needed to get built when doing debug builds
83 REALBIN
= $(BUILDDIR
)/$(BINARY
)
86 all: $(REALBIN
) $(FLASHFILE
) $(CODECS
) $(ROCKS
) $(ARCHOSROM
)
89 $(DEPFILE
): $(BITMAPLIBS
)
94 $(SILENT
)$(MAKE
) -C codecs
/lib OBJDIR
=$(OBJDIR
)/codecs
/lib
95 $(SILENT
)$(MAKE
) -C codecs OBJDIR
=$(OBJDIR
)/codecs
98 $(call PRINTS
,MAKE in bitmaps
/mono
)$(MAKE
) -C bitmaps
/mono OBJDIR
=$(OBJDIR
)/bitmaps
/mono
101 $(call PRINTS
,MAKE in bitmaps
/native
)$(MAKE
) -C bitmaps
/native OBJDIR
=$(OBJDIR
)/bitmaps
/native
103 build-bitmapsremotemono
:
104 $(call PRINTS
,MAKE in bitmaps
/remote_mono
)$(MAKE
) -C bitmaps
/remote_mono OBJDIR
=$(OBJDIR
)/bitmaps
/remote_mono
106 build-bitmapsremotenative
:
107 $(call PRINTS
,MAKE in bitmaps
/remote_native
)$(MAKE
) -C bitmaps
/remote_native OBJDIR
=$(OBJDIR
)/bitmaps
/remote_native
109 $(BITMAPLIBS
): $(BUILDDIR
)/lib
%.a
: build-
%
112 $(SILENT
)$(MAKE
) -C plugins
/lib OBJDIR
=$(OBJDIR
)/plugins
/lib
113 $(SILENT
)$(MAKE
) -C plugins OBJDIR
=$(OBJDIR
)/plugins
116 $(call PRINTS
,Build
$(@F
))cat
$< |
$(CC
) -DLOADADDRESS
=$(LOADADDRESS
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
118 $(LINKROM
): $(ROMLDS
)
119 $(call PRINTS
,Build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
122 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
123 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
124 $(SILENT
)cat
$(MAXINFILE
) |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - > $(MAXOUTFILE
)
125 $(SILENT
)rm $(MAXINFILE
)
127 $(OBJDIR
)/rombox.elf
: $(OBJS
) $(LINKROM
) $(DEPFILE
) $(LIBROCKBOX
) $(BITMAPLIBS
)
128 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
) -lrockbox
-lgcc
$(LINKBITMAPS
) -L
$(BUILDDIR
)/firmware
-T
$(LINKROM
) -Wl
,-Map
,$(OBJDIR
)/rombox.map
132 $(OBJDIR
)/rockbox.elf
: $(OBJS
) $(LINKFILE
) $(DEPFILE
) $(LIBROCKBOX
) $(BITMAPLIBS
)
133 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
)/firmware
-L
$(BUILDDIR
) -lrockbox
$(LINKBITMAPS
) -lgcc
-T
$(LINKFILE
) -Wl
,-Map
,$(OBJDIR
)/rockbox.map
135 $(OBJDIR
)/rockbox.bin
: $(OBJDIR
)/rockbox.elf
136 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
138 $(OBJDIR
)/rombox.bin
: $(OBJDIR
)/rombox.elf
139 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
141 $(OBJDIR
)/rockbox.asm
: $(OBJDIR
)/rockbox.bin
142 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
145 # If there's a flashfile defined for this target (rockbox.ucl for Archos
146 # models) Then check if the mkfirmware script fails, as then it is (likely)
147 # because the image is too big and we need to create a compressed image
150 $(BUILDDIR
)/$(BINARY
) : $(OBJDIR
)/rockbox.bin
$(FLASHFILE
)
151 $(call PRINTS
,Build firmware file
)($(MKFIRMWARE
) $< $@
; \
153 if
test -n
"$(FLASHFILE)"; then \
154 if
test "$$stat" -ne
0; then \
155 echo
"Image too big, making a compressed version!"; \
156 $(MAKE
) -C
$(FIRMDIR
)/decompressor OBJDIR
=$(BUILDDIR
)/firmware
/decompressor
; \
157 $(MKFIRMWARE
) $(BUILDDIR
)/firmware
/decompressor
/compressed.bin
$@
; \
162 # this is a simulator build
164 ifeq ($(SIMVER
), win32
)
165 # OK, this is ugly but we need it on the link line to make it do right
166 EXTRAOBJ
= $(BUILDDIR
)/sim
/uisw32-res.o
170 # OS X's ld does not support -Map
171 ifeq ($(UNAME
), Darwin
)
174 #SIMULATOR_MAP=-Wl,-Map,$(OBJDIR)/rockbox.map
177 $(BUILDDIR
)/$(BINARY
) : $(OBJS
) $(DEPFILE
) $(BUILDDIR
)/libsim.a \
178 $(BUILDDIR
)/libcomsim.a
$(LIBROCKBOX
) $(BITMAPLIBS
)
179 $(call PRINTS
,LD
$(BINARY
))$(CC
) $(GCCOPTS
) -o
$@
$(OBJS
) -L
$(BUILDDIR
) -lrockbox
-lsim
-lcomsim
$(LINKBITMAPS
) $(LDOPTS
) $(EXTRAOBJ
) $(SIMULATOR_MAP
)
182 $(BUILDDIR
)/rockbox.ucl
: $(OBJDIR
)/rockbox.bin
183 $(call PRINTS
,UCLPACK rockbox
)$(TOOLSDIR
)/uclpack
--best
--2e
$< $@
>/dev
/null
2>&1
185 $(BUILDDIR
)/rombox.ucl
: $(OBJDIR
)/rombox.bin
$(MAXOUTFILE
)
186 $(call PRINTS
,UCLPACK rombox
)$(TOOLSDIR
)/uclpack
--none
$< $@
>/dev
/null
2>&1; \
187 perl
$(TOOLSDIR
)/romsizetest.pl
`cat $(MAXOUTFILE)` $<; \
188 if
test $$?
-ne
0; then \
189 echo
"removing UCL file again, making it a fake one"; \
193 $(BUILDDIR
)/rombox.iriver
: $(OBJDIR
)/rombox.bin
194 $(call PRINTS
,Build ROM file
)$(MKFIRMWARE
) $< $@
196 include $(TOOLSDIR
)/make.inc
198 $(OBJDIR
)/lang.o
: lang
/$(LANGUAGE
).lang
200 $(call PRINTS
,GENLANG
)perl
-s
$(TOOLSDIR
)/genlang
-p
=$(BUILDDIR
)/lang
-t
=$(ARCHOS
) $<
201 $(call PRINTS
,CC lang.c
)$(CC
) $(CFLAGS
) -c
$(BUILDDIR
)/lang.c
-o
$@
204 $(call PRINTS
,cleaning apps
)-rm -f
$(OBJS
) $(BUILDDIR
)/$(BINARY
) $(OBJDIR
)/rockbox.asm \
205 $(OBJDIR
)/rockbox.bin
$(OBJDIR
)/rockbox.elf
$(OBJDIR
)/*.map \
206 $(OBJDIR
)/lang.o
$(OBJDIR
)/build.lang
$(BUILDDIR
)/lang.
[ch
] \
207 $(LINKFILE
) $(BUILDDIR
)/rockbox.ucl
$(LINKROM
) \
208 $(BUILDDIR
)/rombox.ucl
$(OBJDIR
)/rombox.bin
$(OBJDIR
)/rombox.elf \
209 $(MAXOUTFILE
) $(DEPFILE
)
210 $(SILENT
)$(MAKE
) -C bitmaps
/mono
clean OBJDIR
=$(OBJDIR
)/bitmaps
/mono
211 $(SILENT
)$(MAKE
) -C bitmaps
/native
clean OBJDIR
=$(OBJDIR
)/bitmaps
/native
212 $(SILENT
)$(MAKE
) -C bitmaps
/remote_mono
clean OBJDIR
=$(OBJDIR
)/bitmaps
/remote_mono
213 $(SILENT
)$(MAKE
) -C bitmaps
/remote_native
clean OBJDIR
=$(OBJDIR
)/bitmaps
/remote_native
214 $(SILENT
)$(MAKE
) -C plugins
clean OBJDIR
=$(OBJDIR
)/plugins
215 $(SILENT
)$(MAKE
) -C codecs
clean OBJDIR
=$(OBJDIR
)/codecs
216 $(SILENT
)rm -rf
$(OBJDIR
)/recorder
$(OBJDIR
)/player
217 $(SILENT
)rm -rf
$(BUILDDIR
)/bitmaps
219 $(SILENT
)$(MAKE
) -C
$(SIMDIR
) clean
222 ifneq ($(MAKECMDGOALS
),clean)