Theme Editor: Corrected last commit. Touch areas should have been made relative...
[kugel-rb.git] / gdb / Makefile
blob0cd9990cd116b23c312f6d51d191cfe3c06a738a
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 ifeq ($(MODELNAME),ifp7xx)
12 INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
13 -I$(BUILDDIR)
15 DEPFILE = $(OBJDIR)/dep-stub
16 LDS := linker.cfg
18 SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - )
19 DIRS = .
21 ifdef APPEXTRA
22 DIRS += $(subst :, ,$(APPEXTRA))
23 INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
24 endif
26 ifndef VERSION
27 VERSION=$(shell date +%y%m%d-%H%M)
28 endif
30 CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
31 $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
33 OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
34 SOURCES = $(SRC)
35 LINKFILE = $(OBJDIR)/linkage.lds
37 LIBROCKBOX = $(BUILDDIR)/librockbox.a
39 all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
41 dep: $(DEPFILE)
43 $(LINKFILE): $(LDS)
44 $(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
46 $(OBJDIR)/stub.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX)
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
49 $(OBJDIR)/stub.bin : $(OBJDIR)/stub.elf
50 $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
52 $(BUILDDIR)/$(BINARY) : $(OBJDIR)/stub.bin
53 $(call PRINTS,Build stub file)$(MKFIRMWARE) $< $@
55 include $(TOOLSDIR)/make.inc
57 clean:
58 $(call PRINTS,cleaning stub)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) \
59 $(OBJDIR)/stub.bin $(OBJDIR)/stub.elf $(OBJDIR)/*.map \
60 $(LINKFILE) $(DEPFILE)
62 -include $(DEPFILE)
64 else # not ifp7xx
66 ifdef RECORDER
67 EXTRA = -DRECORDER
68 EXT = ajz
69 else
70 EXT = mod
71 endif
73 TARGET = stub
74 OBJS = start.o sh-stub.o setjmp.o
75 LIBS = -lgcc
77 .s.o:
78 sh-elf-as -o $@ $<
80 .c.o:
81 sh-elf-gcc -O $(EXTRA) -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
83 .S.o:
84 sh-elf-gcc -O -I../firmware/export -I../firmware/include -m1 -Wall -Wstrict-prototypes -c -o $@ $<
86 $(TARGET).$(EXT): $(TARGET).elf
87 sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out
88 ../tools/scramble $(TARGET).out $(TARGET).$(EXT)
89 ../tools/sh2d $(TARGET).out -o 09000000 > $(TARGET).asm
91 $(TARGET).elf: $(OBJS)
92 sh-elf-gcc -nostartfiles $(OBJS) -nostdlib -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg
94 clean:
95 rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out $(TARGET).mod $(TARGET).ajz
97 start.o: start.s
98 sh-stub.o: sh-stub.c
99 setjmp.o: setjmp.S
101 endif