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
|
|
|
|
|
|
|
|
FIRMWARE := ../firmware
|
|
|
|
|
|
|
|
INCLUDES= -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers
|
|
|
|
|
|
|
|
# Pick a target to build for
|
2002-05-17 19:52:56 +00:00
|
|
|
#TARGET = -DARCHOS_PLAYER=1
|
|
|
|
TARGET = -DARCHOS_PLAYER_OLD=1
|
2002-05-16 12:53:40 +00:00
|
|
|
#TARGET = -DARCHOS_RECORDER=1
|
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
# store output files in this directory:
|
|
|
|
OBJDIR = .
|
|
|
|
|
2002-05-23 14:29:53 +00:00
|
|
|
CFLAGS = -O -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES)
|
|
|
|
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
|
|
|
|
LDS := $(FIRMWARE)/app.lds
|
|
|
|
endif
|
|
|
|
|
2002-05-21 14:33:00 +00:00
|
|
|
SRC := $(wildcard *.c)
|
|
|
|
|
|
|
|
ifeq ($(TARGET),-DARCHOS_RECORDER)
|
|
|
|
SRC += $(wildcard recorder/*.c)
|
2002-05-24 09:00:37 +00:00
|
|
|
CFLAGS += -Irecorder
|
2002-05-21 14:33:00 +00:00
|
|
|
endif
|
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
|
|
|
|
|
|
|
all : $(OBJDIR)/archos.mod # archos.asm
|
|
|
|
|
|
|
|
$(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-24 09:00:37 +00:00
|
|
|
$(CC) -Os -nostdlib -o $(OBJDIR)/archos.elf $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -lc -L$(FIRMWARE) -T$(LDS) -Wl,-Map,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-23 13:55:43 +00:00
|
|
|
$(OBJDIR)/archos.mod : $(OBJDIR)/archos.bin
|
|
|
|
../tools/scramble $(OBJDIR)/archos.bin $(OBJDIR)/archos.mod
|
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
|
|
|
|
|
|
|
dist:
|
|
|
|
tar czvf dist.tar.gz Makefile main.c start.s app.lds
|
|
|
|
|
|
|
|
clean:
|
2002-05-24 09:31:45 +00:00
|
|
|
-rm -f $(OBJS) $(OBJDIR)/archos.mod $(OBJDIR)/archos.asm \
|
|
|
|
$(OBJDIR)/archos.bin $(OBJDIR)/archos.elf
|
|
|
|
-$(RM) -r $(OBJDIR)/$(DEPS)
|
2002-05-16 12:53:40 +00:00
|
|
|
|
|
|
|
DEPS:=.deps
|
2002-05-23 13:55:43 +00:00
|
|
|
DEPDIRS:=$(DEPS) $(DEPS)/recorder
|
2002-05-16 12:53:40 +00:00
|
|
|
|
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)
|