2002-05-16 12:53:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2006-07-27 13:27:31 +00:00
|
|
|
INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
|
2006-02-21 01:23:30 +00:00
|
|
|
-I$(BUILDDIR)/bitmaps -I$(OBJDIR)
|
2003-07-31 22:09:07 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
DEPFILE = $(OBJDIR)/dep-apps
|
|
|
|
LDS := $(FIRMDIR)/app.lds
|
|
|
|
ROMLDS := $(FIRMDIR)/rom.lds
|
2003-02-26 16:05:30 +00:00
|
|
|
|
2004-10-07 08:32:50 +00:00
|
|
|
ifdef ENABLEDPLUGINS
|
|
|
|
ROCKS=rocks
|
|
|
|
endif
|
|
|
|
|
2005-02-16 00:38:31 +00:00
|
|
|
ifdef SOFTWARECODECS
|
|
|
|
CODECS=build-codecs
|
|
|
|
endif
|
|
|
|
|
2006-01-22 21:30:32 +00:00
|
|
|
# Set up the bitmap libraries
|
2006-01-23 01:56:43 +00:00
|
|
|
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
|
2006-01-22 21:30:32 +00:00
|
|
|
|
2005-03-06 15:40:03 +00:00
|
|
|
# This sets up 'SRC' based on the files mentioned in SOURCES
|
|
|
|
include $(TOOLSDIR)/makesrc.inc
|
|
|
|
|
2005-08-30 20:51:36 +00:00
|
|
|
DEFINES = $(DEBUG)
|
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
DIRS = .
|
2002-05-21 14:33:00 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
ifdef APPEXTRA
|
2005-10-27 14:39:00 +00:00
|
|
|
DIRS += $(subst :, ,$(APPEXTRA))
|
|
|
|
INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
|
2004-09-09 06:01:46 +00:00
|
|
|
endif
|
2002-05-21 14:33:00 +00:00
|
|
|
|
2006-02-24 13:48:52 +00:00
|
|
|
CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(DEFINES) -DTARGET_ID=$(TARGET_ID) \
|
2006-10-19 09:42:58 +00:00
|
|
|
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} \
|
|
|
|
-DTARGET_NAME=\"$(ARCHOS)\"
|
2002-05-23 13:55:43 +00:00
|
|
|
|
2006-01-31 22:05:47 +00:00
|
|
|
OBJS2 := $(OBJDIR)/lang.o $(patsubst %.c, $(OBJDIR)/%.o, $(SRC))
|
|
|
|
OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
|
2004-09-22 08:58:50 +00:00
|
|
|
SOURCES = $(SRC)
|
2003-02-26 09:16:48 +00:00
|
|
|
LINKFILE = $(OBJDIR)/linkage.lds
|
2004-09-06 07:05:12 +00:00
|
|
|
LINKROM = $(OBJDIR)/linkrom.lds
|
2004-09-06 08:50:47 +00:00
|
|
|
MAXINFILE = $(OBJDIR)/romstart.temp
|
|
|
|
MAXOUTFILE = $(OBJDIR)/romstart
|
|
|
|
|
2005-05-09 12:17:24 +00:00
|
|
|
LIBROCKBOX = $(BUILDDIR)/librockbox.a
|
|
|
|
|
2005-02-18 13:47:17 +00:00
|
|
|
ifdef SIMVER
|
|
|
|
# this is a sim build
|
2005-02-28 12:09:17 +00:00
|
|
|
|
2006-02-09 04:27:57 +00:00
|
|
|
all: $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS)
|
2005-02-28 12:09:17 +00:00
|
|
|
|
2004-03-30 12:00:19 +00:00
|
|
|
else
|
2005-02-18 13:47:17 +00:00
|
|
|
# regular target build
|
2005-11-07 22:33:27 +00:00
|
|
|
|
2006-02-03 23:20:36 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
REALBIN = $(OBJDIR)/rockbox.elf
|
|
|
|
else
|
2005-11-07 22:33:27 +00:00
|
|
|
# this is not needed to get built when doing debug builds
|
|
|
|
REALBIN = $(BUILDDIR)/$(BINARY)
|
|
|
|
endif
|
|
|
|
|
2006-02-09 04:27:57 +00:00
|
|
|
all: $(REALBIN) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
|
2004-03-30 12:00:19 +00:00
|
|
|
endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2006-02-21 01:23:30 +00:00
|
|
|
$(DEPFILE): $(BITMAPLIBS)
|
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
dep: $(DEPFILE)
|
|
|
|
|
2005-02-16 00:38:31 +00:00
|
|
|
build-codecs:
|
2006-10-27 21:48:06 +00:00
|
|
|
$(SILENT)$(MAKE) -C codecs/lib OBJDIR=$(OBJDIR)/codecs/lib
|
|
|
|
$(SILENT)$(MAKE) -C codecs OBJDIR=$(OBJDIR)/codecs
|
2005-02-16 00:38:31 +00:00
|
|
|
|
2006-10-27 21:48:06 +00:00
|
|
|
build-bitmapsmono:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/mono)$(MAKE) -C bitmaps/mono OBJDIR=$(OBJDIR)/bitmaps/mono
|
2006-01-22 21:30:32 +00:00
|
|
|
|
2006-10-27 21:48:06 +00:00
|
|
|
build-bitmapsnative:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/native)$(MAKE) -C bitmaps/native OBJDIR=$(OBJDIR)/bitmaps/native
|
|
|
|
|
|
|
|
build-bitmapsremotemono:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/remote_mono)$(MAKE) -C bitmaps/remote_mono OBJDIR=$(OBJDIR)/bitmaps/remote_mono
|
|
|
|
|
|
|
|
build-bitmapsremotenative:
|
|
|
|
$(call PRINTS,MAKE in bitmaps/remote_native)$(MAKE) -C bitmaps/remote_native OBJDIR=$(OBJDIR)/bitmaps/remote_native
|
|
|
|
|
|
|
|
$(BITMAPLIBS): $(BUILDDIR)/lib%.a: build-%
|
2006-02-21 01:23:30 +00:00
|
|
|
|
2006-02-09 04:27:57 +00:00
|
|
|
rocks: build-codecs
|
2006-10-27 21:48:06 +00:00
|
|
|
$(SILENT)$(MAKE) -C plugins/lib OBJDIR=$(OBJDIR)/plugins/lib
|
|
|
|
$(SILENT)$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
$(LINKFILE): $(LDS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,Build $(@F))cat $< | $(CC) -DLOADADDRESS=$(LOADADDRESS) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2004-09-06 07:05:12 +00:00
|
|
|
$(LINKROM): $(ROMLDS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
|
2004-09-06 08:50:47 +00:00
|
|
|
|
|
|
|
$(MAXOUTFILE):
|
2006-10-27 21:48:06 +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)
|
2004-09-06 07:05:12 +00:00
|
|
|
|
2006-01-22 21:30:32 +00:00
|
|
|
$(OBJDIR)/rombox.elf : $(OBJS) $(LINKROM) $(DEPFILE) $(LIBROCKBOX) $(BITMAPLIBS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lgcc $(LINKBITMAPS) -L$(BUILDDIR)/firmware -T$(LINKROM) -Wl,-Map,$(OBJDIR)/rombox.map
|
2004-09-06 07:05:12 +00:00
|
|
|
|
2005-02-18 13:47:17 +00:00
|
|
|
ifndef SIMVER
|
|
|
|
|
2006-01-22 21:30:32 +00:00
|
|
|
$(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(BITMAPLIBS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR)/firmware -L$(BUILDDIR) -lrockbox $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
$(OBJDIR)/rockbox.bin : $(OBJDIR)/rockbox.elf
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
|
2004-09-06 07:05:12 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
$(OBJDIR)/rockbox.asm: $(OBJDIR)/rockbox.bin
|
2003-08-01 01:47:22 +00:00
|
|
|
$(TOOLSDIR)/sh2d -sh1 $< > $@
|
2003-02-26 09:16:48 +00:00
|
|
|
|
2005-12-05 21:56:56 +00:00
|
|
|
#
|
|
|
|
# If there's a flashfile defined for this target (rockbox.ucl for Archos
|
|
|
|
# models) Then check if the mkfirmware script fails, as then it is (likely)
|
|
|
|
# because the image is too big and we need to create a compressed image
|
|
|
|
# instead.
|
|
|
|
#
|
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin $(FLASHFILE)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,Build firmware file)($(MKFIRMWARE) $< $@; \
|
2005-12-05 21:56:56 +00:00
|
|
|
stat=$$?; \
|
|
|
|
if test -n "$(FLASHFILE)"; then \
|
|
|
|
if test "$$stat" -ne 0; then \
|
|
|
|
echo "Image too big, making a compressed version!"; \
|
|
|
|
$(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
|
|
|
|
$(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
|
|
|
|
fi \
|
|
|
|
fi )
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2005-02-18 13:47:17 +00:00
|
|
|
else
|
|
|
|
# this is a simulator build
|
2005-02-22 12:19:12 +00:00
|
|
|
|
|
|
|
ifeq ($(SIMVER), win32)
|
|
|
|
# OK, this is ugly but we need it on the link line to make it do right
|
2005-05-07 22:41:17 +00:00
|
|
|
EXTRAOBJ = $(BUILDDIR)/sim/uisw32-res.o
|
2005-07-21 09:54:04 +00:00
|
|
|
LDOPTS += -lwinmm
|
2005-02-22 12:19:12 +00:00
|
|
|
endif
|
|
|
|
|
2006-09-29 16:15:11 +00:00
|
|
|
# OS X's ld does not support -Map
|
|
|
|
ifeq ($(UNAME), Darwin)
|
|
|
|
SIMULATOR_MAP=
|
|
|
|
else
|
|
|
|
SIMULATOR_MAP=-Wl,-Map,$(OBJDIR)/rockbox.map
|
|
|
|
endif
|
2005-02-22 12:19:12 +00:00
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJS) $(DEPFILE) $(BUILDDIR)/libsim.a \
|
2006-02-09 05:28:17 +00:00
|
|
|
$(BUILDDIR)/libcomsim.a $(LIBROCKBOX) $(BITMAPLIBS)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,LD $(BINARY))$(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lsim -lcomsim $(LINKBITMAPS) $(LDOPTS) $(EXTRAOBJ) $(SIMULATOR_MAP)
|
2005-02-18 13:47:17 +00:00
|
|
|
endif
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,UCLPACK rockbox)$(TOOLSDIR)/uclpack --best --2e $< $@ >/dev/null 2>&1
|
2004-09-06 07:05:12 +00:00
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/rombox.ucl: $(OBJDIR)/rombox.bin $(MAXOUTFILE)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,UCLPACK rombox)$(TOOLSDIR)/uclpack --none $< $@ >/dev/null 2>&1; \
|
2005-11-28 09:26:34 +00:00
|
|
|
perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
|
|
|
|
if test $$? -ne 0; then \
|
|
|
|
echo "removing UCL file again, making it a fake one"; \
|
2003-07-31 21:59:06 +00:00
|
|
|
echo "fake" > $@; \
|
2006-10-27 21:48:06 +00:00
|
|
|
fi
|
2003-07-31 21:55:21 +00:00
|
|
|
|
2007-01-08 18:21:12 +00:00
|
|
|
$(BUILDDIR)/rombox.iriver: $(OBJDIR)/rombox.bin
|
|
|
|
$(call PRINTS,Build ROM file)$(MKFIRMWARE) $< $@
|
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
include $(TOOLSDIR)/make.inc
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2006-04-03 21:11:11 +00:00
|
|
|
$(OBJDIR)/lang.o: lang/$(LANGUAGE).lang
|
2006-10-22 00:21:57 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,GENLANG)perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(ARCHOS) $<
|
|
|
|
$(call PRINTS,CC lang.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang.c -o $@
|
2002-09-18 14:08:05 +00:00
|
|
|
|
2002-05-16 12:53:40 +00:00
|
|
|
clean:
|
2006-10-27 21:48:06 +00:00
|
|
|
$(call PRINTS,cleaning apps)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/rockbox.asm \
|
2005-05-07 22:41:17 +00:00
|
|
|
$(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/*.map \
|
|
|
|
$(OBJDIR)/lang.o $(OBJDIR)/build.lang $(BUILDDIR)/lang.[ch] \
|
2005-09-02 05:39:09 +00:00
|
|
|
$(LINKFILE) $(BUILDDIR)/rockbox.ucl $(LINKROM) \
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/rombox.ucl $(OBJDIR)/rombox.bin $(OBJDIR)/rombox.elf \
|
|
|
|
$(MAXOUTFILE) $(DEPFILE)
|
2006-10-27 21:48:06 +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
|
|
|
|
$(SILENT)$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins
|
|
|
|
$(SILENT)$(MAKE) -C codecs clean OBJDIR=$(OBJDIR)/codecs
|
|
|
|
$(SILENT)rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
|
|
|
|
$(SILENT)rm -rf $(BUILDDIR)/bitmaps
|
2005-02-18 13:47:17 +00:00
|
|
|
ifdef SIMVER
|
2006-10-27 21:48:06 +00:00
|
|
|
$(SILENT)$(MAKE) -C $(SIMDIR) clean
|
2005-02-18 13:47:17 +00:00
|
|
|
endif
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2006-01-22 21:30:32 +00:00
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
2004-09-22 08:58:50 +00:00
|
|
|
-include $(DEPFILE)
|
2006-01-22 21:30:32 +00:00
|
|
|
endif
|