-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (48 loc) · 1.46 KB
/
Makefile
File metadata and controls
60 lines (48 loc) · 1.46 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ifndef CROSS_COMPILE
CROSS_COMPILE = or32-uclinux-
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
NM = $(CROSS_COMPILE)nm
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
endif
SREC2MIF = ./srec2mif.pl
SREC2RTL = ./srec2rtl.pl
export CROSS_COMPILE
.SUFFIXES: .or32
all: hello.or32
reset.o: reset.S Makefile board.h
$(CC) -g -c -o $@ $< $(CFLAGS) -Wa,-alnds=$*.log
hello.o: hello.c Makefile board.h
$(CC) -g -c -o $@ $< $(CFLAGS) -Wa,-alnds=$*.log
hello.or32: reset.o hello.o Makefile
$(LD) -Tram.ld -o $@ reset.o hello.o $(LIBS)
$(OBJCOPY) -O srec $@ $*.srec
$(OBJCOPY) -O ihex $@ $*.ihex
$(OBJDUMP) -S $@ > $*.S
$(SREC2MIF) $*.srec
$(SREC2RTL) $*.srec
System.map: hello.or32
@$(NM) $< | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > System.map
#########################################################################
clean:
find . -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' \
-o -name '*.o' -o -name '*.a' -o -name '*.tmp' \
-o -name '*.or32' -o -name '*.bin' -o -name '*.srec' -o -name '*.ihex' \
-o -name '*.mem' -o -name '*.img' -o -name '*.out' \
-o -name '*.aux' -o -name '*.log' \) -print \
| xargs rm -f
rm -f System.map
rm -f onchip_ram_bank?.mif
rm -f onchip_ram_bank?.v
rm -f hello.S
distclean: clean
find . -type f \
\( -name .depend -o -name '*.srec' -o -name '*.bin' \
-o -name '*.pdf' \) \
-print | xargs rm -f
rm -f $(OBJS) *.bak tags TAGS
rm -fr *.*~