2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
= $(TARGET_INC
) -I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export -I.
-I
$(OBJDIR
) \
13 DEPFILE
= $(OBJDIR
)/dep-bootbox
14 LDS
:= $(FIRMDIR
)/app.lds
21 SRC
:= $(shell cat SOURCES |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
-include "config.h" - )
25 DIRS
+= $(subst :, ,$(APPEXTRA
))
26 INCLUDES
+= $(patsubst %,-I
%,$(subst :, ,$(APPEXTRA
)))
29 CFLAGS
= $(GCCOPTS
) $(INCLUDES
) $(TARGET
) $(DEFINES
) \
30 -DAPPSVERSION
=\"$(VERSION
)\" $(EXTRA_DEFINES
) -DMEM
=${MEMORYSIZE}
32 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
34 LINKFILE
= $(OBJDIR
)/linkage.lds
35 MAXINFILE
= $(OBJDIR
)/romstart.temp
36 MAXOUTFILE
= $(OBJDIR
)/romstart
38 LIBROCKBOX
= $(BUILDDIR
)/librockbox.a
40 all: $(BUILDDIR
)/$(BINARY
) $(FLASHFILE
)
45 $(call PRINTS
,Build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
48 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
49 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
50 $(SILENT
)cat
$(MAXINFILE
) |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - > $(MAXOUTFILE
)
51 $(SILENT
)rm $(MAXINFILE
)
53 $(OBJDIR
)/bootbox.elf
: $(OBJS
) $(LINKFILE
) $(DEPFILE
) $(LIBROCKBOX
)
54 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Wl
,--gc-sections
-Os
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
) -L
$(BUILDDIR
)/firmware
-lrockbox
-lgcc
-T
$(LINKFILE
) -Wl
,-Map
,$(OBJDIR
)/bootbox.map
56 $(OBJDIR
)/bootbox.bin
: $(OBJDIR
)/bootbox.elf
57 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
59 $(OBJDIR
)/bootbox.asm
: $(OBJDIR
)/bootbox.bin
60 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
62 $(BUILDDIR
)/$(BINARY
) : $(OBJDIR
)/bootbox.bin
63 $(call PRINTS
,Build bootbox file
)$(MKFIRMWARE
) $< $@
65 $(FLASHFILE
): $(OBJDIR
)/bootbox.bin
66 $(call PRINTS
,UCLPACK bootbox
)$(TOOLSDIR
)/uclpack
--best
--2e
$< $@
>/dev
/null
2>&1;
68 include $(TOOLSDIR
)/make.inc
71 $(call PRINTS
,cleaning bootbox
)-rm -f
$(OBJS
) $(BUILDDIR
)/$(BINARY
) $(OBJDIR
)/bootbox.asm
$(OBJDIR
)/rockbox.ucl \
72 $(OBJDIR
)/bootbox.bin
$(OBJDIR
)/bootbox.elf
$(OBJDIR
)/*.map \
73 $(LINKFILE
) $(MAXOUTFILE
) $(DEPFILE
) $(FLASHFILE
)