aboutsummaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
authorEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2023-06-15 22:36:39 -0400
committerEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2023-06-15 22:36:39 -0400
commita78033acc941fc4bcf6188f1d48fd8e012673fff (patch)
treeac92adae5e40274fd9e0b78352a24840cc88eab4 /makefile
initial commit
Diffstat (limited to 'makefile')
-rw-r--r--makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..e4934bf
--- /dev/null
+++ b/makefile
@@ -0,0 +1,45 @@
+# The makefile
+
+OS_NAME := emuos
+ARCH = i386
+SYSROOT = $(PWD)/sysroot
+
+# Variables for easy access of tools like gcc and nasm
+CC = i686-elf-gcc
+CXX = i686-elf-g++
+LD = i686-elf-ld
+NASM = nasm
+QEMU = qemu-system-i386
+ASMFLAGS = -felf32
+#CXXFLAGS := -ffreestanding -O2 -Wall -Wextra -fno-exceptions -fno-rtti
+#LDFLAGS := -ffreestanding -O2 -nostdlib
+
+.PHONY: all kernel.bin grub multiboot_test clean
+
+all: kernel.bin grub
+
+#libc.a:
+# $(info [INFO] Building libc)
+# $(MAKE) -C ./libc/ ARCH=$(ARCH) PREFIX=$(PWD) CC=$(CC) CXX=$(CXX) LD=$(LD) NASM=$(NASM) SYSROOT=$(SYSROOT)
+
+kernel.bin:
+ $(info [INFO] Building kernel)
+ $(MAKE) -C ./kernel/ ARCH=$(ARCH) PREFIX=$(PWD) CC=$(CC) CXX=$(CXX) LD=$(LD) NASM=$(NASM) SYSROOT=$(SYSROOT)
+
+grub: kernel.bin grub.cfg
+ grub-file --is-x86-multiboot $<
+ cp kernel.bin isodir/boot
+ cp grub.cfg isodir/boot/grub
+ grub-mkrescue -o $(OS_NAME).iso isodir
+
+qemu: grub
+ $(QEMU) -no-shutdown -no-reboot --serial stdio -s -m 512 -hda $(OS_NAME).iso
+
+install: install-headers
+
+install-headers:
+ $(MAKE) -C ./kernel/ install-headers SYSROOT=$(SYSROOT)
+
+clean:
+ -@$(MAKE) -C ./kernel/ clean SYSROOT=$(SYSROOT)
+ -@$(RM) $(wildcard *.bin)