2002-03-28 15:09:10 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2002-04-22 20:55:37 +00:00
|
|
|
CC = sh-elf-gcc
|
|
|
|
LD = sh-elf-ld
|
|
|
|
AR = sh-elf-ar
|
|
|
|
AS = sh-elf-as
|
|
|
|
OC = sh-elf-objcopy
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2002-04-23 11:44:06 +00:00
|
|
|
INCLUDES=-I. -Icommon -Idrivers
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2002-04-16 14:04:34 +00:00
|
|
|
# Pick a target to build for
|
|
|
|
TARGET = -DARCHOS_PLAYER=1
|
|
|
|
#TARGET = -DARCHOS_PLAYER_OLD=1
|
|
|
|
#TARGET = -DARCHOS_RECORDER=1
|
|
|
|
|
2002-05-02 14:05:51 +00:00
|
|
|
CFLAGS = -Os -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) -DDEBUG
|
2002-03-28 15:09:10 +00:00
|
|
|
AFLAGS += -small -relax
|
|
|
|
|
2002-04-23 11:44:06 +00:00
|
|
|
SRC := $(wildcard drivers/*.c common/*.c *.c)
|
2002-05-02 14:05:51 +00:00
|
|
|
OBJS := $(SRC:%.c=%.o) crt0.o
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2002-04-18 20:01:44 +00:00
|
|
|
all : archos.mod # archos.asm
|
2002-03-28 15:09:10 +00:00
|
|
|
|
|
|
|
archos.elf : $(OBJS) app.lds
|
2002-05-02 11:44:15 +00:00
|
|
|
$(CC) -nostdlib -o archos.elf $(OBJS) -lgcc -lc -Tapp.lds -Wl,-Map,archos.map
|
2002-03-28 15:09:10 +00:00
|
|
|
|
|
|
|
archos.bin : archos.elf
|
|
|
|
$(OC) -O binary archos.elf archos.bin
|
|
|
|
|
|
|
|
archos.asm: archos.bin
|
2002-05-03 11:59:53 +00:00
|
|
|
../tools/sh2d -sh1 archos.bin > archos.asm
|
2002-03-28 15:09:10 +00:00
|
|
|
|
|
|
|
archos.mod : archos.bin
|
2002-05-03 11:59:53 +00:00
|
|
|
../tools/scramble archos.bin archos.mod
|
2002-03-28 15:09:10 +00:00
|
|
|
|
|
|
|
dist:
|
|
|
|
tar czvf dist.tar.gz Makefile main.c start.s app.lds
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -f *.x *.i *.o *.elf *.bin *.map *.mod *.bak *~
|
2002-04-28 09:53:39 +00:00
|
|
|
-$(RM) -r $(DEPS)
|
|
|
|
|
|
|
|
DEPS:=.deps
|
|
|
|
DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common
|
|
|
|
|
|
|
|
$(DEPS)/%.d: %.c
|
|
|
|
@$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $$d ]; then mkdir $$d; fi; }; done'
|
|
|
|
@echo "Updating dependencies for $<"
|
|
|
|
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
|
|
|
|
|sed '\''s|\($*\)\.o[ :]*|\1.o $(<:%.c=%.d) : |g'\'' > $@; \
|
|
|
|
[ -s $@ ] || rm -f $@'
|
|
|
|
|
|
|
|
-include $(SRC:%.c=$(DEPS)/%.d)
|