summaryrefslogtreecommitdiffstats
path: root/gdb/Makefile
blob: 21c0cf83419b0b762de902289fe26a5b5c5b960e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/
# $Id$
#

ifdef RECORDER
EXTRA = -DRECORDER
EXT = ajz
else
EXT = mod
endif

TARGET = stub
OBJS = start.o sh-stub.o setjmp.o
LIBS = -lgcc

.s.o:
	sh-elf-as -o $@ $<

.c.o:
	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 $@ $<

$(TARGET).$(EXT): $(TARGET).elf
	sh-elf-objcopy -O binary $(TARGET).elf $(TARGET).out
	../tools/scramble $(TARGET).out $(TARGET).$(EXT)

$(TARGET).elf: $(OBJS)
	sh-elf-gcc -nostartfiles $(OBJS) -nostdlib -Wl,-Map,$(TARGET).map -o $(TARGET).elf -Tlinker.cfg

clean:
	rm $(OBJS) $(TARGET).map $(TARGET).elf $(TARGET).out $(TARGET).mod $(TARGET).ajz

start.o: start.s
sh-stub.o: sh-stub.c
setjmp.o: setjmp.S