forked from rasendubi/akernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (39 loc) · 1.33 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
CROSS_PREFIX?=arm-unknown-linux-gnueabi-
CC:=$(CROSS_PREFIX)gcc
OBJCOPY:=$(CROSS_PREFIX)objcopy
CFLAGS:=-ansi -pedantic -Wall -Wextra -march=armv7-a -msoft-float -fPIE -mapcs-frame -I. -ffreestanding \
-std=c99
LDFLAGS:=-nostdlib -N
LIBS:=-lgcc
QEMU:=qemu-system-arm
BOARD:=realview-pb-a8
CPU:=cortex-a8
all: kernel.elf
kernel.elf: kernel.ld bootstrap.o kernel.o uart.o context_switch.o gic.o user.o \
scheduler.o pipe.o page_alloc.o svc.o svc_entries.o alloc.o print.o irq.o \
growbuf.o user_pipe_master.o ramdisk.o exec_elf.o tarfs.o \
exec.o user/syscalls.o slab.o slab_alloc.o
$(CC) $(LDFLAGS) -o $@ $^ -lgcc -Tkernel.ld
ramdisk.o: ramdisk.tar
$(OBJCOPY) -I binary -O elf32-littlearm -B arm $^ $@ --rename-section .data=ramdisk
ramdisk.tar: \
stupid \
user/services/pipe_master \
user/alloc_test
tar cf $@ $^
stupid: stupid.o uart.o
user/services/pipe_master: user/services/pipe_master.o user/syscalls.o user/page_alloc.o alloc.o print.o uart.o
user/alloc_test: user/alloc_test.o alloc.o print.o uart.o user/page_alloc.o user/syscalls.o
run: kernel.elf
$(QEMU) -M $(BOARD) -cpu $(CPU) -nographic -kernel kernel.elf
clean:
rm -f *.o *.elf *.tar \
stupid \
user/*.o \
user/alloc_test \
user/services/*.o \
user/services/pipe_master \
%: %.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
%.o: %.s
$(CC) $(CFLAGS) -o $@ -c $^