From a9dbef9185854c1b94fb79dc7cfecbe34638c65b Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 10 Oct 2015 11:08:13 +0200 Subject: kfs: added the build system it includes a startup file written in assembly, the Makefile and a ld custom script meant to build link the kernel properly. Signed-off-by: Olivier Gayot --- Makefile | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3ccecb1 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +NAME = kfs +SRC = $(wildcard src/*.c src/crt0.S) + +LDSCRIPT = kfs.ld + +CPPFLAGS += +LDFLAGS += -T $(LDSCRIPT) -nostdlib -Wl,--build-id=none -m32 +CFLAGS += -W -Wall -Wextra -std=gnu99 -g \ + -nostdinc -fno-builtin -fno-stack-protector -m32 + +CC = gcc + +OBJ = $(SRC:.c=.o) + +all: $(NAME) + +$(NAME): $(OBJ) $(LDSCRIPT) + # TODO + $(CC) -o $@ $^ $(LDFLAGS) + +clean: + $(RM) $(OBJ) + $(RM) $(NAME) + +mrproper: clean + +distclean: mrproper + $(RM) $(addsuffix ~,$(SRC)) + $(RM) $(wildcard $(addsuffix .sw*,$(addprefix .,$(SRC)))) + +boot: all + $(shell qemu-system-x86_64 -kernel $(NAME) -nographic) + +debug: all + $(shell qemu-system-x86_64 -kernel $(NAME) -s -S) + +.PHONY: all clean mrproper distclean boot + -- cgit v1.2.3