summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.xyz>2021-01-24 21:10:57 -0600
committerDanny Holman <dholman@gymli.xyz>2021-01-24 21:10:57 -0600
commita4534660fecb1b571c24ad82e67bc6c2fb814cb9 (patch)
tree149984cb0e9a32765e63df0f696091817c2b6dd5 /Makefile
parentdd6656f7132d1727a055035ca94945fa4fbaae58 (diff)
x86: reorganize the i386 directory
Add structure to the internals of the x86 directory. Signed-off-by: Danny Holman <dholman@gymli.xyz>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 11 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index c42fa08..fdf693c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,11 @@
CC=i686-elf-gcc
+INCLUDE?=include
CFLAGS?=-O2 -g
LDFLAGS?=
LIBS?=
-CFLAGS:=$(CFLAGS) -ffreestanding -Wall -Wextra -Iinclude
+INCLUDE:=$(INCLUDE)
+CFLAGS:=$(CFLAGS) -ffreestanding -Wall -Wextra -I$(INCLUDE)
LDFLAGS:=$(LDFLAGS)
LIBS:=$(LIBS) -nostdlib -lgcc
@@ -11,7 +13,8 @@ ARCHDIR=arch/i386
include $(ARCHDIR)/make.config
-CFLAGS:=$(CFLAGS) $(KERNEL_ARCH_CFLAGS)
+INCLUDE:=$(INCLUDE) $(KERNEL_ARCH_INCLUDE)
+CFLAGS:=$(CFLAGS) $(KERNEL_ARCH_CFLAGS) -I$(INCLUDE)
LDFLAGS:=$(LDFLAGS) $(KERNEL_ARCH_LDFLAGS)
LIBS:=$(LIBS) $(KERNEL_ARCH_LIBS)
@@ -22,19 +25,19 @@ KERNEL_OBJS=$(KERNEL_ARCH_OBJS) \
kernel/string.o \
kernel/io.o \
-OBJS=$(ARCHDIR)/crti.o \
+OBJS=$(ARCHDIR)/boot/crti.o \
$(ARCHDIR)/crtbegin.o \
$(KERNEL_OBJS) \
$(ARCHDIR)/crtend.o \
- $(ARCHDIR)/crtn.o \
+ $(ARCHDIR)/boot/crtn.o \
LINK_LIST=$(LDFLAGS) \
- $(ARCHDIR)/crti.o \
+ $(ARCHDIR)/boot/crti.o \
$(ARCHDIR)/crtbegin.o \
$(KERNEL_OBJS) \
$(LIBS) \
$(ARCHDIR)/crtend.o \
- $(ARCHDIR)/crtn.o \
+ $(ARCHDIR)/boot/crtn.o \
.PHONY: all clean install install-headers install-kernel
.SUFFIXES: .o .c .s
@@ -42,7 +45,7 @@ LINK_LIST=$(LDFLAGS) \
all: $(KERNEL)
$(KERNEL): $(OBJS) $(ARCHDIR)/linker.ld
- @$(CC) -T $(ARCHDIR)/linker.ld -o $@ $(CFLAGS) $(LINK_LIST)
+ @$(CC) -T $(ARCHDIR)/linker.ld -o $@ $(LINK_LIST)
@echo [LD] $@
$(ARCHDIR)/crtbegin.o $(ARCHDIR)/crtend.o:
@@ -54,7 +57,7 @@ $(ARCHDIR)/crtbegin.o $(ARCHDIR)/crtend.o:
.s.o:
@$(CC) -MD -c $< -o $@ $(CFLAGS)
- @echo [CC] $@
+ @echo [AS] $@
clean:
$(RM) $(KERNEL)