-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (53 loc) · 2.08 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
67
68
69
70
71
72
73
74
ARMGNU ?= arm-linux-gnueabi
LDOPS = -L /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/ -L /usr/lib/arm-none-eabi/newlib -lc -lgcc
COPS = -Wall -O2 -nostartfiles -ffreestanding -g --build-id=none
#COPS = -Wall -O0 -nostdlib -nostartfiles -ffreestanding -g
gcc : driver.hex driver.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
motor.o : motor.c driver.h
$(ARMGNU)-gcc $(COPS) -c motor.c -o motor.o
cli.o : cli.c cli.h
$(ARMGNU)-gcc $(COPS) -c cli.c -o cli.o
driver.o : driver.c driver.h uart.h
$(ARMGNU)-gcc $(COPS) -c driver.c -o driver.o
dummy_syscall.o : dummy_syscall.c
$(ARMGNU)-gcc $(COPS) -c dummy_syscall.c -o dummy_syscall.o
driver.elf : memmap vectors.o driver.o motor.o cli.o dummy_syscall.o
$(ARMGNU)-ld vectors.o motor.o cli.o driver.o -g -o driver.elf $(LDOPS) dummy_syscall.o -T memmap
$(ARMGNU)-objdump -D driver.elf > driver.list
driver.bin : driver.elf
$(ARMGNU)-objcopy driver.elf -O binary driver.bin
driver.hex : driver.elf
$(ARMGNU)-objcopy driver.elf -O ihex driver.hex
test.o : test.c
$(ARMGNU)-gcc $(COPS) -c $< -o $@
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 -g
OOPS = -std-compile-opts
clang : driver.clang.hex driver.clang.bin
driver.clang.bc : driver.c
clang $(LOPS) -c driver.c -o driver.clang.bc
driver.clang.opt.elf : memmap vectors.o driver.clang.bc
opt $(OOPS) driver.clang.bc -o driver.clang.opt.bc
llc $(LLCOPS) driver.clang.opt.bc -o driver.clang.opt.s
$(ARMGNU)-as driver.clang.opt.s -o driver.clang.opt.o
$(ARMGNU)-ld -o driver.clang.opt.elf -T memmap vectors.o driver.clang.opt.o
$(ARMGNU)-objdump -D driver.clang.opt.elf > driver.clang.opt.list
driver.clang.hex : driver.clang.opt.elf
$(ARMGNU)-objcopy driver.clang.opt.elf driver.clang.hex -O ihex
driver.clang.bin : driver.clang.opt.elf
$(ARMGNU)-objcopy driver.clang.opt.elf driver.clang.bin -O binary