2002-05-16 12:53:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -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-02-28 12:09:17 +00:00
|
|
|
COMMONLIB = $(ROOTDIR)/uisimulator/common/libcomsim.a
|
|
|
|
|
|
|
|
all: $(COMMONLIB) $(OBJDIR)/$(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-02-16 00:38:31 +00:00
|
|
|
all: $(OBJDIR)/$(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:
|
|
|
|
@$(MAKE) -C codecs
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
rocks:
|
2004-09-22 08:58:50 +00:00
|
|
|
@$(MAKE) -C plugins/lib
|
|
|
|
@$(MAKE) -C plugins
|
2002-05-23 13:55:43 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/librockbox.a:
|
2004-09-22 08:58:50 +00:00
|
|
|
@$(MAKE) -C $(FIRMDIR)
|
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
|
|
|
|
2004-09-22 21:40:45 +00:00
|
|
|
$(OBJDIR)/rombox.elf : $(OBJS) $(LINKROM) $(OBJDIR)/librockbox.a $(DEPFILE)
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "LD rombox.elf"
|
2004-12-19 23:38:35 +00:00
|
|
|
@$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMDIR) -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
|
|
|
|
|
2004-09-22 21:40:45 +00:00
|
|
|
$(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(OBJDIR)/librockbox.a $(DEPFILE)
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "LD rockbox.elf"
|
2005-02-18 13:47:17 +00:00
|
|
|
$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -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
|
2004-09-06 07:05:12 +00:00
|
|
|
@echo "OBJCOPY $<"
|
|
|
|
@$(OC) -O binary $< $@
|
|
|
|
|
|
|
|
$(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf
|
|
|
|
@echo "OBJCOPY $<"
|
|
|
|
@$(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
|
|
|
|
2004-09-22 21:40:45 +00:00
|
|
|
$(OBJDIR)/$(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
|
|
|
|
EXTRAOBJ = $(OBJDIR)/uisw32-res.o
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
$(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a $(OBJDIR)/libcomsim.a
|
2005-02-18 13:47:17 +00:00
|
|
|
@echo "LD $(BINARY)"
|
2005-02-22 12:19:12 +00:00
|
|
|
$(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lsim -lcomsim $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map
|
2005-02-18 13:47:17 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/libsim.a:
|
|
|
|
@$(MAKE) -C $(SIMDIR)
|
2005-02-22 12:19:12 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/libcomsim.a:
|
|
|
|
@$(MAKE) -C $(ROOTDIR)/uisimulator/common
|
2005-02-18 13:47:17 +00:00
|
|
|
endif
|
|
|
|
|
2003-07-31 21:55:21 +00:00
|
|
|
$(OBJDIR)/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
|
|
|
|
|
2004-10-07 08:20:25 +00:00
|
|
|
$(OBJDIR)/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
|
|
|
|
perl credits.pl < $< > $@
|
|
|
|
|
|
|
|
$(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"
|
|
|
|
@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"
|
|
|
|
@perl -s $(TOOLSDIR)/genlang -p=$(OBJDIR)/lang $<
|
|
|
|
@echo "CC lang.c"
|
|
|
|
@$(CC) $(CFLAGS) -c $(OBJDIR)/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"
|
2004-09-22 08:58:50 +00:00
|
|
|
@-rm -f $(OBJS) $(OBJDIR)/$(BINARY) $(OBJDIR)/rockbox.asm \
|
2004-09-06 07:05:12 +00:00
|
|
|
$(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/*.map \
|
|
|
|
$(OBJDIR)/lang.o $(OBJDIR)/build.lang $(OBJDIR)/lang.[ch] \
|
|
|
|
$(OBJDIR)/credits.raw $(LINKFILE) $(OBJDIR)/rockbox.ucl \
|
|
|
|
$(LINKROM) $(OBJDIR)/rombox.ucl $(OBJDIR)/rombox.bin \
|
2004-09-22 08:58:50 +00:00
|
|
|
$(OBJDIR)/rombox.elf $(MAXOUTFILE) $(DEPFILE)
|
2004-09-06 07:05:12 +00:00
|
|
|
@$(MAKE) -C plugins clean
|
2005-02-16 00:38:31 +00:00
|
|
|
@$(MAKE) -C codecs clean
|
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)
|