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
)))
50 VERSION
=$(shell date
+%y
%m
%d-
%H
%M
)
53 CFLAGS
= $(GCCOPTS
) $(INCLUDES
) $(TARGET
) $(DEFINES
) \
54 -DAPPSVERSION
=\"$(VERSION
)\" $(EXTRA_DEFINES
) -DMEM
=${MEMORYSIZE}
56 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
58 LINKFILE
= $(OBJDIR
)/linkage.lds
59 MAXINFILE
= $(OBJDIR
)/romstart.temp
60 MAXOUTFILE
= $(OBJDIR
)/romstart
62 LIBROCKBOX
= $(BUILDDIR
)/librockbox.a
65 all: $(OBJDIR
)/bootloader.elf
67 all: $(BUILDDIR
)/$(BINARY
) $(FLASHFILE
)
70 $(DEPFILE
): $(BITMAPLIBS
)
75 $(call PRINTS
,Build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(EXTRA_DEFINES
) $(DEFINES
) -E
-P
$(ROMBUILD
) - >$@
78 $(SILENT
)echo
'#include "config.h"' > $(MAXINFILE
)
79 $(SILENT
)echo
"ROM_START" >> $(MAXINFILE
)
80 $(SILENT
)cat
$(MAXINFILE
) |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) $(DEFINES
) -E
-P
$(ROMBUILD
) - > $(MAXOUTFILE
)
81 $(SILENT
)rm $(MAXINFILE
)
84 $(call PRINTS
,MAKE in bitmaps
/mono
)$(MAKE
) -C ..
/apps
/bitmaps
/mono OBJDIR
=$(OBJDIR
)/bitmaps
/mono
87 $(call PRINTS
,MAKE in bitmaps
/native
)$(MAKE
) -C ..
/apps
/bitmaps
/native OBJDIR
=$(OBJDIR
)/bitmaps
/native
89 build-bitmapsremotemono
:
90 $(call PRINTS
,MAKE in bitmaps
/remote_mono
)$(MAKE
) -C ..
/apps
/bitmaps
/remote_mono OBJDIR
=$(OBJDIR
)/bitmaps
/remote_mono
92 build-bitmapsremotenative
:
93 $(call PRINTS
,MAKE in bitmaps
/remote_native
)$(MAKE
) -C ..
/apps
/bitmaps
/remote_native OBJDIR
=$(OBJDIR
)/bitmaps
/remote_native
95 $(BITMAPLIBS
): $(BUILDDIR
)/lib
%.a
: build-
%
97 $(OBJDIR
)/bootloader.elf
: $(OBJS
) $(LINKFILE
) $(DEPFILE
) $(LIBROCKBOX
) $(BITMAPLIBS
)
98 $(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
100 $(OBJDIR
)/bootloader.bin
: $(OBJDIR
)/bootloader.elf
101 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) $(if
$(filter yes
, $(USE_ELF
)), -S
-x
, -O binary
) $< $@
103 $(OBJDIR
)/bootloader.asm
: $(OBJDIR
)/bootloader.bin
104 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
106 $(BUILDDIR
)/$(BINARY
) : $(OBJDIR
)/bootloader.bin
107 $(call PRINTS
,Build bootloader file
)$(MKFIRMWARE
) $< $@
109 include $(TOOLSDIR
)/make.inc
112 $(call PRINTS
,cleaning bootloader
)-rm -f
$(OBJS
) $(BUILDDIR
)/$(BINARY
) $(OBJDIR
)/bootloader.asm \
113 $(OBJDIR
)/bootloader.bin
$(OBJDIR
)/bootloader.elf
$(OBJDIR
)/*.map \
114 $(LINKFILE
) $(MAXOUTFILE
) $(DEPFILE
)
115 $(SILENT
)$(MAKE
) -C bitmaps
/mono
clean OBJDIR
=$(OBJDIR
)/bitmaps
/mono
116 $(SILENT
)$(MAKE
) -C bitmaps
/native
clean OBJDIR
=$(OBJDIR
)/bitmaps
/native
117 $(SILENT
)$(MAKE
) -C bitmaps
/remote_mono
clean OBJDIR
=$(OBJDIR
)/bitmaps
/remote_mono
118 $(SILENT
)$(MAKE
) -C bitmaps
/remote_native
clean OBJDIR
=$(OBJDIR
)/bitmaps
/remote_native