2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
= -I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export -I.
-I
$(BUILDDIR
) \
13 DEPFILE
= $(OBJDIR
)/dep-apps
14 LDS
:= $(FIRMDIR
)/app.lds
15 ROMLDS
:= $(FIRMDIR
)/rom.lds
25 # This sets up 'SRC' based on the files mentioned in SOURCES
26 include $(TOOLSDIR
)/makesrc.inc
32 INCLUDES
+= -I
$(APPEXTRA
)
35 CFLAGS
= $(GCCOPTS
) $(INCLUDES
) $(TARGET
) $(DEFINES
) \
36 -DAPPSVERSION
=\"$(VERSION
)\" $(EXTRA_DEFINES
) -DMEM
=${MEMORYSIZE}
38 OBJS
:= $(OBJDIR
)/lang.o
$(SRC
:%.c
=$(OBJDIR
)/%.o
)
40 LINKFILE
= $(OBJDIR
)/linkage.lds
41 LINKROM
= $(OBJDIR
)/linkrom.lds
42 MAXINFILE
= $(OBJDIR
)/romstart.temp
43 MAXOUTFILE
= $(OBJDIR
)/romstart
45 LIBROCKBOX
= $(BUILDDIR
)/librockbox.a
49 COMMONLIB
= $(BUILDDIR
)/comsim
/libcomsim.a
51 all: $(COMMONLIB
) $(BUILDDIR
)/$(BINARY
) $(CODECS
) $(ROCKS
)
55 @
$(MAKE
) -C
$(ROOTDIR
)/uisimulator
/common
57 # regular target build
58 all: $(BUILDDIR
)/$(BINARY
) $(FLASHFILE
) $(CODECS
) $(ROCKS
) $(ARCHOSROM
)
64 @
$(MAKE
) -C codecs OBJDIR
=$(OBJDIR
)/codecs
67 @
$(MAKE
) -C plugins
/lib OBJDIR
=$(OBJDIR
)/plugins
/lib
68 @
$(MAKE
) -C plugins OBJDIR
=$(OBJDIR
)/plugins
71 @echo
"Build LDS file"
72 @cat
$< |
$(CC
) -DLOADADDRESS
=$(LOADADDRESS
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
75 @echo
"Build LDS file for Rombox"
76 @cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
79 @echo
'#include "config.h"' > $(MAXINFILE
)
80 @echo
"ROM_START" >> $(MAXINFILE
)
81 @cat
$(MAXINFILE
) |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - > $(MAXOUTFILE
)
84 $(OBJDIR
)/rombox.elf
: $(OBJS
) $(LINKROM
) $(DEPFILE
) $(LIBROCKBOX
)
86 @
$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
) -lrockbox
-lgcc
-L
$(BUILDDIR
)/firmware
-T
$(LINKROM
) -Wl
,-Map
,$(OBJDIR
)/rombox.map
90 $(OBJDIR
)/rockbox.elf
: $(OBJS
) $(LINKFILE
) $(DEPFILE
) $(LIBROCKBOX
)
91 @echo
"LD rockbox.elf"
92 @
$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
)/firmware
-L
$(BUILDDIR
) -lrockbox
-lgcc
-T
$(LINKFILE
) -Wl
,-Map
,$(OBJDIR
)/rockbox.map
94 $(OBJDIR
)/rockbox.bin
: $(OBJDIR
)/rockbox.elf
95 @echo
"OBJCOPY "`basename $@`
96 @
$(OC
) -O binary
$< $@
98 $(OBJDIR
)/rombox.bin
: $(OBJDIR
)/rombox.elf
99 @echo
"OBJCOPY "`basename $@`
100 @
$(OC
) -O binary
$< $@
102 $(OBJDIR
)/rockbox.asm
: $(OBJDIR
)/rockbox.bin
103 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
105 $(BUILDDIR
)/$(BINARY
) : $(OBJDIR
)/rockbox.bin
106 @echo
"Build firmware file"
110 # this is a simulator build
112 ifeq ($(SIMVER
), win32
)
113 # OK, this is ugly but we need it on the link line to make it do right
114 EXTRAOBJ
= $(BUILDDIR
)/sim
/uisw32-res.o
118 $(BUILDDIR
)/$(BINARY
) : $(OBJS
) $(DEPFILE
) $(BUILDDIR
)/libsim.a \
119 $(BUILDDIR
)/libcomsim.a
121 @
$(CC
) $(GCCOPTS
) -o
$@
$(OBJS
) -L
$(BUILDDIR
) -lrockbox
-lsim
-lcomsim
$(LDOPTS
) $(EXTRAOBJ
) -Wl
,-Map
,$(OBJDIR
)/rockbox.map
123 $(BUILDDIR
)/libsim.a
:
124 @
$(MAKE
) -C
$(SIMDIR
) OBJDIR
=$(BUILDDIR
)/sim
126 $(BUILDDIR
)/libcomsim.a
:
127 @
$(MAKE
) -C
$(ROOTDIR
)/uisimulator
/common OBJDIR
=$(BUILDDIR
)/comsim
130 $(BUILDDIR
)/rockbox.ucl
: $(OBJDIR
)/rockbox.bin
131 @a
=`uclpack -h 2>/dev/null`; \
132 if
test -n
"$$a"; then \
133 echo
"UCLPACK rockbox" ; \
134 uclpack
--best
--2e
$< $@
>/dev
/null
2>&1; \
136 echo
"no uclpack command found, makes a fake rockbox.ucl"; \
140 $(BUILDDIR
)/rombox.ucl
: $(OBJDIR
)/rombox.bin
$(MAXOUTFILE
)
141 @a
=`uclpack -h 2>/dev/null`; \
142 if
test -n
"$$a"; then \
143 echo
"UCLPACK rombox" ; \
144 uclpack
--none
$< $@
>/dev
/null
2>&1; \
145 if
test -s
$@
; then \
146 perl
$(TOOLSDIR
)/romsizetest.pl
`cat $(MAXOUTFILE)` $<; \
147 if
test $$?
-ne
0; then \
148 echo
"removing UCL file again, making it a fake one"; \
152 echo
"Your uclpack seems to not support --none, making a fake ucl"; \
156 echo
"no uclpack command found, makes a fake rombox.ucl"; \
160 $(OBJDIR
)/credits.raw
: $(DOCSDIR
)/CREDITS
161 @echo
"create credits.raw"
162 @perl credits.pl
< $< > $@
164 $(OBJDIR
)/credits.o
: credits.c credits.h
$(OBJDIR
)/credits.raw
165 @mkdir
-p
`dirname $@`
167 @
$(CC
) $(CFLAGS
) -c
$< -o
$@
169 include $(TOOLSDIR
)/make.inc
171 $(OBJDIR
)/build.lang
: lang
/$(LANGUAGE
).lang
$(TOOLSDIR
)/uplang
173 @mkdir
-p
`dirname $@`
174 @perl
$(TOOLSDIR
)/uplang lang
/english.lang
$< > $@
176 $(OBJDIR
)/lang.o
: $(OBJDIR
)/build.lang
$(TOOLSDIR
)/genlang
178 @mkdir
-p
`dirname $@`
179 @perl
-s
$(TOOLSDIR
)/genlang
-p
=$(BUILDDIR
)/lang
$<
181 @
$(CC
) $(CFLAGS
) -c
$(BUILDDIR
)/lang.c
-o
$@
184 @echo
"cleaning apps"
185 @
-rm -f
$(OBJS
) $(BUILDDIR
)/$(BINARY
) $(OBJDIR
)/rockbox.asm \
186 $(OBJDIR
)/rockbox.bin
$(OBJDIR
)/rockbox.elf
$(OBJDIR
)/*.map \
187 $(OBJDIR
)/lang.o
$(OBJDIR
)/build.lang
$(BUILDDIR
)/lang.
[ch
] \
188 $(OBJDIR
)/credits.raw
$(LINKFILE
) $(BUILDDIR
)/rockbox.ucl
$(LINKROM
) \
189 $(BUILDDIR
)/rombox.ucl
$(OBJDIR
)/rombox.bin
$(OBJDIR
)/rombox.elf \
190 $(MAXOUTFILE
) $(DEPFILE
)
191 @
$(MAKE
) -C plugins
clean OBJDIR
=$(OBJDIR
)/plugins
192 @
$(MAKE
) -C codecs
clean OBJDIR
=$(OBJDIR
)/codecs
193 @
rm -rf
$(OBJDIR
)/recorder
$(OBJDIR
)/player
195 @
$(MAKE
) -C
$(SIMDIR
) clean