2005-01-28 12:51:10 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2006-03-07 12:45:45 +00:00
|
|
|
INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
|
2008-05-05 12:05:00 +00:00
|
|
|
-I$(BUILDDIR) -I$(BUILDDIR)/bitmaps
|
2005-01-28 12:51:10 +00:00
|
|
|
|
2005-01-28 23:25:40 +00:00
|
|
|
DEPFILE = $(OBJDIR)/dep-bootloader
|
2008-03-27 23:58:03 +00:00
|
|
|
LDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds
|
2005-01-28 12:51:10 +00:00
|
|
|
|
2008-05-05 12:05:00 +00:00
|
|
|
# Set up the bitmap libraries
|
|
|
|
BITMAPLIBS =
|
|
|
|
LINKBITMAPS =
|
|
|
|
ifneq ($(strip $(BMP2RB_MONO)),)
|
|
|
|
BITMAPLIBS += $(BUILDDIR)/libbitmapsmono.a
|
|
|
|
LINKBITMAPS += -lbitmapsmono
|
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BMP2RB_NATIVE)),)
|
|
|
|
BITMAPLIBS += $(BUILDDIR)/libbitmapsnative.a
|
|
|
|
LINKBITMAPS += -lbitmapsnative
|
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BMP2RB_REMOTEMONO)),)
|
|
|
|
BITMAPLIBS += $(BUILDDIR)/libbitmapsremotemono.a
|
|
|
|
LINKBITMAPS += -lbitmapsremotemono
|
|
|
|
endif
|
|
|
|
ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
|
|
|
|
BITMAPLIBS += $(BUILDDIR)/libbitmapsremotenative.a
|
|
|
|
LINKBITMAPS += -lbitmapsremotenative
|
|
|
|
endif
|
|
|
|
|
2005-01-28 12:51:10 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
DEFINES := -DDEBUG
|
|
|
|
CFLAGS += -g
|
|
|
|
endif
|
|
|
|
|
2007-09-09 11:20:20 +00:00
|
|
|
SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - )
|
2005-01-28 12:51:10 +00:00
|
|
|
DIRS = .
|
|
|
|
|
|
|
|
ifdef APPEXTRA
|
2005-10-27 14:39:00 +00:00
|
|
|
DIRS += $(subst :, ,$(APPEXTRA))
|
|
|
|
INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
|
2005-01-28 12:51:10 +00:00
|
|
|
endif
|
|
|
|
|
2005-07-15 07:42:25 +00:00
|
|
|
ifndef VERSION
|
|
|
|
VERSION=$(shell date +%y%m%d-%H%M)
|
|
|
|
endif
|
|
|
|
|
2005-01-28 12:51:10 +00:00
|
|
|
CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
|
|
|
|
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
|
|
|
|
|
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
|
|
|
SOURCES = $(SRC)
|
|
|
|
LINKFILE = $(OBJDIR)/linkage.lds
|
|
|
|
MAXINFILE = $(OBJDIR)/romstart.temp
|
|
|
|
MAXOUTFILE = $(OBJDIR)/romstart
|
|
|
|
|
2005-07-11 20:36:12 +00:00
|
|
|
LIBROCKBOX = $(BUILDDIR)/librockbox.a
|
|
|
|
|
2005-01-28 12:51:10 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
all: $(OBJDIR)/bootloader.elf
|
|
|
|
else
|
2005-05-07 23:16:25 +00:00
|
|
|
all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
|
2005-01-28 12:51:10 +00:00
|
|
|
endif
|
|
|
|
|
2008-05-05 12:05:00 +00:00
|
|
|
$(DEPFILE): $(BITMAPLIBS)
|
|
|
|
|
2005-01-28 12:51:10 +00:00
|
|
|
dep: $(DEPFILE)
|
|
|
|
|
|
|
|
$(LINKFILE): $(LDS)
|
2007-09-09 11:20:20 +00:00
|
|
|
$(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) $(DEFINES) -E -P $(ROMBUILD) - >$@
|
2005-01-28 12:51:10 +00:00
|
|
|
|
|
|
|
$(MAXOUTFILE):
|
2006-10-30 01:40:20 +00:00
|
|
|
$(SILENT)echo '#include "config.h"' > $(MAXINFILE)
|
|
|
|
$(SILENT)echo "ROM_START" >> $(MAXINFILE)
|
|
|
|
$(SILENT)cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
|
|
|
|
$(SILENT)rm $(MAXINFILE)
|
2005-01-28 12:51:10 +00:00
|
|
|
|
2008-05-05 12:05:00 +00:00
|
|
|
build-bitmapsmono:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/mono)$(MAKE) -C ../apps/bitmaps/mono OBJDIR=$(OBJDIR)/bitmaps/mono
|
|
|
|
|
|
|
|
build-bitmapsnative:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/native)$(MAKE) -C ../apps/bitmaps/native OBJDIR=$(OBJDIR)/bitmaps/native
|
|
|
|
|
|
|
|
build-bitmapsremotemono:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/remote_mono)$(MAKE) -C ../apps/bitmaps/remote_mono OBJDIR=$(OBJDIR)/bitmaps/remote_mono
|
|
|
|
|
|
|
|
build-bitmapsremotenative:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/remote_native)$(MAKE) -C ../apps/bitmaps/remote_native OBJDIR=$(OBJDIR)/bitmaps/remote_native
|
|
|
|
|
|
|
|
$(BITMAPLIBS): $(BUILDDIR)/lib%.a: build-%
|
|
|
|
|
|
|
|
$(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(BITMAPLIBS)
|
|
|
|
$(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
|
2005-01-28 12:51:10 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
|
2005-01-28 12:51:10 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/bootloader.asm: $(OBJDIR)/bootloader.bin
|
|
|
|
$(TOOLSDIR)/sh2d -sh1 $< > $@
|
|
|
|
|
2005-05-07 23:16:25 +00:00
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJDIR)/bootloader.bin
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,Build bootloader file)$(MKFIRMWARE) $< $@
|
2005-01-28 12:51:10 +00:00
|
|
|
|
|
|
|
include $(TOOLSDIR)/make.inc
|
|
|
|
|
|
|
|
clean:
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,cleaning bootloader)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/bootloader.asm \
|
2005-01-28 12:51:10 +00:00
|
|
|
$(OBJDIR)/bootloader.bin $(OBJDIR)/bootloader.elf $(OBJDIR)/*.map \
|
|
|
|
$(LINKFILE) $(MAXOUTFILE) $(DEPFILE)
|
2008-05-05 12:05:00 +00:00
|
|
|
$(SILENT)$(MAKE) -C bitmaps/mono clean OBJDIR=$(OBJDIR)/bitmaps/mono
|
|
|
|
$(SILENT)$(MAKE) -C bitmaps/native clean OBJDIR=$(OBJDIR)/bitmaps/native
|
|
|
|
$(SILENT)$(MAKE) -C bitmaps/remote_mono clean OBJDIR=$(OBJDIR)/bitmaps/remote_mono
|
|
|
|
$(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
|
2005-01-28 12:51:10 +00:00
|
|
|
|
|
|
|
-include $(DEPFILE)
|