2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
= $(TARGET_INC
) -I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export -I.
-I
$(OBJDIR
) \
11 -I
$(BUILDDIR
) -I
$(BUILDDIR
)/bitmaps
13 DEPFILE
= $(OBJDIR
)/dep-bootloader
14 LDS
:= $(FIRMDIR
)/target
/$(CPU
)/$(MANUFACTURER
)/boot.lds
16 # Set up the bitmap libraries
19 ifneq ($(strip $(BMP2RB_MONO
)),)
20 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsmono.a
21 LINKBITMAPS
+= -lbitmapsmono
23 ifneq ($(strip $(BMP2RB_NATIVE
)),)
24 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsnative.a
25 LINKBITMAPS
+= -lbitmapsnative
27 ifneq ($(strip $(BMP2RB_REMOTEMONO
)),)
28 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsremotemono.a
29 LINKBITMAPS
+= -lbitmapsremotemono
31 ifneq ($(strip $(BMP2RB_REMOTENATIVE
)),)
32 BITMAPLIBS
+= $(BUILDDIR
)/libbitmapsremotenative.a
33 LINKBITMAPS
+= -lbitmapsremotenative
41 SRC
:= $(shell cat SOURCES |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) $(EXTRA_DEFINES
) -E
-P
-include "config.h" - )
45 DIRS
+= $(subst :, ,$(APPEXTRA
))
46 INCLUDES
+= $(patsubst %,-I
%,$(subst :, ,$(APPEXTRA
)))
49 CFLAGS
= $(GCCOPTS
) $(INCLUDES
) $(TARGET
) $(DEFINES
) $(EXTRA_DEFINES
) \
52 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
54 LINKFILE
= $(OBJDIR
)/linkage.lds
55 MAXINFILE
= $(OBJDIR
)/romstart.temp
56 MAXOUTFILE
= $(OBJDIR
)/romstart
58 LIBROCKBOX
= $(BUILDDIR
)/librockbox.a
61 all: $(OBJDIR
)/bootloader.elf
63 all: $(BUILDDIR
)/$(BINARY
) $(FLASHFILE
)
66 $(DEPFILE
): $(BITMAPLIBS
)
71 $(call PRINTS
,Build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(EXTRA_DEFINES
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
74 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
75 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
76 $(SILENT
)cat
$(MAXINFILE
) |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - > $(MAXOUTFILE
)
77 $(SILENT
)rm $(MAXINFILE
)
80 $(call PRINTS
,MAKE in bitmaps
/mono
)$(MAKE
) -C ..
/apps
/bitmaps
/mono OBJDIR
=$(OBJDIR
)/bitmaps
/mono
83 $(call PRINTS
,MAKE in bitmaps
/native
)$(MAKE
) -C ..
/apps
/bitmaps
/native OBJDIR
=$(OBJDIR
)/bitmaps
/native
85 build-bitmapsremotemono
:
86 $(call PRINTS
,MAKE in bitmaps
/remote_mono
)$(MAKE
) -C ..
/apps
/bitmaps
/remote_mono OBJDIR
=$(OBJDIR
)/bitmaps
/remote_mono
88 build-bitmapsremotenative
:
89 $(call PRINTS
,MAKE in bitmaps
/remote_native
)$(MAKE
) -C ..
/apps
/bitmaps
/remote_native OBJDIR
=$(OBJDIR
)/bitmaps
/remote_native
91 $(BITMAPLIBS
): $(BUILDDIR
)/lib
%.a
: build-
%
93 $(OBJDIR
)/bootloader.elf
: $(OBJS
) $(LINKFILE
) $(DEPFILE
) $(LIBROCKBOX
) $(BITMAPLIBS
)
94 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Wl
,--gc-sections
-Os
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
) -L
$(BUILDDIR
)/firmware
-lrockbox
$(LINKBITMAPS
) -lgcc
-T
$(LINKFILE
) -Wl
,-Map
,$(OBJDIR
)/bootloader.map
96 $(OBJDIR
)/bootloader.bin
: $(OBJDIR
)/bootloader.elf
97 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) $(if
$(filter yes
, $(USE_ELF
)), -S
-x
, -O binary
) $< $@
99 $(OBJDIR
)/bootloader.asm
: $(OBJDIR
)/bootloader.bin
100 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
102 $(BUILDDIR
)/$(BINARY
) : $(OBJDIR
)/bootloader.bin
103 $(call PRINTS
,Build bootloader file
)$(MKFIRMWARE
) $< $@
105 include $(TOOLSDIR
)/make.inc
108 $(call PRINTS
,cleaning bootloader
)-rm -f
$(OBJS
) $(BUILDDIR
)/$(BINARY
) $(OBJDIR
)/bootloader.asm \
109 $(OBJDIR
)/bootloader.bin
$(OBJDIR
)/bootloader.elf
$(OBJDIR
)/*.map \
110 $(LINKFILE
) $(MAXOUTFILE
) $(DEPFILE
)
111 $(SILENT
)$(MAKE
) -C bitmaps
/mono
clean OBJDIR
=$(OBJDIR
)/bitmaps
/mono
112 $(SILENT
)$(MAKE
) -C bitmaps
/native
clean OBJDIR
=$(OBJDIR
)/bitmaps
/native
113 $(SILENT
)$(MAKE
) -C bitmaps
/remote_mono
clean OBJDIR
=$(OBJDIR
)/bitmaps
/remote_mono
114 $(SILENT
)$(MAKE
) -C bitmaps
/remote_native
clean OBJDIR
=$(OBJDIR
)/bitmaps
/remote_native