2002-04-15 08:35:08 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
2003-05-17 00:31:50 +00:00
|
|
|
|
2008-01-23 10:59:17 +00:00
|
|
|
ifeq ($(MODELNAME),ifp7xx)
|
2006-01-25 01:43:07 +00:00
|
|
|
|
|
|
|
INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
|
|
|
|
-I$(BUILDDIR)
|
|
|
|
|
|
|
|
DEPFILE = $(OBJDIR)/dep-stub
|
|
|
|
LDS := linker.cfg
|
|
|
|
|
|
|
|
SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - )
|
|
|
|
DIRS = .
|
|
|
|
|
|
|
|
ifdef APPEXTRA
|
|
|
|
DIRS += $(subst :, ,$(APPEXTRA))
|
|
|
|
INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef VERSION
|
|
|
|
VERSION=$(shell date +%y%m%d-%H%M)
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
|
|
|
|
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
|
|
|
|
|
|
|
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
|
|
|
SOURCES = $(SRC)
|
|
|
|
LINKFILE = $(OBJDIR)/linkage.lds
|
|
|
|
|
|
|
|
LIBROCKBOX = $(BUILDDIR)/librockbox.a
|
|
|
|
|
|
|
|
all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
|
|
|
|
|
|
|
|
dep: $(DEPFILE)
|
|
|
|
|
|
|
|
$(LINKFILE): $(LDS)
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
|
2006-01-25 01:43:07 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/stub.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX)
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/stub.map
|
2006-01-25 01:43:07 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/stub.bin : $(OBJDIR)/stub.elf
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
|
2006-01-25 01:43:07 +00:00
|
|
|
|
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJDIR)/stub.bin
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,Build stub file)$(MKFIRMWARE) $< $@
|
2006-01-25 01:43:07 +00:00
|
|
|
|
|
|
|
include $(TOOLSDIR)/make.inc
|
|
|
|
|
|
|
|
clean:
|
2006-10-30 01:40:20 +00:00
|
|
|
$(call PRINTS,cleaning stub)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) \
|
2006-01-25 01:43:07 +00:00
|
|
|
$(OBJDIR)/stub.bin $(OBJDIR)/stub.elf $(OBJDIR)/*.map \
|
|
|
|
$(LINKFILE) $(DEPFILE)
|
|
|
|
|
|
|
|
-include $(DEPFILE)
|
|
|
|
|
|
|
|
else # not ifp7xx
|
|
|
|
|
2003-05-17 00:31:50 +00:00
|
|
|
ifdef RECORDER
|
|
|
|
EXTRA = -DRECORDER
|
|
|
|
EXT = ajz
|
|
|
|
else
|
|
|
|
EXT = mod
|
|
|
|
endif
|
|
|
|
|
2002-04-15 08:35:08 +00:00
|
|
|
TARGET = stub
|
2003-05-17 00:31:50 +00:00
|
|
|
OBJS = start.o sh-stub.o setjmp.o
|
2002-04-15 08:35:08 +00:00
|
|
|
LIBS = -lgcc
|
|
|
|
|
|
|
|
.s.o:
|
|
|
|
sh-elf-as -o $@ $<
|
|
|
|
|
|
|
|
.c.o:
|
2003-05-17 00:31:50 +00:00
|
|
|
sh-elf-gcc -O $(EXTRA) -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
|
|
|
|
|
|
|
|
.S.o:
|
|
|
|
sh-elf-gcc -O -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
|
2002-04-15 08:35:08 +00:00
|
|
|
|
2003-05-17 00:31:50 +00:00
|
|
|
$(TARGET).$(EXT): $(TARGET).elf
|
2002-04-15 08:35:08 +00:00
|
|
|
sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out
|
2003-05-17 00:31:50 +00:00
|
|
|
../tools/scramble $(TARGET).out $(TARGET).$(EXT)
|
2003-06-29 21:56:32 +00:00
|
|
|
../tools/sh2d $(TARGET).out -o 09000000 > $(TARGET).asm
|
2002-04-15 08:35:08 +00:00
|
|
|
|
|
|
|
$(TARGET).elf: $(OBJS)
|
2003-05-17 00:31:50 +00:00
|
|
|
sh-elf-gcc -nostartfiles $(OBJS) -nostdlib -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg
|
2002-04-15 08:35:08 +00:00
|
|
|
|
|
|
|
clean:
|
2003-05-17 00:31:50 +00:00
|
|
|
rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out $(TARGET).mod $(TARGET).ajz
|
2002-04-15 08:35:08 +00:00
|
|
|
|
2006-01-25 01:43:07 +00:00
|
|
|
start.o: start.s
|
2002-05-11 20:04:48 +00:00
|
|
|
sh-stub.o: sh-stub.c
|
2003-05-17 00:31:50 +00:00
|
|
|
setjmp.o: setjmp.S
|
2006-01-25 01:43:07 +00:00
|
|
|
|
|
|
|
endif
|