From ac25438d54252d70de0002e4cca04ac258967c47 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Wed, 18 Dec 2019 17:35:46 -0600 Subject: Build: clean up build system, use one shared Makefile Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler. --- Kernel/Makefile | 38 +++++++++++++++++--------------------- Kernel/install.sh | 4 ---- 2 files changed, 17 insertions(+), 25 deletions(-) delete mode 100755 Kernel/install.sh (limited to 'Kernel') diff --git a/Kernel/Makefile b/Kernel/Makefile index 877c37da30..d9b15fc87d 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -1,6 +1,4 @@ -include ../Makefile.common - -CXX_OBJS = \ +OBJS = \ ../AK/FileSystemPath.o \ ../AK/JsonParser.o \ ../AK/JsonValue.o \ @@ -102,34 +100,32 @@ CXX_OBJS = \ init.o \ kprintf.o +OBJ_SUFFIX = .kernel + MODULE_OBJS = TestModule.o -OBJS = $(CXX_OBJS) Arch/i386/Boot/boot.ao +EXTRA_OBJS = Arch/i386/Boot/boot.ao + +KERNEL = 1 + +PROGRAM = kernel -KERNEL = kernel CXXFLAGS += -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables CXXFLAGS += -nostdlib -nostdinc -nostdinc++ CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/ CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/i686-pc-serenity/ -DEFINES += -DKERNEL -LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib +LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib -lgcc -lstdc++ -all: $(KERNEL) $(MODULE_OBJS) kernel.map +all: $(PROGRAM) $(MODULE_OBJS) kernel.map kernel.map: kernel - @echo "MKMAP $@"; sh mkmap.sh + @echo "MKMAP $@" + $(QUIET) sh mkmap.sh -$(KERNEL): $(OBJS) - @echo "LD $@"; $(LD) $(LDFLAGS) -o $@ $(OBJS) -lgcc -lstdc++ +EXTRA_CLEAN += kernel.map -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - -%.ao: %.S - @echo "AS $@"; $(AS) -o $@ $< - --include $(CXX_OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(KERNEL) $(OBJS) *.d +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/Kernel/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/Kernel/ +include ../Makefile.common diff --git a/Kernel/install.sh b/Kernel/install.sh deleted file mode 100755 index 31e02cc7e6..0000000000 --- a/Kernel/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p ../Root/usr/include/Kernel/ -cp ./*.h ../Root/usr/include/Kernel/ -- cgit v1.2.3