mirror of
https://github.com/plctlab/riscv-operating-system-mooc.git
synced 2025-12-26 09:09:11 +00:00
create common.mk for os projects
Makefiles of rvos projects contains too many duplicated contents. Cleanup and move it into a new common.mk file for os only, this will not touch asm samples. Finally the common..mk which was used for both asm & os is removed. Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
include ../../common.mk
|
||||
|
||||
SRCS_ASM = \
|
||||
start.S \
|
||||
mem.S \
|
||||
@@ -12,41 +10,4 @@ SRCS_C = \
|
||||
page.c \
|
||||
sched.c \
|
||||
|
||||
OBJS = $(SRCS_ASM:.S=.o)
|
||||
OBJS += $(SRCS_C:.c=.o)
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
all: os.elf
|
||||
|
||||
# start.o must be the first in dependency!
|
||||
os.elf: ${OBJS}
|
||||
${CC} ${CFLAGS} -T os.ld -o os.elf $^
|
||||
${OBJCOPY} -O binary os.elf os.bin
|
||||
|
||||
%.o : %.c
|
||||
${CC} ${CFLAGS} -c -o $@ $<
|
||||
|
||||
%.o : %.S
|
||||
${CC} ${CFLAGS} -c -o $@ $<
|
||||
|
||||
run: all
|
||||
@${QEMU} -M ? | grep virt >/dev/null || exit
|
||||
@echo "Press Ctrl-A and then X to exit QEMU"
|
||||
@echo "------------------------------------"
|
||||
@${QEMU} ${QFLAGS} -kernel os.elf
|
||||
|
||||
.PHONY : debug
|
||||
debug: all
|
||||
@echo "Press Ctrl-C and then input 'quit' to exit GDB and QEMU"
|
||||
@echo "-------------------------------------------------------"
|
||||
@${QEMU} ${QFLAGS} -kernel os.elf -s -S &
|
||||
@${GDB} os.elf -q -x ../gdbinit
|
||||
|
||||
.PHONY : code
|
||||
code: all
|
||||
@${OBJDUMP} -S os.elf | less
|
||||
|
||||
.PHONY : clean
|
||||
clean:
|
||||
rm -rf *.o *.bin *.elf
|
||||
|
||||
include ../common.mk
|
||||
|
||||
Reference in New Issue
Block a user