-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (36 loc) · 1.26 KB
/
Makefile
File metadata and controls
43 lines (36 loc) · 1.26 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
export
CROSS_=riscv64-unknown-elf-
GCC=${CROSS_}gcc
LD=${CROSS_}ld
OBJCOPY=${CROSS_}objcopy
OBJDUMP=${CROSS_}objdump
ISA=rv64imafd
ABI=lp64
INCLUDE = -I $(shell pwd)/include -I $(shell pwd)/arch/riscv/include
CF = -march=$(ISA) -mabi=$(ABI) -mcmodel=medany -fno-builtin -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nostdinc -static -lgcc -Wl,--nmagic -Wl,--gc-sections
OWENCF = -D__xlen=64 -g
LABCF = -DSJF
INFOCF != if [ $(INFO) = 1 ]; then echo -DPRINTK_INFO=1; else echo -DPRINTK_INFO=0; fi
CFLAG = ${CF} ${INCLUDE} ${OWENCF} ${LABCF} ${INFOCF}
.PHONY:all run debug clean
all: clean
${MAKE} -C lib all
${MAKE} -C init all
${MAKE} -C user all
${MAKE} -C arch/riscv all
riscv64-unknown-elf-objdump -D vmlinux > d.s
@echo -e '\n'Build Finished OK
run: all
@echo Launch the qemu ......
@qemu-system-riscv64 -nographic -machine virt -kernel vmlinux -initrd user/build/simple_fs.cpio
debug: all
@echo Launch the qemu for debug ......
@qemu-system-riscv64 -nographic -machine virt -kernel vmlinux -initrd user/build/simple_fs.cpio -S -s
clean:
${MAKE} -C lib clean
${MAKE} -C init clean
${MAKE} -C arch/riscv clean
${MAKE} -C user clean
$(shell test -f vmlinux && rm vmlinux)
$(shell test -f System.map && rm System.map)
@echo -e '\n'Clean Finished