2002-05-16 12:53:40 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
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-09-18 14:08:05 +00:00
|
|
|
INCLUDES= -I$(FIRMWARE)/include -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I$(FIRMWARE)/malloc -I. -I$(OBJDIR)
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2002-09-30 14:42:31 +00:00
|
|
|
ifndef OBJDIR
|
|
|
|
"Don't run make in the apps dir!"
|
|
|
|
endif
|
2002-05-23 13:55:43 +00:00
|
|
|
|
2002-08-20 14:00:42 +00:00
|
|
|
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES)
|
2002-05-23 14:29:53 +00:00
|
|
|
AFLAGS += -small -relax
|
|
|
|
|
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
|
|
|
LDS := $(FIRMWARE)/gdb.lds
|
|
|
|
else
|
2002-06-17 06:49:29 +00:00
|
|
|
ifeq ($(TARGET),-DARCHOS_RECORDER)
|
2002-05-17 19:52:56 +00:00
|
|
|
LDS := $(FIRMWARE)/app.lds
|
2002-06-17 06:49:29 +00:00
|
|
|
else
|
|
|
|
LDS := $(FIRMWARE)/player.lds
|
|
|
|
endif
|
2002-05-17 19:52:56 +00:00
|
|
|
endif
|
|
|
|
|
2002-05-21 14:33:00 +00:00
|
|
|
SRC := $(wildcard *.c)
|
|
|
|
|
|
|
|
ifeq ($(TARGET),-DARCHOS_RECORDER)
|
|
|
|
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
|
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
|
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
|
|
|
|
2002-05-31 09:16:34 +00:00
|
|
|
all : $(OBJDIR)/$(OUTNAME)
|
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
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
$(OBJDIR)/archos.elf : $(OBJS) $(LDS) $(OBJDIR)/librockbox.a
|
2002-05-30 21:04:40 +00:00
|
|
|
$(CC) -Os -nostdlib -o $(OBJDIR)/archos.elf $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMWARE) -T$(LDS) -Wl,-Map,$(OBJDIR)/archos.map
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
$(OBJDIR)/archos.bin : $(OBJDIR)/archos.elf
|
|
|
|
$(OC) -O binary $(OBJDIR)/archos.elf $(OBJDIR)/archos.bin
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
$(OBJDIR)/archos.asm: $(OBJDIR)/archos.bin
|
|
|
|
../tools/sh2d -sh1 $(OBJDIR)/archos.bin > $(OBJDIR)/archos.asm
|
2002-05-16 12:53:40 +00:00
|
|
|
|
2002-05-31 09:16:34 +00:00
|
|
|
$(OBJDIR)/$(OUTNAME) : $(OBJDIR)/archos.bin
|
|
|
|
../tools/scramble $(OBJDIR)/archos.bin $(OBJDIR)/$(OUTNAME)
|
2002-05-16 12:53:40 +00:00
|
|
|
|
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
|
|
|
|
2002-09-20 06:40:13 +00:00
|
|
|
$(OBJDIR)/build.lang: lang/$(LANGUAGE).lang
|
2002-09-20 14:59:44 +00:00
|
|
|
perl ../tools/uplang lang/english.lang $< > $@
|
2002-09-20 06:40:13 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/lang.o: $(OBJDIR)/build.lang
|
2002-09-20 15:34:19 +00:00
|
|
|
perl -s ../tools/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
|
|
|
dist:
|
|
|
|
tar czvf dist.tar.gz Makefile main.c start.s app.lds
|
|
|
|
|
|
|
|
clean:
|
2002-05-31 09:16:34 +00:00
|
|
|
-rm -f $(OBJS) $(OBJDIR)/$(OUTNAME) $(OBJDIR)/archos.asm \
|
2002-09-20 15:34:19 +00:00
|
|
|
$(OBJDIR)/archos.bin $(OBJDIR)/archos.elf $(OBJDIR)/archos.map \
|
|
|
|
$(OBJDIR)/lang.o $(OBJDIR)/build.lang $(OBJDIR)/lang.[ch]
|
2002-05-24 09:31:45 +00:00
|
|
|
-$(RM) -r $(OBJDIR)/$(DEPS)
|
2002-05-16 12:53:40 +00:00
|
|
|
|
|
|
|
DEPS:=.deps
|
2002-09-03 07:39:55 +00:00
|
|
|
DEPDIRS:=$(DEPS)
|
|
|
|
ifeq ($(TARGET),-DARCHOS_RECORDER)
|
|
|
|
DEPDIRS += $(DEPS)/recorder
|
|
|
|
else
|
|
|
|
DEPDIRS += $(DEPS)/player
|
|
|
|
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-05-23 13:55:43 +00:00
|
|
|
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
|