Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
| 7 | # $Id$ |
| 8 | # |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 9 | |
Daniel Stenberg | 9759c03 | 2008-01-23 10:59:17 +0000 | [diff] [blame] | 10 | ifeq ($(MODELNAME),ifp7xx) |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 11 | |
| 12 | INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \ |
| 13 | -I$(BUILDDIR) |
| 14 | |
| 15 | DEPFILE = $(OBJDIR)/dep-stub |
| 16 | LDS := linker.cfg |
| 17 | |
| 18 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - ) |
| 19 | DIRS = . |
| 20 | |
| 21 | ifdef APPEXTRA |
| 22 | DIRS += $(subst :, ,$(APPEXTRA)) |
| 23 | INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA))) |
| 24 | endif |
| 25 | |
| 26 | ifndef VERSION |
| 27 | VERSION=$(shell date +%y%m%d-%H%M) |
| 28 | endif |
| 29 | |
| 30 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \ |
| 31 | -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} |
| 32 | |
| 33 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
| 34 | SOURCES = $(SRC) |
| 35 | LINKFILE = $(OBJDIR)/linkage.lds |
| 36 | |
| 37 | LIBROCKBOX = $(BUILDDIR)/librockbox.a |
| 38 | |
| 39 | all: $(BUILDDIR)/$(BINARY) $(FLASHFILE) |
| 40 | |
| 41 | dep: $(DEPFILE) |
| 42 | |
| 43 | $(LINKFILE): $(LDS) |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 44 | $(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@ |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 45 | |
| 46 | $(OBJDIR)/stub.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 47 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/stub.map |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 48 | |
| 49 | $(OBJDIR)/stub.bin : $(OBJDIR)/stub.elf |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 50 | $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 51 | |
| 52 | $(BUILDDIR)/$(BINARY) : $(OBJDIR)/stub.bin |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 53 | $(call PRINTS,Build stub file)$(MKFIRMWARE) $< $@ |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 54 | |
| 55 | include $(TOOLSDIR)/make.inc |
| 56 | |
| 57 | clean: |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 58 | $(call PRINTS,cleaning stub)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) \ |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 59 | $(OBJDIR)/stub.bin $(OBJDIR)/stub.elf $(OBJDIR)/*.map \ |
| 60 | $(LINKFILE) $(DEPFILE) |
| 61 | |
| 62 | -include $(DEPFILE) |
| 63 | |
| 64 | else # not ifp7xx |
| 65 | |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 66 | ifdef RECORDER |
| 67 | EXTRA = -DRECORDER |
| 68 | EXT = ajz |
| 69 | else |
| 70 | EXT = mod |
| 71 | endif |
| 72 | |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 73 | TARGET = stub |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 74 | OBJS = start.o sh-stub.o setjmp.o |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 75 | LIBS = -lgcc |
| 76 | |
| 77 | .s.o: |
| 78 | sh-elf-as -o $@ $< |
| 79 | |
| 80 | .c.o: |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 81 | sh-elf-gcc -O $(EXTRA) -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $< |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 82 | |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 83 | .S.o: |
| 84 | sh-elf-gcc -O -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $< |
| 85 | |
| 86 | $(TARGET).$(EXT): $(TARGET).elf |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 87 | sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 88 | ../tools/scramble $(TARGET).out $(TARGET).$(EXT) |
Jörg Hohensohn | 09e42d5 | 2003-06-29 21:56:32 +0000 | [diff] [blame] | 89 | ../tools/sh2d $(TARGET).out -o 09000000 > $(TARGET).asm |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 90 | |
| 91 | $(TARGET).elf: $(OBJS) |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 92 | sh-elf-gcc -nostartfiles $(OBJS) -nostdlib -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 93 | |
| 94 | clean: |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 95 | rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out $(TARGET).mod $(TARGET).ajz |
Björn Stenberg | d42d78f | 2002-04-15 08:35:08 +0000 | [diff] [blame] | 96 | |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 97 | start.o: start.s |
Linus Nielsen Feltzing | 7958ea4 | 2002-05-11 20:04:48 +0000 | [diff] [blame] | 98 | sh-stub.o: sh-stub.c |
Linus Nielsen Feltzing | 1dc42d1 | 2003-05-17 00:31:50 +0000 | [diff] [blame] | 99 | setjmp.o: setjmp.S |
Tomasz Malesinski | 2aabc87 | 2006-01-25 01:43:07 +0000 | [diff] [blame] | 100 | |
| 101 | endif |