/
Makefile
71 lines (44 loc) · 1.57 KB
/
Makefile
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
59
60
61
62
63
64
65
66
ARMGNU ?= arm-none-eabi
COPS = -Wall -O3 -nostdlib -nostartfiles -ffreestanding
LDFLAGS = -L /usr/lib/gcc/arm-none-eabi/4.9.3/ -lgcc
gcc : forth.hex forth.bin
all : gcc clang
clean :
rm -f *.o
rm -f *.bin
rm -f *.hex
rm -f *.elf
rm -f *.list
rm -f *.img
rm -f *.bc
rm -f *.clang.opt.s
vectors.o : vectors.s
$(ARMGNU)-as vectors.s -o vectors.o
forth.o : forth.c
$(ARMGNU)-gcc $(COPS) -c forth.c -o forth.o
forth.elf : memmap vectors.o forth.o
$(ARMGNU)-ld vectors.o forth.o -T memmap -o forth.elf $(LDFLAGS)
$(ARMGNU)-objdump -D forth.elf > forth.list
forth.bin : forth.elf
$(ARMGNU)-objcopy forth.elf -O binary forth.bin
forth.hex : forth.elf
$(ARMGNU)-objcopy forth.elf -O ihex forth.hex
LOPS = -Wall -m32 -emit-llvm
LLCOPS = -march=arm -mcpu=arm1176jzf-s
LLCOPS0 = -march=arm
LLCOPS1 = -march=arm -mcpu=arm1176jzf-s
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding
OOPS = -std-compile-opts
clang : forth.clang.hex forth.clang.bin
forth.clang.bc : forth.c
clang $(LOPS) -c forth.c -o forth.clang.bc
forth.clang.opt.elf : memmap vectors.o forth.clang.bc
opt $(OOPS) forth.clang.bc -o forth.clang.opt.bc
llc $(LLCOPS) forth.clang.opt.bc -o forth.clang.opt.s
$(ARMGNU)-as forth.clang.opt.s -o forth.clang.opt.o
$(ARMGNU)-ld -o forth.clang.opt.elf -T memmap vectors.o forth.clang.opt.o
$(ARMGNU)-objdump -D forth.clang.opt.elf > forth.clang.opt.list
forth.clang.hex : forth.clang.opt.elf
$(ARMGNU)-objcopy forth.clang.opt.elf forth.clang.hex -O ihex
forth.clang.bin : forth.clang.opt.elf
$(ARMGNU)-objcopy forth.clang.opt.elf forth.clang.bin -O binary