aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a1586e1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,47 @@
+include config.mk
+
+.PHONY: all clean distclean emulate install
+
+all: $(kernel)
+
+clean:
+ @echo " (RM) iso"
+ $(QUIET)$(RM) -r iso
+ @echo " (RM) $(kernel_iso)"
+ $(QUIET)$(RM) $(kernel_iso)
+ @echo " (RM) $(objects)"
+ $(QUIET)$(RM) $(objects)
+ @echo " (RM) $(dependencies)"
+ $(QUIET)$(RM) $(dependencies)
+
+emulate: $(kernel_iso)
+ @echo " (QEMU) $^"
+ $(QUIET)$(QEMU) -cdrom $^
+
+distclean: clean
+ @echo " (RM) $(kernel)"
+ $(QUIET)$(RM) $(kernel)
+
+install: $(kernel)
+ @echo " (CP) $^"
+ $(QUIET)$(CP) $< $(INSTALL_DIR)
+
+%.o: %.c
+ @echo " (CC) $@"
+ $(QUIET)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+
+%.o: %.s
+ @echo " (AS) $@"
+ $(QUIET)$(AS) $(ASFLAGS) $< -o $@
+
+$(kernel): $(memmap) $(objects)
+ @echo " (LD) $@"
+ $(QUIET) $(LD) $(LDFLAGS) -T $< -o $@ $(objects)
+
+$(kernel_iso): $(kernel) misc/grub.cfg
+ mkdir -p iso/boot/grub
+ cp $^ iso/boot
+ cp misc/grub.cfg iso/boot/grub
+ grub-mkrescue --output=$@ iso
+
+-include $(dependencies)