summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorjoshua stein <jcs@jcs.org>2019-12-18 17:35:46 -0600
committerAndreas Kling <awesomekling@gmail.com>2019-12-20 20:20:54 +0100
commitac25438d54252d70de0002e4cca04ac258967c47 (patch)
tree61b97be561fbb395b8aa3f84135ba7400dfb38e5 /Kernel
parentf4b2b72c8efc0f6d018b199a8cc95091e7cf4c3e (diff)
downloadserenity-ac25438d54252d70de0002e4cca04ac258967c47.zip
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.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Makefile38
-rwxr-xr-xKernel/install.sh4
2 files changed, 17 insertions, 25 deletions
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/