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-06-17 13:20:03 +00:00
|
|
|
INCLUDES=-Iinclude -I. -Icommon -Idrivers
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2002-08-11 09:17:47 +00:00
|
|
|
SYSTEM_FONT = fonts/alt6x10.bdf
|
|
|
|
|
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-08-11 09:17:47 +00:00
|
|
|
CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
|
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-08-13 23:13:01 +00:00
|
|
|
SRC := $(wildcard drivers/*.c common/*.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
|
|
|
|
|
2002-08-11 09:17:47 +00:00
|
|
|
ifdef LOADABLE_FONTS
|
|
|
|
EXTRA_TARGETS = $(OBJDIR)/system.ajf
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(OUTPUT): $(OBJS) $(EXTRA_TARGETS)
|
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-05-24 16:20:49 +00:00
|
|
|
$(OBJDIR)/%.o: %.S
|
|
|
|
@mkdir -p `dirname $@`
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2002-08-11 09:17:47 +00:00
|
|
|
$(OBJDIR)/system.ajf: ../tools/bdf2ajf $(SYSTEM_FONT)
|
|
|
|
../tools/bdf2ajf -f $(SYSTEM_FONT) -o $(OBJDIR)/system.ajf
|
|
|
|
|
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: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)
|