2002-03-28 15:09:10 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2002-05-23 12:25:52 +00:00
|
|
|
CC = sh-elf-gcc
|
2002-04-22 20:55:37 +00:00
|
|
|
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-23 11:46:15 +00:00
|
|
|
# store output files in this directory:
|
|
|
|
OBJDIR = .
|
|
|
|
|
2002-05-17 17:06:02 +00:00
|
|
|
CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET)
|
2002-05-17 07:52:28 +00:00
|
|
|
|
|
|
|
ifdef DEBUG
|
2002-05-17 17:06:02 +00:00
|
|
|
CFLAGS += -g -DDEBUG
|
2002-05-17 07:52:28 +00:00
|
|
|
else
|
2002-05-17 17:06:02 +00:00
|
|
|
CFLAGS += -fomit-frame-pointer -fschedule-insns
|
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-23 11:46:15 +00:00
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/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-23 11:46:15 +00:00
|
|
|
OUTPUT = $(OBJDIR)/librockbox.a
|
|
|
|
|
|
|
|
$(OUTPUT): $(OBJS)
|
2002-05-14 13:45:58 +00:00
|
|
|
$(AR) ruv $@ $+
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2002-05-23 12:35:10 +00:00
|
|
|
$(OBJDIR)/%.o: %.c
|
|
|
|
@mkdir -p `dirname $@`
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
2002-05-23 12:00:50 +00:00
|
|
|
|
2002-03-28 15:09:10 +00:00
|
|
|
clean:
|
2002-05-24 09:33:03 +00:00
|
|
|
rm -f $(OBJS) $(OUTPUT)
|
|
|
|
rm -rf $(OBJDIR)/$(DEPS)
|
2002-04-28 09:53:39 +00:00
|
|
|
|
2002-05-17 09:28:07 +00:00
|
|
|
# Special targets
|
2002-05-23 11:46:15 +00:00
|
|
|
$(OBJDIR)/thread.o: thread.c thread.h
|
|
|
|
$(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@
|
2002-05-17 09:28:07 +00:00
|
|
|
|
2002-05-23 12:44:41 +00:00
|
|
|
$(OBJDIR)/crt0.o: crt0.S
|
|
|
|
$(AS) $(AFLAGS) -o $@ $<
|
|
|
|
|
2002-05-23 12:00:50 +00:00
|
|
|
$(OBJDIR)/$(DEPS)/%.d: %.c
|
2002-05-23 12:25:52 +00:00
|
|
|
@$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
|
2002-04-28 09:53:39 +00:00
|
|
|
@echo "Updating dependencies for $<"
|
|
|
|
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
|
2002-05-23 11:46:15 +00:00
|
|
|
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
|
2002-04-28 09:53:39 +00:00
|
|
|
[ -s $@ ] || rm -f $@'
|
|
|
|
|
2002-05-23 12:00:50 +00:00
|
|
|
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
|