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
|
|
|
|
|
2002-05-24 15:39:18 +00:00
|
|
|
INCLUDES= -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers -I$(FIRMWARE)/malloc
|
2002-05-16 12:53:40 +00:00
|
|
|
|
|
|
|
# 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-06-11 10:16:29 +00:00
|
|
|
OUTNAME = ajbrec.ajz
|
2002-05-31 09:16:34 +00:00
|
|
|
else
|
|
|
|
OUTNAME = archos.mod
|
2002-05-21 14:33:00 +00:00
|
|
|
endif
|
|
|
|
|
2002-05-23 13:55:43 +00:00
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
|
|
|
|
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
|
|
|
|
|
|
|
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-05-27 07:29:20 +00:00
|
|
|
$(OBJDIR)/archos.bin $(OBJDIR)/archos.elf $(OBJDIR)/archos.map
|
2002-05-24 09:31:45 +00:00
|
|
|
-$(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)
|