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
|
|
|
|
2003-02-07 09:41:57 +00:00
|
|
|
INCLUDES=-Iinclude -I. -Iexport -Icommon -Idrivers
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2003-03-03 13:17:49 +00:00
|
|
|
CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
|
2002-05-17 07:52:28 +00:00
|
|
|
|
2003-03-04 05:49:53 +00:00
|
|
|
ifndef MEM
|
|
|
|
# if MEM is not set, assume 2MB
|
|
|
|
MEM=2
|
|
|
|
endif
|
|
|
|
|
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-08-20 14:00:42 +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-08-20 14:22:11 +00:00
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/crt0.o $(OBJDIR)/bitswap.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-08-15 09:30:41 +00:00
|
|
|
DIRS = $(subst $(DEPS),".",$(DEPDIRS))
|
|
|
|
|
2002-05-23 11:46:15 +00:00
|
|
|
OUTPUT = $(OBJDIR)/librockbox.a
|
|
|
|
|
2002-09-20 08:07:51 +00:00
|
|
|
ifeq (RECORDER,$(findstring RECORDER, $(CFLAGS)))
|
|
|
|
OBJS += $(OBJDIR)/sysfont.o
|
2002-08-11 09:17:47 +00:00
|
|
|
endif
|
|
|
|
|
2002-10-02 16:47:38 +00:00
|
|
|
ifndef OBJDIR
|
|
|
|
no_configure:
|
|
|
|
@echo "Don't run make here. Run the tools/configure script from your own build"
|
|
|
|
@echo "directory, then run make there."
|
|
|
|
@echo
|
|
|
|
@echo "More help on how to build rockbox can be found here:"
|
|
|
|
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
|
2003-04-22 22:20:00 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef TOOLSDIR
|
2003-04-22 22:22:07 +00:00
|
|
|
TOOLSDIR=../tools
|
2002-10-02 16:47:38 +00:00
|
|
|
endif
|
|
|
|
|
2003-07-10 11:52:42 +00:00
|
|
|
all: $(TOOLSDIR)/convbdf $(OUTPUT) $(EXTRA_TARGETS)
|
|
|
|
|
|
|
|
$(TOOLSDIR)/convbdf:
|
|
|
|
$(MAKE) -C $(TOOLSDIR)
|
2002-08-15 11:35:14 +00:00
|
|
|
|
|
|
|
$(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-05-24 16:20:49 +00:00
|
|
|
$(OBJDIR)/%.o: %.S
|
|
|
|
@mkdir -p `dirname $@`
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2002-08-15 09:30:41 +00:00
|
|
|
tags:
|
|
|
|
@$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
|
|
|
|
|
2002-03-28 15:09:10 +00:00
|
|
|
clean:
|
2002-09-21 08:43:57 +00:00
|
|
|
rm -f $(OBJS) $(OUTPUT) $(OBJDIR)/sysfont.c
|
2002-05-24 09:33:03 +00:00
|
|
|
rm -rf $(OBJDIR)/$(DEPS)
|
2002-04-28 09:53:39 +00:00
|
|
|
|
2002-05-17 09:28:07 +00:00
|
|
|
# Special targets
|
2003-02-07 09:41:57 +00:00
|
|
|
$(OBJDIR)/thread.o: thread.c export/thread.h
|
2002-05-23 11:46:15 +00:00
|
|
|
$(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@
|
2002-05-17 09:28:07 +00:00
|
|
|
|
2002-09-20 08:07:51 +00:00
|
|
|
$(OBJDIR)/sysfont.o: fonts/clR6x8.bdf
|
|
|
|
$(TOOLSDIR)/convbdf -c -o $(OBJDIR)/sysfont.c $<
|
|
|
|
$(CC) $(CFLAGS) -c $(OBJDIR)/sysfont.c -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-10-02 16:47:38 +00:00
|
|
|
ifdef OBJDIR
|
|
|
|
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
|
|
|
|
endif
|
|
|
|
|