2002-05-16 12:53:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2003-08-01 01:47:22 +00:00
|
|
|
# $@ is the name to the left of the colon
|
|
|
|
# $> is the first name to the right of the colon
|
2003-07-31 22:09:07 +00:00
|
|
|
|
2002-05-16 12:53:40 +00:00
|
|
|
CC = sh-elf-gcc
|
|
|
|
LD = sh-elf-ld
|
|
|
|
AR = sh-elf-ar
|
|
|
|
AS = sh-elf-as
|
|
|
|
OC = sh-elf-objcopy
|
|
|
|
|
2002-09-18 14:08:05 +00:00
|
|
|
LANGUAGE = english
|
|
|
|
|
2002-05-16 12:53:40 +00:00
|
|
|
FIRMWARE := ../firmware
|
2002-10-15 07:49:47 +00:00
|
|
|
DOCSDIR := ../docs
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-07 10:14:40 +00:00
|
|
|
INCLUDES= -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I. -I$(OBJDIR)
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-07-31 21:55:21 +00:00
|
|
|
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
|
|
|
|
-fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) \
|
2004-06-27 11:03:54 +00:00
|
|
|
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEM}
|
2002-05-23 14:29:53 +00:00
|
|
|
AFLAGS += -small -relax
|
|
|
|
|
2003-02-18 08:45:41 +00:00
|
|
|
# Check if this is a kind of Recorder
|
|
|
|
ANYREC = $(findstring RECORDER, $(TARGET))
|
|
|
|
|
2003-12-12 14:07:28 +00:00
|
|
|
# scramble tool
|
|
|
|
TOOL = scramble
|
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
ifndef MEM
|
|
|
|
# if MEM is not set, assume 2MB
|
|
|
|
MEM=2
|
|
|
|
endif
|
|
|
|
|
2004-07-24 19:04:49 +00:00
|
|
|
ifdef ARCHOS_ROM
|
|
|
|
ROMBUILD=-DARCHOS_ROM
|
|
|
|
endif
|
|
|
|
|
2003-02-26 16:05:30 +00:00
|
|
|
LDS := $(FIRMWARE)/app.lds
|
|
|
|
|
2002-05-17 19:52:56 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
DEFINES := -DDEBUG
|
2002-05-23 14:29:53 +00:00
|
|
|
CFLAGS += -g
|
2002-05-17 19:52:56 +00:00
|
|
|
endif
|
|
|
|
|
2002-05-21 14:33:00 +00:00
|
|
|
SRC := $(wildcard *.c)
|
|
|
|
|
2003-01-16 14:44:08 +00:00
|
|
|
ifeq ($(TARGET), -DARCHOS_FMRECORDER)
|
2003-12-12 13:33:04 +00:00
|
|
|
TOOL_OPT = -fm
|
2003-01-16 14:44:08 +00:00
|
|
|
endif
|
2003-11-19 07:14:19 +00:00
|
|
|
ifeq ($(TARGET), -DARCHOS_RECORDERV2)
|
2003-12-12 13:33:04 +00:00
|
|
|
TOOL_OPT = -v2
|
2003-11-19 06:42:07 +00:00
|
|
|
endif
|
2003-01-16 14:44:08 +00:00
|
|
|
|
2003-01-16 14:36:46 +00:00
|
|
|
ifeq ($(ANYREC), RECORDER)
|
2002-05-21 14:33:00 +00:00
|
|
|
SRC += $(wildcard recorder/*.c)
|
2002-08-28 06:42:43 +00:00
|
|
|
CFLAGS += -Irecorder
|
2002-06-11 10:16:29 +00:00
|
|
|
OUTNAME = ajbrec.ajz
|
2002-05-31 09:16:34 +00:00
|
|
|
else
|
2003-12-12 13:33:04 +00:00
|
|
|
ifeq ($(TARGET), -DARCHOS_PLAYER)
|
2002-09-03 07:39:55 +00:00
|
|
|
SRC += $(wildcard player/*.c)
|
|
|
|
CFLAGS += -Iplayer
|
2002-05-31 09:16:34 +00:00
|
|
|
OUTNAME = archos.mod
|
2003-12-12 13:33:04 +00:00
|
|
|
else
|
|
|
|
# some kind of Neo
|
|
|
|
SRC += $(wildcard neo/*.c)
|
|
|
|
CFLAGS += -Ineo
|
|
|
|
OUTNAME = Rockbox.bin
|
2003-12-12 14:07:28 +00:00
|
|
|
TOOL_OPT = -neo
|
2003-12-12 13:33:04 +00:00
|
|
|
endif
|
2002-05-21 14:33:00 +00:00
|
|
|
endif
|
|
|
|
|
2002-09-18 14:08:05 +00:00
|
|
|
OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o)
|
2002-05-23 13:55:43 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
LINKFILE = $(OBJDIR)/linkage.lds
|
|
|
|
|
2002-10-02 16:47:38 +00:00
|
|
|
ifndef OBJDIR
|
|
|
|
no_configure:
|
|
|
|
@echo "Don't run make here. Run the tools/configure script from your own build"
|
|
|
|
@echo "directory, then run make there."
|
|
|
|
@echo
|
|
|
|
@echo "More help on how to build rockbox can be found here:"
|
|
|
|
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
|
|
|
|
endif
|
|
|
|
|
2003-04-22 22:19:19 +00:00
|
|
|
ifndef TOOLSDIR
|
2003-04-22 22:21:22 +00:00
|
|
|
TOOLSDIR=../tools
|
2003-04-22 22:19:19 +00:00
|
|
|
endif
|
|
|
|
|
2004-03-30 12:00:19 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
all : $(OBJDIR)/rockbox.elf rocks
|
|
|
|
else
|
2003-07-31 21:55:21 +00:00
|
|
|
all : $(OBJDIR)/$(OUTNAME) $(OBJDIR)/rockbox.ucl rocks
|
2004-03-30 12:00:19 +00:00
|
|
|
endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
rocks:
|
2004-05-18 23:17:53 +00:00
|
|
|
$(MAKE) -C plugins/lib TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
|
2003-07-13 22:15:19 +00:00
|
|
|
$(MAKE) -C plugins TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
|
2002-05-23 13:55:43 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/librockbox.a:
|
2002-05-24 10:11:23 +00:00
|
|
|
make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR)
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
# MEM should be passed on to this makefile with the chosen memory size given
|
|
|
|
# in number of MB
|
|
|
|
$(LINKFILE): $(LDS)
|
2004-07-24 19:04:49 +00:00
|
|
|
cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-02-26 09:16:48 +00:00
|
|
|
$(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(OBJDIR)/librockbox.a
|
2003-08-01 01:47:22 +00:00
|
|
|
$(CC) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMWARE) -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
|
2003-08-01 01:47:22 +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
|
|
|
|
|
|
|
$(OBJDIR)/$(OUTNAME) : $(OBJDIR)/rockbox.bin
|
2003-12-12 13:33:04 +00:00
|
|
|
$(TOOLSDIR)/$(TOOL) $(TOOL_OPT) $< $@
|
2002-05-16 12:53:40 +00:00
|
|
|
|
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 \
|
2003-09-29 21:14:43 +00:00
|
|
|
echo uclpack --best --2e $< $@ ; \
|
2003-08-01 02:06:24 +00:00
|
|
|
uclpack --best --2e $< $@ >/dev/null 2>&1; \
|
2003-07-31 21:55:21 +00:00
|
|
|
else \
|
2003-07-31 21:59:06 +00:00
|
|
|
echo "no uclpack command found, makes a fake UCL file"; \
|
|
|
|
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 $@`
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
$(OBJDIR)/%.o: %.c
|
|
|
|
@mkdir -p `dirname $@`
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2003-04-22 22:19:19 +00:00
|
|
|
$(OBJDIR)/build.lang: lang/$(LANGUAGE).lang $(TOOLSDIR)/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
|
|
|
|
perl -s $(TOOLSDIR)/genlang -p=$(OBJDIR)/lang $<
|
2002-09-18 14:08:05 +00:00
|
|
|
$(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@
|
|
|
|
|
2002-05-16 12:53:40 +00:00
|
|
|
clean:
|
2003-02-26 09:16:48 +00:00
|
|
|
-rm -f $(OBJS) $(OBJDIR)/$(OUTNAME) $(OBJDIR)/rockbox.asm \
|
2003-07-24 09:42:59 +00:00
|
|
|
$(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/*.map \
|
2003-01-16 14:36:46 +00:00
|
|
|
$(OBJDIR)/lang.o $(OBJDIR)/build.lang $(OBJDIR)/lang.[ch] \
|
2003-07-24 09:42:59 +00:00
|
|
|
$(OBJDIR)/credits.raw $(LINKFILE) $(OBJDIR)/rockbox.ucl
|
2002-05-24 09:31:45 +00:00
|
|
|
-$(RM) -r $(OBJDIR)/$(DEPS)
|
2003-06-29 16:33:04 +00:00
|
|
|
$(MAKE) -C plugins clean
|
2002-05-16 12:53:40 +00:00
|
|
|
|
|
|
|
DEPS:=.deps
|
2002-09-03 07:39:55 +00:00
|
|
|
DEPDIRS:=$(DEPS)
|
2003-01-16 14:36:46 +00:00
|
|
|
ifeq ($(ANYREC), RECORDER)
|
|
|
|
DEPDIRS += $(DEPS)/recorder
|
2002-09-03 07:39:55 +00:00
|
|
|
else
|
2003-12-12 13:33:04 +00:00
|
|
|
ifeq ($(TARGET), -DARCHOS_PLAYER)
|
2003-01-16 14:36:46 +00:00
|
|
|
DEPDIRS += $(DEPS)/player
|
2003-12-12 13:33:04 +00:00
|
|
|
else
|
|
|
|
# some kind of Neo
|
|
|
|
DEPDIRS += $(DEPS)/neo
|
|
|
|
endif
|
2002-09-03 07:39:55 +00:00
|
|
|
endif
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2002-08-15 09:31:07 +00:00
|
|
|
DIRS = $(subst $(DEPS),".",$(DEPDIRS))
|
|
|
|
|
|
|
|
tags:
|
|
|
|
@$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
|
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
$(OBJDIR)/$(DEPS)/%.d: %.c
|
|
|
|
@$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
|
|
|
|
@echo "Updating dependencies for $(OBJDIR)/$<"
|
2002-05-16 12:53:40 +00:00
|
|
|
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
|
2002-05-23 13:55:43 +00:00
|
|
|
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
|
2002-05-16 12:53:40 +00:00
|
|
|
[ -s $@ ] || rm -f $@'
|
|
|
|
|
2002-10-02 16:47:38 +00:00
|
|
|
ifdef OBJDIR
|
|
|
|
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
|
|
|
|
endif
|