From 341da8d5cb692850e10b89cf5442ddf3186be07c Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 7 Feb 2012 17:58:36 +0800 Subject: [PATCH] More work on neatening code --- KernelLand/Kernel/Makefile | 2 +- KernelLand/Makefile.cfg | 7 ++++ KernelLand/Modules/Makefile.tpl | 4 +-- Makefile | 32 +++++++++++-------- .../Libraries/ld-acess.so_src/arch/armv7.S.h | 2 -- .../ld-acess.so_src/arch/syscalls.s.h | 2 ++ .../ld-acess.so_src/arch/x86_64.asm.h | 2 -- 7 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 KernelLand/Makefile.cfg diff --git a/KernelLand/Kernel/Makefile b/KernelLand/Kernel/Makefile index d0c8dbf6..531ab655 100644 --- a/KernelLand/Kernel/Makefile +++ b/KernelLand/Kernel/Makefile @@ -92,7 +92,7 @@ install: $(BIN) apidoc: doxygen Doxyfile.api -$(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile ../BuildConf/$(ARCH)/Makefile.cfg ../BuildConf/$(ARCH)/$(PLATFORM).mk +$(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile ../../BuildConf/$(ARCH)/Makefile.cfg ../../BuildConf/$(ARCH)/$(PLATFORM).mk @echo --- LD -o $(BIN) @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) --defsym __buildnum=$$(( $(BUILD_NUM) + 1 )) -Map ../Map.$(ARCH).txt @$(DISASM) -S $(BIN) > $(BIN).dsm diff --git a/KernelLand/Makefile.cfg b/KernelLand/Makefile.cfg new file mode 100644 index 00000000..ca630952 --- /dev/null +++ b/KernelLand/Makefile.cfg @@ -0,0 +1,7 @@ +# +# Usermode Makefile.cfg +# + +# Include Root Makefile.cfg +-include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.cfg + diff --git a/KernelLand/Modules/Makefile.tpl b/KernelLand/Modules/Makefile.tpl index f1c31a57..0393b619 100644 --- a/KernelLand/Modules/Makefile.tpl +++ b/KernelLand/Modules/Makefile.tpl @@ -6,10 +6,10 @@ _CPPFLAGS := $(CPPFLAGS) -include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.cfg -LIBINCLUDES := $(addprefix -I$(ACESSDIR)/Modules/,$(DEPS)) +LIBINCLUDES := $(addprefix -I$(ACESSDIR)/KernelLand/Modules/,$(DEPS)) LIBINCLUDES := $(addsuffix /include,$(LIBINCLUDES)) -CPPFLAGS := -I$(ACESSDIR)/Kernel/include -I$(ACESSDIR)/Kernel/arch/$(ARCHDIR)/include +CPPFLAGS := -I$(ACESSDIR)/KernelLand/Kernel/include -I$(ACESSDIR)/KernelLand/Kernel/arch/$(ARCHDIR)/include CPPFLAGS += -DARCH=$(ARCH) -DARCH_is_$(ARCH) -DARCHDIR_is_$(ARCHDIR) CPPFLAGS += $(_CPPFLAGS) CPPFLAGS += $(LIBINCLUDES) diff --git a/Makefile b/Makefile index 4597d875..faa0ab30 100644 --- a/Makefile +++ b/Makefile @@ -54,16 +54,20 @@ clean: $(CLEAN_DYNMODS) $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_U install: install-Filesystem SyscallList $(INSTALL_USRLIBS) $(INSTALL_USRAPPS) $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel SyscallList: include/syscalls.h -include/syscalls.h: Kernel/Makefile Kernel/syscalls.lst - @make -C Kernel/ include/syscalls.h +include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst + @make -C KernelLand/Kernel/ include/syscalls.h + +_build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/ +_build_stmod := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/ +_build_kernel := $(SUBMAKE) $1 -C KernelLand/Kernel # Compile Only $(ALL_DYNMODS): all-%: - +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all -C Modules/$* + +@echo === Dynamic Module: $* && $(_build_dynmod)$* all $(ALL_MODULES): all-%: - +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all -C Modules/$* + +@echo === Module: $* && $(_build_stmod)$* all all-Kernel: - +@echo === Kernel && $(SUBMAKE) all -C Kernel + +@echo === Kernel && $(_build_kernel) all $(ALL_USRLIBS): all-%: +@echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src $(ALL_USRAPPS): all-%: @@ -71,11 +75,11 @@ $(ALL_USRAPPS): all-%: # Compile & Install $(AI_DYNMODS): allinstall-%: - +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all install -C Modules/$* + +@echo === Dynamic Module: $* && $(_build_dynmod)$* all install $(AI_MODULES): allinstall-%: - +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all install -C Modules/$* + +@echo === Module: $* && $(_build_stmod)$* all install allinstall-Kernel: - +@echo === Kernel && $(SUBMAKE) all install -C Kernel + +@echo === Kernel && $(_build_kernel) all install $(AI_USRLIBS): allinstall-%: +@echo === User Library: $* && $(SUBMAKE) all install -C Usermode/Libraries/$*_src $(AI_USRAPPS): allinstall-%: @@ -83,11 +87,11 @@ $(AI_USRAPPS): allinstall-%: # Clean up compilation $(CLEAN_DYNMODS): clean-%: - +@BUILDTYPE=dynamic $(SUBMAKE) clean -C Modules/$* + +@$(_build_dynmod)$* clean $(CLEAN_MODULES): clean-%: - +@BUILDTYPE=static $(SUBMAKE) clean -C Modules/$* + +@$(_build_stmod)$* clean clean-Kernel: - +@$(SUBMAKE) clean -C Kernel + +@$(_build_kernel) clean $(CLEAN_USRLIBS): clean-%: +@$(SUBMAKE) clean -C Usermode/Libraries/$*_src $(CLEAN_USRAPPS): clean-%: @@ -95,13 +99,13 @@ $(CLEAN_USRAPPS): clean-%: # Install $(INSTALL_DYNMODS): install-%: - @BUILDTYPE=dynamic $(SUBMAKE) install -C Modules/$* + @$(_build_dynmod)$* install $(INSTALL_MODULES): install-%: - @BUILDTYPE=static $(SUBMAKE) install -C Modules/$* + @$(_build_stmod)$* install install-Filesystem: @$(SUBMAKE) install -C Usermode/Filesystem install-Kernel: - @$(SUBMAKE) install -C Kernel + @$(_build_kernel) install $(INSTALL_USRLIBS): install-%: @$(SUBMAKE) install -C Usermode/Libraries/$*_src $(INSTALL_USRAPPS): install-%: diff --git a/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h b/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h index 560b809f..9132c026 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h @@ -2,8 +2,6 @@ // Acess2 ARMv7 - System Calls // -#include "../../../../Kernel/include/syscalls.h" - .globl _start .extern SoMain _start: diff --git a/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h b/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h index cd20d801..88cea59b 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/syscalls.s.h @@ -1,3 +1,5 @@ +#include "../../../../KernelLand/Kernel/include/syscalls.h" + // --- Process Control --- SYSCALL1(_exit, SYS_EXIT) diff --git a/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h b/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h index 9f7be4ea..350585a0 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/x86_64.asm.h @@ -2,8 +2,6 @@ ; AcssMicro - System Calls ; ======================== -#include "../../../../Kernel/include/syscalls.h" - [bits 64] [section .text] -- 2.20.1