kernel-dev/Makefile

43 lines
1012 B
Makefile
Raw Normal View History

2024-04-04 21:38:44 +08:00
SOURCE := $(shell pwd)/scripts
2024-04-04 21:38:44 +08:00
.PHONY: all clear run debug disass
2023-12-29 22:54:46 +08:00
2024-04-04 21:38:44 +08:00
all: metaverse_kernel
@make -C src all --no-print-directory
2024-04-04 21:38:44 +08:00
clear: metaverse_kernel
@make -C src clear --no-print-directory
2024-04-04 21:38:44 +08:00
run: metaverse_kernel
2023-12-11 20:13:36 +08:00
@make -C test run --no-print-directory
2024-04-04 21:38:44 +08:00
debug: metaverse_kernel
2023-12-11 20:13:36 +08:00
@make -C test debug --no-print-directory
2023-12-29 22:54:46 +08:00
2024-04-04 21:38:44 +08:00
metaverse_kernel:
2023-12-29 22:54:46 +08:00
@if [ "${shell uname -s}" != "Linux" ]; then \
echo -e "\e[1;33mMetaverse\e[0m must build under \e[1;35mLinux\e[0m or itself."; \
exit -1; \
fi
2024-04-06 04:17:44 +08:00
@"${SOURCE}/depcheck";
2024-04-04 21:38:44 +08:00
@if [ $$? != 0 ]; then \
2024-04-06 04:17:44 +08:00
exit $$?; \
2023-12-29 22:54:46 +08:00
fi
2024-04-06 04:17:44 +08:00
@touch metaverse_kernel
disass:
objdump -D src/metaverse.elf > kerndisass.txt
2024-04-04 21:38:44 +08:00
install-grub:
@cp src/metaverse.elf /boot/
@if ! grep -q "Metaverse" /boot/grub/grub.cfg; then \
echo -e 'menuentry "Metaverse" {\n set root=(hd0,gpt1)\n multiboot2 /metaverse.elf\n}\n' >> \
/boot/grub/grub.cfg; \
echo -e 'Added Metaverse into grub entries.'; \
else \
echo -e 'Metaverse entry exists.'; \
fi
remove-grub:
@-rm /boot/metaverse.elf