From 39f626a5d0cf0f5db95e695d013b70a04c29348e Mon Sep 17 00:00:00 2001 From: Joursoir Date: Mon, 2 Aug 2021 12:45:38 +0000 Subject: init project --- Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..31f1bbb --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +OSNAME = mfsos +OSBIN = $(OSNAME).bin + +OBJECTS = kernel/main.o +LINKER = kernel/linker.ld +BOOT_SRC = kernel/boot.s +BOOT_OBJ = ${BOOT_SRC:.s=.o} + +TARGET_TOOLS = $(HOME)/path/to/cross/compiler/i686-elf- +CC = $(TARGET_TOOLS)gcc +AS = $(TARGET_TOOLS)as + +.PHONY: all qemu clean + +all: $(OSBIN) + +$(OSBIN): $(BOOT_OBJ) $(OBJECTS) + $(CC) -T $(LINKER) -o $(OSBIN) -ffreestanding -O2 -nostdlib \ + $(OBJECTS) $(BOOT_OBJ) -lgcc + +$(BOOT_OBJ): $(BOOT_SRC) + $(AS) $< -o $@ + +%.o: %.c + $(CC) -c $< -o $@ \ + -std=gnu89 -ffreestanding -O2 -Wall \ + -Wpedantic -Wextra + +qemu: $(OSBIN) + qemu-system-i386 -kernel $(OSBIN) + +clean: + rm -rf $(BOOT_OBJ) $(OBJECTS) $(OSBIN) -- cgit v1.2.3-18-g5258