summaryrefslogtreecommitdiff
path: root/kernel/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/Makefile')
-rw-r--r--kernel/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/kernel/Makefile b/kernel/Makefile
new file mode 100644
index 0000000..36cca4c
--- /dev/null
+++ b/kernel/Makefile
@@ -0,0 +1,40 @@
+include ../defaults.mk
+
+TARGET := kernel.os
+.DEFAULT: $(TARGET)
+
+# EFI API for temporary things
+
+EFIAPIDIR := /usr/local/include/efi
+
+CPPFLAGS += -I../api -I$(EFIAPIDIR) -I$(EFIAPIDIR)/$(ARCH) -I$(EFIAPIDIR)/protocol
+CFLAGS += -Wno-unused-const-variable -Wno-unused-function -fvisibility=hidden -g
+
+LIBDIRS += -L$(dir $(shell $(CC) -print-libgcc-file-name))
+LDSCRIPT := kernel.ld
+LDFLAGS += -z max-page-size=4096 --export-dynamic
+LOADLIBES := -lgcc
+
+SOBJS :=
+GOBJS := entry_efi.o
+IOBJS :=
+
+$(SOBJS): CFLAGS += -fPIC
+# __attribute__((interrupt)) requires -mgeneral-regs-only
+$(IOBJS): CFLAGS += -mgeneral-regs-only
+$(IOBJS) $(GOBJS): CFLAGS += -mcmodel=kernel
+
+OBJS := $(SOBJS) $(GOBJS) $(IOBJS)
+DEPS := $(patsubst %.o,%.d,$(OBJS))
+
+$(TARGET): $(LDSCRIPT) $(MAKEFILE_LIST)
+$(TARGET): $(OBJS)
+
+CLEANLIST := $(wildcard $(OBJS) $(TARGET))
+DCLEANLIST := $(wildcard $(DEPS))
+
+include ../rules.mk
+-include $(DEPS)
+
+.DEFAULT: $(TARGET)
+