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) \
|
|
|
|
-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
|
|
|
|
|
2005-03-06 15:40:03 +00:00
|
|
|
# This sets up 'SRC' based on the files mentioned in SOURCES
|
|
|
|
include $(TOOLSDIR)/makesrc.inc
|
|
|
|
|
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
|
|
|
|
DIRS += $(APPEXTRA)
|
|
|
|
INCLUDES += -I$(APPEXTRA)
|
2004-09-09 06:01:46 +00:00
|
|
|
endif
|
2002-05-21 14:33:00 +00:00
|
|
|
|
2004-10-04 13:03:33 +00:00
|
|
|
CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
|
|
|
|
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
|
2002-05-23 13:55:43 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o)
|
|
|
|
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-02-18 13:47:17 +00:00
|
|
|
ifdef SIMVER
|
|
|
|
# this is a sim build
|
2005-05-07 22:41:17 +00:00
|
|
|
COMMONLIB = $(BUILDDIR)/comsim/libcomsim.a
|
2005-02-28 12:09:17 +00:00
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
all: $(COMMONLIB) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS)
|
2005-02-22 12:19:12 +00:00
|
|
|
@$(MAKE) -C $(SIMDIR)
|
2005-02-28 12:09:17 +00:00
|
|
|
|
|
|
|
$(COMMONLIB):
|
2005-02-22 12:19:12 +00:00
|
|
|
@$(MAKE) -C $(ROOTDIR)/uisimulator/common
|
2004-03-30 12:00:19 +00:00
|
|
|
else
|
2005-02-18 13:47:17 +00:00
|
|
|
# regular target build
|
2005-05-07 22:41:17 +00:00
|
|
|
all: $(BUILDDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
|
2004-03-30 12:00:19 +00:00
|
|
|
endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
dep: $(DEPFILE)
|
|
|
|
|
2005-02-16 00:38:31 +00:00
|
|
|
build-codecs:
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(MAKE) -C codecs OBJDIR=$(OBJDIR)/codecs
|
2005-02-16 00:38:31 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rocks:
|
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
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(OBJDIR)/rombox.elf : $(OBJS) $(LINKROM) $(DEPFILE)
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "LD rombox.elf"
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lgcc -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
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(DEPFILE)
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "LD rockbox.elf"
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR)/firmware -L$(BUILDDIR) -lrockbox -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-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin
|
2004-09-22 08:58:50 +00:00
|
|
|
@echo "Build firmware file"
|
|
|
|
@$(MKFIRMWARE) $< $@
|
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-02-22 12:19:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJS) $(DEPFILE) $(BUILDDIR)/libsim.a \
|
|
|
|
$(BUILDDIR)/libcomsim.a
|
2005-02-18 13:47:17 +00:00
|
|
|
@echo "LD $(BINARY)"
|
2005-05-07 22:41:17 +00:00
|
|
|
@$(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lsim -lcomsim $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map
|
2005-02-18 13:47:17 +00:00
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/libsim.a:
|
|
|
|
@$(MAKE) -C $(SIMDIR) OBJDIR=$(BUILDDIR)/sim
|
2005-02-22 12:19:12 +00:00
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/libcomsim.a:
|
|
|
|
@$(MAKE) -C $(ROOTDIR)/uisimulator/common OBJDIR=$(BUILDDIR)/comsim
|
2005-02-18 13:47:17 +00:00
|
|
|
endif
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
|
2003-07-31 22:09:07 +00:00
|
|
|
@a=`uclpack -h 2>/dev/null`; \
|
2003-07-31 21:55:21 +00:00
|
|
|
if test -n "$$a"; then \
|
2004-09-06 07:05:12 +00:00
|
|
|
echo "UCLPACK rockbox" ; \
|
2003-08-01 02:06:24 +00:00
|
|
|
uclpack --best --2e $< $@ >/dev/null 2>&1; \
|
2003-07-31 21:55:21 +00:00
|
|
|
else \
|
2004-09-06 07:05:12 +00:00
|
|
|
echo "no uclpack command found, makes a fake rockbox.ucl"; \
|
|
|
|
echo "fake" > $@; \
|
|
|
|
fi
|
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
$(BUILDDIR)/rombox.ucl: $(OBJDIR)/rombox.bin $(MAXOUTFILE)
|
2004-09-06 07:05:12 +00:00
|
|
|
@a=`uclpack -h 2>/dev/null`; \
|
|
|
|
if test -n "$$a"; then \
|
|
|
|
echo "UCLPACK rombox" ; \
|
|
|
|
uclpack --none $< $@ >/dev/null 2>&1; \
|
|
|
|
if test -s $@; then \
|
2004-09-06 09:16:06 +00:00
|
|
|
perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
|
2004-09-06 07:05:12 +00:00
|
|
|
if test $$? -ne 0; then \
|
|
|
|
echo "removing UCL file again, making it a fake one"; \
|
|
|
|
echo "fake" > $@; \
|
|
|
|
fi \
|
|
|
|
else \
|
|
|
|
echo "Your uclpack seems to not support --none, making a fake ucl"; \
|
|
|
|
echo "fake" > $@; \
|
|
|
|
fi \
|
|
|
|
else \
|
|
|
|
echo "no uclpack command found, makes a fake rombox.ucl"; \
|
2003-07-31 21:59:06 +00:00
|
|
|
echo "fake" > $@; \
|
2003-07-31 21:55:21 +00:00
|
|
|
fi
|
|
|
|
|
2002-10-15 07:49:47 +00:00
|
|
|
$(OBJDIR)/credits.raw: $(DOCSDIR)/CREDITS
|
2005-05-07 22:41:17 +00:00
|
|
|
@echo "create credits.raw"
|
|
|
|
@perl credits.pl < $< > $@
|
2002-10-15 07:49:47 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/credits.o: credits.c credits.h $(OBJDIR)/credits.raw
|
|
|
|
@mkdir -p `dirname $@`
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "CC $<"
|
|
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
2002-10-15 07:49:47 +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] \
|
|
|
|
$(OBJDIR)/credits.raw $(LINKFILE) $(BUILDDIR)/rockbox.ucl $(LINKROM) \
|
|
|
|
$(BUILDDIR)/rombox.ucl $(OBJDIR)/rombox.bin $(OBJDIR)/rombox.elf \
|
|
|
|
$(MAXOUTFILE) $(DEPFILE)
|
|
|
|
@$(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
|
2005-02-18 13:47:17 +00:00
|
|
|
ifdef SIMVER
|
|
|
|
@$(MAKE) -C $(SIMDIR) clean
|
|
|
|
endif
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
-include $(DEPFILE)
|