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-bootloader
14 LDS
:= $(FIRMDIR
)/boot.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
)))
30 VERSION
=$(shell date
+%y
%m
%d-
%H
%M
)
33 CFLAGS
= $(GCCOPTS
) $(INCLUDES
) $(TARGET
) $(DEFINES
) \
34 -DAPPSVERSION
=\"$(VERSION
)\" $(EXTRA_DEFINES
) -DMEM
=${MEMORYSIZE}
36 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
38 LINKFILE
= $(OBJDIR
)/linkage.lds
39 MAXINFILE
= $(OBJDIR
)/romstart.temp
40 MAXOUTFILE
= $(OBJDIR
)/romstart
42 LIBROCKBOX
= $(BUILDDIR
)/librockbox.a
45 all: $(OBJDIR
)/bootloader.elf
47 all: $(BUILDDIR
)/$(BINARY
) $(FLASHFILE
)
53 $(call PRINTS
,Build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
56 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
57 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
58 $(SILENT
)cat
$(MAXINFILE
) |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - > $(MAXOUTFILE
)
59 $(SILENT
)rm $(MAXINFILE
)
61 $(OBJDIR
)/bootloader.elf
: $(OBJS
) $(LINKFILE
) $(DEPFILE
) $(LIBROCKBOX
)
62 $(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
)/bootloader.map
64 $(OBJDIR
)/bootloader.bin
: $(OBJDIR
)/bootloader.elf
65 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
67 $(OBJDIR
)/bootloader.asm
: $(OBJDIR
)/bootloader.bin
68 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
70 $(BUILDDIR
)/$(BINARY
) : $(OBJDIR
)/bootloader.bin
71 $(call PRINTS
,Build bootloader file
)$(MKFIRMWARE
) $< $@
73 include $(TOOLSDIR
)/make.inc
76 $(call PRINTS
,cleaning bootloader
)-rm -f
$(OBJS
) $(BUILDDIR
)/$(BINARY
) $(OBJDIR
)/bootloader.asm \
77 $(OBJDIR
)/bootloader.bin
$(OBJDIR
)/bootloader.elf
$(OBJDIR
)/*.map \
78 $(LINKFILE
) $(MAXOUTFILE
) $(DEPFILE
)