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-17 07:52:28 +00:00
|
|
|
CFLAGS = -W -Wall -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET)
|
|
|
|
|
|
|
|
ifdef DEBUG
|
2002-05-17 09:28:07 +00:00
|
|
|
CFLAGS += -O -g -DDEBUG
|
2002-05-17 07:52:28 +00:00
|
|
|
else
|
2002-05-17 09:28:07 +00:00
|
|
|
CFLAGS += -O -fomit-frame-pointer -fschedule-insns -save-temps
|
2002-05-17 07:52:28 +00:00
|
|
|
endif
|
|
|
|
|
2002-03-28 15:09:10 +00:00
|
|
|
AFLAGS += -small -relax
|
|
|
|
|
2002-05-14 13:45:58 +00:00
|
|
|
SRC := $(wildcard drivers/*.c common/*.c malloc/*.c *.c)
|
2002-05-17 07:52:28 +00:00
|
|
|
|
2002-05-17 09:28:07 +00:00
|
|
|
OBJS := $(SRC:%.c=%.o) crt0.o
|
2002-05-14 13:45:58 +00:00
|
|
|
DEPS:=.deps
|
|
|
|
DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2002-05-14 13:45:58 +00:00
|
|
|
librockbox.a: $(OBJS)
|
|
|
|
$(AR) ruv $@ $+
|
2002-03-28 15:09:10 +00:00
|
|
|
|
|
|
|
clean:
|
2002-05-14 13:45:58 +00:00
|
|
|
-rm -f $(OBJS) *.x *.i *.o *.elf *.bin *.map *.mod *.bak *~
|
2002-04-28 09:53:39 +00:00
|
|
|
-$(RM) -r $(DEPS)
|
|
|
|
|
2002-05-17 09:28:07 +00:00
|
|
|
# Special targets
|
|
|
|
thread.o: thread.c thread.h
|
|
|
|
$(CC) -c -O -fomit-frame-pointer $(CFLAGS) $<
|
|
|
|
|
2002-04-28 09:53:39 +00:00
|
|
|
$(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)
|