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
|
|
|
|
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)
|
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
|
|
|
# set the ROMTARGET here
|
|
|
|
ROMTARGET := $(ARCHOSROM)
|
2003-01-16 14:44:08 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
ifdef APPEXTRA
|
|
|
|
SRC += $(wildcard $(APPEXTRA)/*.c)
|
|
|
|
DIRS += $(APPEXTRA)
|
|
|
|
INCLUDES += -I$(APPEXTRA)
|
2004-09-09 06:01:46 +00:00
|
|
|
endif
|
2002-05-21 14:33:00 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
|
|
|
|
-fomit-frame-pointer -fschedule-insns $(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
|
|
|
|
|
2004-03-30 12:00:19 +00:00
|
|
|
ifdef DEBUG
|
2004-09-22 08:58:50 +00:00
|
|
|
all: $(OBJDIR)/rockbox.elf rocks
|
2004-03-30 12:00:19 +00:00
|
|
|
else
|
2004-09-22 08:58:50 +00:00
|
|
|
all: $(OBJDIR)/$(BINARY) $(OBJDIR)/rockbox.ucl rocks $(ROMTARGET)
|
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)
|
|
|
|
|
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"
|
|
|
|
@cat $< | $(CC) -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-09-22 08:58:50 +00:00
|
|
|
@$(CC) -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
|
|
|
|
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"
|
2004-09-22 08:58:50 +00:00
|
|
|
@$(CC) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMDIR) -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
|
|
|
|
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-09-22 08:58:50 +00:00
|
|
|
$(ARCHOSROM): $(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
|
2004-09-22 08:58:50 +00:00
|
|
|
@rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2004-09-22 08:58:50 +00:00
|
|
|
-include $(DEPFILE)
|