Merge base libraries into a single library
This patch simplifies the way of how Genode's base libraries are organized. Originally, the base API was implemented in the form of many small libraries such as 'thread', 'env', 'server', etc. Most of them used to consist of only a small number of files. Because those libraries are incorporated in any build, the checking of their inter-dependencies made the build process more verbose than desired. Also, the number of libraries and their roles (core only, non-core only, shared by both core and non-core) were not easy to capture. Hereby, the base libraries have been reduced to the following few libraries: - startup.mk contains the startup code for normal Genode processes. On some platform, core is able to use the library as well. - base-common.mk contains the parts of the base library that are identical by core and non-core processes. - base.mk contains the complete base API implementation for non-core processes Consequently, the 'LIBS' declaration in 'target.mk' files becomes simpler as well. In the most simple case, only the 'base' library must be mentioned. Fixes #18
This commit is contained in:
29
base-linux/lib/mk/base-common.mk
Normal file
29
base-linux/lib/mk/base-common.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# \brief Portions of base library shared by core and non-core processes
|
||||
# \author Norman Feske
|
||||
# \date 2013-02-14
|
||||
#
|
||||
|
||||
LIBS += syscall
|
||||
|
||||
SRC_CC += ipc/ipc.cc
|
||||
SRC_CC += avl_tree/avl_tree.cc
|
||||
SRC_CC += allocator/slab.cc
|
||||
SRC_CC += allocator/allocator_avl.cc
|
||||
SRC_CC += heap/heap.cc heap/sliced_heap.cc
|
||||
SRC_CC += console/console.cc
|
||||
SRC_CC += child/child.cc
|
||||
SRC_CC += process/process.cc
|
||||
SRC_CC += elf/elf_binary.cc
|
||||
SRC_CC += lock/lock.cc
|
||||
SRC_CC += env/rm_session_mmap.cc env/debug.cc
|
||||
SRC_CC += signal/signal.cc
|
||||
SRC_CC += server/server.cc server/common.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/base/lock $(BASE_DIR)/src/base/lock
|
||||
INC_DIR += $(REP_DIR)/src/base/ipc
|
||||
INC_DIR += $(REP_DIR)/src/base/env
|
||||
INC_DIR += $(REP_DIR)/src/platform $(BASE_DIR)/src/platform
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/base
|
||||
vpath %.cc $(BASE_DIR)/src/base
|
||||
18
base-linux/lib/mk/base.inc
Normal file
18
base-linux/lib/mk/base.inc
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# \brief Portions of base library that are exclusive to non-core processes
|
||||
# \author Norman Feske
|
||||
# \date 2013-02-14
|
||||
#
|
||||
# The content of this file is used for both native Genode as well as hybrid
|
||||
# Linux/Genode programs. Hence, it must be void of any thread-related code.
|
||||
#
|
||||
|
||||
LIBS += base-common syscall
|
||||
|
||||
SRC_CC += console/log_console.cc
|
||||
SRC_CC += env/env.cc env/platform_env.cc env/context_area.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/base/env
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/base
|
||||
vpath %.cc $(BASE_DIR)/src/base
|
||||
@@ -1,5 +0,0 @@
|
||||
SRC_CC = core_printf.cc
|
||||
LIBS = cxx console syscall
|
||||
INC_DIR += $(REP_DIR)/src/base/console
|
||||
|
||||
vpath core_printf.cc $(BASE_DIR)/src/base/console
|
||||
@@ -1,7 +0,0 @@
|
||||
SRC_CC = env.cc rm_session_mmap.cc platform_env.cc debug.cc context_area.cc
|
||||
LIBS = ipc heap log_console lock syscall
|
||||
INC_DIR += $(REP_DIR)/src/base/env
|
||||
|
||||
vpath env.cc $(BASE_DIR)/src/base/env
|
||||
vpath context_area.cc $(BASE_DIR)/src/base/env
|
||||
vpath %.cc $(REP_DIR)/src/base/env
|
||||
@@ -1,6 +0,0 @@
|
||||
REQUIRES = linux
|
||||
SRC_CC = ipc.cc
|
||||
LIBS = syscall cap_copy
|
||||
INC_DIR += $(REP_DIR)/src/base/ipc
|
||||
|
||||
vpath ipc.cc $(REP_DIR)/src/base/ipc
|
||||
@@ -1,5 +0,0 @@
|
||||
SRC_CC = lock.cc
|
||||
LIBS = syscall
|
||||
INC_DIR += $(REP_DIR)/src/base/lock
|
||||
|
||||
vpath lock.cc $(BASE_DIR)/src/base/lock
|
||||
@@ -1,5 +1,10 @@
|
||||
SRC_CC = lx_hybrid.cc new_delete.cc
|
||||
LIBS += syscall env
|
||||
SRC_CC += lx_hybrid.cc new_delete.cc
|
||||
|
||||
vpath new_delete.cc $(BASE_DIR)/src/base/cxx
|
||||
vpath lx_hybrid.cc $(REP_DIR)/src/platform
|
||||
|
||||
# add parts of the base library that are shared with core
|
||||
LIBS += base-common
|
||||
|
||||
# non-core parts of the base library (except for the startup code)
|
||||
include $(REP_DIR)/lib/mk/base.inc
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
SRC_CC = process.cc
|
||||
LIBS = syscall
|
||||
|
||||
#
|
||||
# The Linux version of the process library does not use Genode's ELF loader for
|
||||
# loading executables but the 'execve' system call. However, for supporting
|
||||
# dynamically linked executables, we have to take the decision of whether to load
|
||||
# the dynamic linker or a static executable based on information provided by
|
||||
# the ELF program header. We use the ELF library to obtain this information.
|
||||
#
|
||||
LIBS += elf
|
||||
|
||||
vpath process.cc $(REP_DIR)/src/base/process
|
||||
@@ -1,6 +0,0 @@
|
||||
REQUIRES = linux
|
||||
SRC_CC = thread.cc thread_linux.cc
|
||||
LIBS = syscall
|
||||
|
||||
vpath thread.cc $(BASE_DIR)/src/base/thread
|
||||
vpath thread_linux.cc $(REP_DIR)/src/base/thread
|
||||
8
base-linux/lib/mk/x86_32/base.mk
Normal file
8
base-linux/lib/mk/x86_32/base.mk
Normal file
@@ -0,0 +1,8 @@
|
||||
include $(REP_DIR)/lib/mk/base.inc
|
||||
|
||||
LIBS += startup cxx
|
||||
|
||||
SRC_CC += thread.cc thread_linux.cc
|
||||
|
||||
vpath thread.cc $(BASE_DIR)/src/base/thread
|
||||
vpath thread_linux.cc $(REP_DIR)/src/base/thread
|
||||
@@ -1,8 +1,5 @@
|
||||
REQUIRES = linux x86
|
||||
LIBS = cxx lock syscall
|
||||
SRC_S = crt0.s
|
||||
SRC_CC = _main.cc
|
||||
INC_DIR += $(BASE_DIR)/src/platform
|
||||
LIBS += syscall
|
||||
|
||||
vpath crt0.s $(REP_DIR)/src/platform/x86_32
|
||||
vpath _main.cc $(dir $(call select_from_repositories,src/platform/_main.cc))
|
||||
include $(BASE_DIR)/lib/mk/startup.inc
|
||||
|
||||
vpath crt0.s $(REP_DIR)/src/platform/x86_32
|
||||
|
||||
8
base-linux/lib/mk/x86_64/base.mk
Normal file
8
base-linux/lib/mk/x86_64/base.mk
Normal file
@@ -0,0 +1,8 @@
|
||||
include $(REP_DIR)/lib/mk/base.inc
|
||||
|
||||
LIBS += startup
|
||||
|
||||
SRC_CC += thread.cc thread_linux.cc
|
||||
|
||||
vpath thread.cc $(BASE_DIR)/src/base/thread
|
||||
vpath thread_linux.cc $(REP_DIR)/src/base/thread
|
||||
@@ -1,8 +1,5 @@
|
||||
REQUIRES = linux x86
|
||||
LIBS = cxx lock syscall
|
||||
SRC_S = crt0.s
|
||||
SRC_CC = _main.cc
|
||||
INC_DIR += $(BASE_DIR)/src/platform
|
||||
LIBS += syscall
|
||||
|
||||
vpath crt0.s $(REP_DIR)/src/platform/x86_64
|
||||
vpath _main.cc $(dir $(call select_from_repositories,src/platform/_main.cc))
|
||||
include $(BASE_DIR)/lib/mk/startup.inc
|
||||
|
||||
vpath crt0.s $(REP_DIR)/src/platform/x86_64
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
# the program under Linux to prevent clashes with vdso.
|
||||
#
|
||||
ifneq ($(USE_HOST_LD_SCRIPT),yes)
|
||||
PRG_LIBS += startup
|
||||
LD_TEXT_ADDR ?= 0x01000000
|
||||
LD_SCRIPT_STATIC = $(call select_from_repositories,src/platform/genode.ld) \
|
||||
$(call select_from_repositories,src/platform/context_area.nostdlib.ld)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
TARGET = core
|
||||
REQUIRES = linux
|
||||
LIBS = cxx ipc heap core_printf child lock raw_server syscall raw_signal
|
||||
LIBS = cxx base-common syscall startup
|
||||
|
||||
GEN_CORE_DIR = $(BASE_DIR)/src/core
|
||||
|
||||
@@ -18,17 +18,17 @@ SRC_CC = main.cc \
|
||||
io_mem_session_component.cc \
|
||||
signal_session_component.cc \
|
||||
signal_source_component.cc \
|
||||
thread.cc \
|
||||
thread_linux.cc \
|
||||
context_area.cc \
|
||||
debug.cc \
|
||||
rm_session_mmap.cc
|
||||
core_printf.cc \
|
||||
thread.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/core/include \
|
||||
$(GEN_CORE_DIR)/include \
|
||||
$(REP_DIR)/src/platform \
|
||||
$(REP_DIR)/src/base/ipc \
|
||||
$(REP_DIR)/src/base/env
|
||||
$(REP_DIR)/src/base/env \
|
||||
$(REP_DIR)/src/base/console
|
||||
|
||||
HOST_INC_DIR += /usr/include
|
||||
|
||||
@@ -43,12 +43,11 @@ LD_SCRIPT_STATIC = $(LD_SCRIPT_DEFAULT) \
|
||||
endif
|
||||
|
||||
vpath main.cc $(GEN_CORE_DIR)
|
||||
vpath thread.cc $(BASE_DIR)/src/base/thread
|
||||
vpath ram_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath cpu_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath platform_services.cc $(GEN_CORE_DIR)
|
||||
vpath signal_session_component.cc $(GEN_CORE_DIR)
|
||||
vpath signal_source_component.cc $(GEN_CORE_DIR)
|
||||
vpath debug.cc $(REP_DIR)/src/base/env
|
||||
vpath rm_session_mmap.cc $(REP_DIR)/src/base/env
|
||||
vpath core_printf.cc $(BASE_DIR)/src/base/console
|
||||
vpath thread.cc $(BASE_DIR)/src/base/thread
|
||||
vpath %.cc $(PRG_DIR)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
TARGET = test-lx_hybrid_ctors
|
||||
SRC_CC = main.cc
|
||||
LIBS = env lx_hybrid
|
||||
LIBS = lx_hybrid
|
||||
|
||||
TESTLIB_SO = libtestlib.so
|
||||
TESTLIB_SRC_CC = testlib.cc
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
TARGET = test-lx_hybrid_errno
|
||||
SRC_CC = main.c
|
||||
LIBS = env cxx thread lx_hybrid
|
||||
LIBS = lx_hybrid
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
TARGET = test-lx_hybrid_exception
|
||||
SRC_CC = main.cc
|
||||
LIBS = env lx_hybrid
|
||||
LIBS = lx_hybrid
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
TARGET = test-lx_hybrid_pthread_ipc
|
||||
SRC_CC = main.c
|
||||
LIBS = env cxx thread lx_hybrid
|
||||
LIBS = lx_hybrid
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
TARGET = test-rm_session_mmap
|
||||
LIBS = cxx env
|
||||
LIBS = base
|
||||
SRC_CC = main.cc
|
||||
|
||||
Reference in New Issue
Block a user