Add help target to list available targets
This commit is contained in:
20
Makefile
20
Makefile
@ -1,13 +1,19 @@
|
|||||||
include build/make.config
|
include build/make.config
|
||||||
|
include build/make.help
|
||||||
|
|
||||||
srctree := $(PWD)
|
srctree := $(PWD)
|
||||||
|
|
||||||
all:
|
|
||||||
$(make) -C $(srctree)/kernel srctree=$(srctree) all
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(make) -C $(srctree)/kernel srctree=$(srctree) clean
|
|
||||||
|
|
||||||
include platform/make.$(platform)
|
include platform/make.$(platform)
|
||||||
|
|
||||||
.PHONY: all clean
|
kernel:
|
||||||
|
$(make) -C $(srctree)/kernel srctree=$(srctree) all
|
||||||
|
|
||||||
|
clean: platform_clean
|
||||||
|
$(make) -C $(srctree)/kernel srctree=$(srctree) clean
|
||||||
|
|
||||||
|
.hidden:
|
||||||
|
|
||||||
|
help:
|
||||||
|
$(call print_help)
|
||||||
|
|
||||||
|
.PHONY: all clean help
|
||||||
|
|||||||
7
build/make.help
Normal file
7
build/make.help
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
define print_help
|
||||||
|
@make -pqR : 2>/dev/null \
|
||||||
|
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
|
||||||
|
| sort \
|
||||||
|
| grep -E -v -e '^[^[:alnum:]]' -e '^$@$$' \
|
||||||
|
| xargs -I _ echo _
|
||||||
|
endef
|
||||||
@ -17,6 +17,6 @@ $(srctree)/out/kernel.elf: $(o_files)
|
|||||||
$(cc) $(kernel_cflags) -c -o $@ $<
|
$(cc) $(kernel_cflags) -c -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm $(srctree)/out/kernel.elf $(o_files)
|
-rm -f $(srctree)/out/kernel.elf $(o_files)
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all
|
||||||
|
|||||||
@ -1,27 +1,44 @@
|
|||||||
$(srctree)/out/i386_pc/mop3.iso: $(srctree)/out/kernel.elf
|
$(srctree)/out/i386_pc/mop3.iso: $(srctree)/out/kernel.elf
|
||||||
rm -rf $(srctree)/out/i386_pc/tmp
|
|
||||||
mkdir -p $(srctree)/out/i386_pc/tmp
|
|
||||||
mkdir -p $(srctree)/out/i386_pc/tmp/iso/boot/grub
|
mkdir -p $(srctree)/out/i386_pc/tmp/iso/boot/grub
|
||||||
cp $(srctree)/out/kernel.elf $(srctree)/out/i386_pc/tmp/iso/boot
|
cp $(srctree)/out/kernel.elf $(srctree)/out/i386_pc/tmp/iso/boot
|
||||||
cp $(srctree)/platform/i386_pc/grub.cfg $(srctree)/out/i386_pc/tmp/iso/boot/grub
|
cp $(srctree)/platform/i386_pc/grub.cfg $(srctree)/out/i386_pc/tmp/iso/boot/grub
|
||||||
grub-mkrescue -o $(srctree)/out/i386_pc/mop3.iso $(srctree)/out/i386_pc/tmp/iso
|
grub-mkrescue -o $(srctree)/out/i386_pc/mop3.iso $(srctree)/out/i386_pc/tmp/iso
|
||||||
|
|
||||||
QEMU_EXTRA ?=
|
boot ?= iso
|
||||||
|
|
||||||
QEMU_OPTS := -M pc \
|
qemu_extra ?=
|
||||||
-cdrom $(srctree)/out/i386_pc/mop3.iso \
|
|
||||||
|
qemu_opts := -M pc \
|
||||||
-serial mon:stdio \
|
-serial mon:stdio \
|
||||||
$(QEMU_EXTRA)
|
$(QEMU_EXTRA)
|
||||||
|
|
||||||
|
ifeq ($(boot),iso)
|
||||||
|
qemu_opts += -cdrom $(srctree)/out/i386_pc/mop3.iso
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(debug),1)
|
ifeq ($(debug),1)
|
||||||
QEMU_OPTS += -gdb tcp::5557 -S
|
qemu_opts += -gdb tcp::5557 -S
|
||||||
endif
|
endif
|
||||||
|
|
||||||
i386_pc_qemu: $(srctree)/out/i386_pc/mop3.iso
|
i386_pc_qemu: $(srctree)/out/i386_pc/mop3.iso
|
||||||
qemu-system-i386 $(QEMU_OPTS)
|
qemu-system-i386 $(qemu_opts)
|
||||||
|
|
||||||
i386_pc_bochs: $(srctree)/out/i386_pc/mop3.iso
|
i386_pc_bochs: $(srctree)/out/i386_pc/mop3.iso
|
||||||
rm -f $(srctree)/bochs.log
|
rm -f $(srctree)/bochs.log
|
||||||
-bochs -f $(srctree)/platform/i386_pc/bochsrc.txt -q
|
-bochs -f $(srctree)/platform/i386_pc/bochsrc.txt -q
|
||||||
|
|
||||||
.PHONY: i386_pc_qemu i386_pc_bochs
|
i386_pc_cleandirs:
|
||||||
|
rm -rf $(srctree)/out/i386_pc/tmp
|
||||||
|
|
||||||
|
i386_pc_prepdirs:
|
||||||
|
mkdir -p $(srctree)/out/i386_pc/tmp
|
||||||
|
|
||||||
|
i386_pc_images: i386_pc_cleandirs i386_pc_prepdirs \
|
||||||
|
$(srctree)/out/i386_pc/mop3.iso \
|
||||||
|
$(srctree)/out/i386_pc/mop3.img
|
||||||
|
|
||||||
|
platform_clean: i386_pc_cleandirs
|
||||||
|
-rm -f $(srctree)/out/i386_pc/mop3.iso \
|
||||||
|
$(srctree)/out/i386_pc/mop3.img
|
||||||
|
|
||||||
|
.PHONY: i386_pc_qemu i386_pc_bochs i386_pc_images platform_clean
|
||||||
|
|||||||
Reference in New Issue
Block a user