-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 851 Bytes
/
Makefile
File metadata and controls
40 lines (30 loc) · 851 Bytes
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
ARMGNU ?= arm-none-eabi
CFLAGS = -Wall -nostdlib -fomit-frame-pointer -mno-apcs-frame -nostartfiles -ffreestanding -g -march=armv6z -marm -mthumb-interwork
ASFLAGS = -g -march=armv6z
C_FILES=kernel.c phyAlloc.c hw.c sched.c
AS_FILES=vectors.s
OBJS = $(patsubst %.s,%.o,$(AS_FILES))
OBJS += $(patsubst %.c,%.o,$(C_FILES))
.PHONY: gcc clean
gcc : kernel
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
rm -f *~
%.o : %.c
$(ARMGNU)-gcc $(CFLAGS) -c $< -o $@
%.o : %.s
$(ARMGNU)-as $(ASFLAGS) $< -o $@
kernel : memmap $(OBJS)
$(ARMGNU)-ld $(OBJS) -T memmap -o kernel.elf
$(ARMGNU)-objdump -D kernel.elf > kernel.list
$(ARMGNU)-objcopy kernel.elf -O binary kernel.img
$(ARMGNU)-objcopy kernel.elf -O ihex kernel.hex
student : clean
cd .. && ./build_student_archive.sh