2003-06-29 16:33:04 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
CC = sh-elf-gcc
|
|
|
|
OC = sh-elf-objcopy
|
|
|
|
|
|
|
|
FIRMWARE = ../../firmware
|
|
|
|
|
2004-05-18 23:17:53 +00:00
|
|
|
INCLUDES = -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I$(FIRMWARE)/common \
|
|
|
|
-I$(FIRMWARE)/drivers -I.. -Ilib
|
|
|
|
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
|
|
|
|
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2003-07-13 22:15:19 +00:00
|
|
|
LDS := plugin.lds
|
|
|
|
LINKFILE := $(OBJDIR)/pluginlink.lds
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
SRC := $(wildcard *.c)
|
|
|
|
ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock)
|
|
|
|
|
|
|
|
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"
|
|
|
|
endif
|
|
|
|
|
2004-05-18 23:17:53 +00:00
|
|
|
$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(OBJDIR)/libplugin.a
|
|
|
|
$(CC) -O -nostdlib -o $@ $< -L$(OBJDIR) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/%.rock : $(OBJDIR)/%.elf
|
|
|
|
$(OC) -O binary $< $@
|
|
|
|
|
|
|
|
$(OBJDIR)/%.o: %.c ../plugin.h Makefile
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2004-05-18 23:17:53 +00:00
|
|
|
all: $(OBJDIR)/libplugin.a $(ROCKS)
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
$(OBJDIR)/libplugin.a:
|
|
|
|
$(MAKE) -C lib TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2003-07-13 22:15:19 +00:00
|
|
|
# MEM should be passed on to this makefile with the chosen memory size given
|
|
|
|
# in number of MB
|
|
|
|
$(LINKFILE): $(LDS)
|
2003-11-28 12:06:47 +00:00
|
|
|
$(CC) -DMEMORYSIZE=$(MEM) $(DEFINES) -x c -E -P $< >$@
|
2003-07-13 22:15:19 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
clean:
|
2003-07-20 09:29:28 +00:00
|
|
|
-rm -f $(ROCKS) $(LINKFILE)
|
2004-05-18 23:17:53 +00:00
|
|
|
$(MAKE) -C lib clean
|