From f4deaf87d42fdfd696daa87c4bae7b2727dabbad Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 28 Sep 2022 20:12:00 +0300 Subject: makefile: add a choice of booting mechanism --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index caf5939..570e4a8 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,17 @@ OSNAME = mfsos OSBIN = $(OSNAME).bin KERNBIN = kernel.bin +# Available options: `bootloader`, `multiboot` +BOOT ?= bootloader ARCH = x86 -ARCH_BOOT = arch/$(ARCH)/boot/bootloader +ARCH_BOOT = arch/$(ARCH)/boot/$(BOOT) + BOOTBIN = $(ARCH_BOOT)/bootloader.bin +OS_BINARIES = $(KERNBIN) +ifeq ($(BOOT), bootloader) + OS_BINARIES := $(BOOTBIN) $(OS_BINARIES) +endif TARGET = i686-elf TARGET_TOOLS = $(PWD)/tools/toolchain/bin/$(TARGET)- @@ -26,7 +33,7 @@ export CC LD AS OBJDUMP all: $(OSBIN) -$(OSBIN): $(BOOTBIN) $(KERNBIN) +$(OSBIN): $(OS_BINARIES) cat $^ > $@ dd if=/dev/zero bs=512 count=128 >> $@ # 65536 -- cgit v1.2.3-18-g5258