2002-05-16 12:53:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
INCLUDES= -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) \
|
2004-10-04 13:03:33 +00:00
|
|
|
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
|
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:
|
2005-06-22 19:41:30 +00:00
|
|
|
@$(MAKE) -C codecs/lib OBJDIR=$(OBJDIR)/codecs/lib
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(MAKE) -C codecs OBJDIR=$(OBJDIR)/codecs
|
2005-02-16 00:38:31 +00:00
|
|
|
|
2006-01-26 11:57:53 +00:00
|
|
|
build-bitmaps:
|
|
|
|
@$(MAKE) -C bitmaps OBJDIR=$(OBJDIR)/bitmaps
|
2006-01-22 21:30:32 +00:00
|
|
|
|
2006-02-09 04:27:57 +00:00
|
|
|
$(BITMAPLIBS): build-bitmaps
|
2006-02-21 01:23:30 +00:00
|
|
|
|
2006-02-09 04:27:57 +00:00
|
|
|
rocks: build-codecs
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(MAKE) -C plugins/lib OBJDIR=$(OBJDIR)/plugins/lib
|
|
|
|
@$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
$(LINKFILE): $(LDS)
|
2004-09-22 08:58:50 +00:00
|
|
|
@echo "Build LDS file"
|
2005-03-09 14:39:52 +00:00
|
|
|
@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)
|
2004-09-22 08:58:50 +00:00
|
|
|
@echo "Build LDS file for Rombox"
|
|
|
|
@cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
|
2004-09-06 08:50:47 +00:00
|
|
|
|
|
|
|
$(MAXOUTFILE):
|
|
|
|
@echo '#include "config.h"' > $(MAXINFILE)
|
|
|
|
@echo "ROM_START" >> $(MAXINFILE)
|
2004-09-22 08:58:50 +00:00
|
|
|
@cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
|
2004-09-06 08:50:47 +00:00
|
|
|
@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)
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "LD rombox.elf"
|
2006-01-22 21:30:32 +00:00
|
|
|
@$(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)
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "LD rockbox.elf"
|
2006-01-22 21:30:32 +00:00
|
|
|
@$(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
|
2005-05-07 22:41:17 +00:00
|
|
|
@echo "OBJCOPY "`basename $@`
|
2004-09-06 07:05:12 +00:00
|
|
|
@$(OC) -O binary $< $@
|
|
|
|
|
|
|
|
$(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf
|
2005-05-07 22:41:17 +00:00
|
|
|
@echo "OBJCOPY "`basename $@`
|
2004-09-06 07:05:12 +00:00
|
|
|
@$(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)
|
2004-09-22 08:58:50 +00:00
|
|
|
@echo "Build firmware file"
|
2005-12-05 21:56:56 +00:00
|
|
|
$(SILENT)($(MKFIRMWARE) $< $@; \
|
|
|
|
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
|
|
|
|
|
|
|
|
|
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)
|
2005-02-18 13:47:17 +00:00
|
|
|
@echo "LD $(BINARY)"
|
2006-01-22 22:08:05 +00:00
|
|
|
$(SILENT)$(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lsim -lcomsim $(LINKBITMAPS) $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map
|
2005-02-18 13:47:17 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
|
2005-11-28 09:26:34 +00:00
|
|
|
$(SILENT)(echo "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)
|
2005-11-28 09:26:34 +00:00
|
|
|
$(SILENT)(echo "UCLPACK rombox" ; \
|
|
|
|
$(TOOLSDIR)/uclpack --none $< $@ >/dev/null 2>&1; \
|
|
|
|
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" > $@; \
|
2005-11-28 09:26:34 +00:00
|
|
|
fi)
|
2003-07-31 21:55:21 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
include $(TOOLSDIR)/make.inc
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-04-22 22:19:19 +00:00
|
|
|
$(OBJDIR)/build.lang: lang/$(LANGUAGE).lang $(TOOLSDIR)/uplang
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "UPLANG"
|
2005-05-07 22:41:17 +00:00
|
|
|
@mkdir -p `dirname $@`
|
2004-09-06 07:05:12 +00:00
|
|
|
@perl $(TOOLSDIR)/uplang lang/english.lang $< > $@
|
2002-09-20 06:40:13 +00:00
|
|
|
|
2003-04-22 22:19:19 +00:00
|
|
|
$(OBJDIR)/lang.o: $(OBJDIR)/build.lang $(TOOLSDIR)/genlang
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "GENLANG"
|
2005-05-07 22:41:17 +00:00
|
|
|
@mkdir -p `dirname $@`
|
|
|
|
@perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang $<
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "CC lang.c"
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(CC) $(CFLAGS) -c $(BUILDDIR)/lang.c -o $@
|
2002-09-18 14:08:05 +00:00
|
|
|
|
2002-05-16 12:53:40 +00:00
|
|
|
clean:
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "cleaning apps"
|
2005-05-07 22:41:17 +00:00
|
|
|
@-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/rockbox.asm \
|
|
|
|
$(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-01-22 21:30:32 +00:00
|
|
|
@$(MAKE) -C bitmaps/mono clean OBJDIR=$(OBJDIR)/bitmaps/mono
|
|
|
|
@$(MAKE) -C bitmaps/native clean OBJDIR=$(OBJDIR)/bitmaps/native
|
|
|
|
@$(MAKE) -C bitmaps/remote_mono clean OBJDIR=$(OBJDIR)/bitmaps/remote_mono
|
|
|
|
@$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins
|
|
|
|
@$(MAKE) -C codecs clean OBJDIR=$(OBJDIR)/codecs
|
2004-09-22 08:58:50 +00:00
|
|
|
@rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
|
2006-02-21 01:23:30 +00:00
|
|
|
@rm -rf $(BUILDDIR)/bitmaps
|
2005-02-18 13:47:17 +00:00
|
|
|
ifdef SIMVER
|
|
|
|
@$(MAKE) -C $(SIMDIR) clean
|
|
|
|
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
|