Commit 5aa522b7 authored by Charlie Jacobsen's avatar Charlie Jacobsen

reorganize: User build and install appears to be working.

parent e7786bf6
Pipeline #406 skipped
# Ignore most files made by `bootstrap'.
*Makfile.in
*Makefile.in
aclocal.m4
autom4te.cache
config.h.in
......
......@@ -42,17 +42,19 @@ AC_ARG_VAR([PLATFORM],
[The platform to build for @{:@user|kernel@:}@ (default=user)])
AS_CASE([$PLATFORM],
[user],
[],
[PLATFORM_DIR=platform/user],
[kernel],
[],
[PLATFORM_DIR=platform/kernel],
[*],
[
AC_MSG_NOTICE([PLATFORM (val=$PLATFORM) unset or invalid.])
AC_MSG_NOTICE([Defaulting to PLATFORM=user.])
PLATFORM=user
PLATFORM_DIR=platform/user
])
AC_MSG_NOTICE([Building for PLATFORM=$PLATFORM.])
AC_SUBST(PLATFORM)
AC_SUBST(PLATFORM_DIR)
# CSpace depth. We use bits to enforce that the depth is a power of 2.
AC_ARG_VAR([CSPACE_DEPTH_BITS],
......@@ -69,6 +71,7 @@ AS_CASE([$CSPACE_DEPTH_BITS],
AC_MSG_ERROR([CSpace depth bits (val=$CSPACE_DEPTH_BITS) invalid. Please choose a value between 0 and 8.])
])
AC_MSG_NOTICE([CSpace depth bits = $CAP_CSPACE_DEPTH_BITS.])
AC_SUBST(CAP_CSPACE_DEPTH_BITS)
# CNode table size. Again, we use bits to enforce that it's a power of 2.
AC_ARG_VAR([CSPACE_CNODE_TABLE_BITS],
......@@ -85,6 +88,7 @@ AS_CASE([$CSPACE_CNODE_TABLE_BITS],
AC_MSG_ERROR([CSpace cnode table bits (val=$CSPACE_CNODE_TABLE_BITS) invalid. Please choose a value between 1 and 9.])
])
AC_MSG_NOTICE([CNode table bits = $CAP_CSPACE_CNODE_TABLE_BITS.])
AC_SUBST(CAP_CSPACE_CNODE_TABLE_BITS)
# Kernel module build?
AS_IF([test "x$PLATFORM" = "xkernel"],
......@@ -257,20 +261,19 @@ AC_CONFIG_FILES(
Makefile
src/Makefile
src/include/Makefile
src/common/Makefile
src/include/Makefile
src/include/libcap_config.h
src/platform/Makefile
src/platform/kernel/Makefile
src/platform/kernel/top_level
src/platform/kernel/src/Makefile
src/platform/kernel/module/Kbuild:src/platform/kernel/module/Kbuild.in
src/platform/Kbuild:src/platform/kernel/Kbuild.in
src/platform/kernel/include/Makefile
src/platform/user/Makefile
src/platform/user/top_level
src/platform/user/src/Makefile
src/platform/user/include/Makefile
......
COMMON_SRCS = \
common/cap.o \
common/cptr_cache.o
COMMON_INCLUDES = include
SUBDIRS = common include $(PLATFORM_DIR)
DIST_SUBDIRS = common include platform
COMMON_SRCS = common/cap.o common/cptr_cache.o
COMMON_INCLUDES = -Iinclude
include platform/$(PLATFORM)/top_level.am
......@@ -444,7 +444,7 @@ static int __cap_cnode_get(struct cspace *cspace, cptr_t c,
ret = __cap_cnode_lookup(cspace, c, alloc, cnode);
if (ret) {
CAP_DEBUG(CAP_DEBUG_MSG,
"cnode lookup failed with ret = %d\n", ret)
"cnode lookup failed with ret = %d\n", ret);
goto fail2;
}
......
nobase_include_HEADERS = libcap.h libcap_types.h list.h
nobase_include_HEADERS = libcap.h libcap_types.h libcap_list.h libcap_config.h
noinst_HEADERS = libcap_internal.h list.h
noinst_HEADERS = libcap_internal.h
......@@ -31,14 +31,14 @@ extern int cap_debug_level;
#define CAP_DEBUG_WARN 2
#define CAP_DEBUG_MSG 3
#define CAP_DEBUG(lvl, msg, ...) { \
if (lvl <= cap_debug_level) \
__cap_debug(msg,## __VA_ARGS__); \
}
#define CAP_DEBUG(lvl, msg, ...) do { \
if (lvl <= cap_debug_level) \
__cap_debug(msg,## __VA_ARGS__); \
} while(0)
#define CAP_BUG() __cap_bug()
#define CAP_BUG() do { __cap_bug(); } while(0)
#define CAP_BUG_ON(cond) __cap_bug_on()
#define CAP_BUG_ON(cond) do { __cap_bug_on(cond); } while(0)
/* CPTRs -------------------------------------------------- */
......
# This file is only used for dist (tarball) targets, etc., not for builds.
# For builds, top_level.am is included in $(top_srcdir)/src/Makefile.am.
# Recurse into subdirs
# Include all dirs for distribution/tarball
DIST_SUBDIRS = include src module
# Include all dirs. Only include is really needed now for install.
SUBDIRS = include src module
# Kernel files
KERNEL_INCLUDES = -I$(abs_top_srcdir)/src/platform/kernel/include
# Add includes to include search path
AM_CPPFLAGS = \
-I$(abs_top_srcdir)/src/include \
-I$(abs_top_builddir)/src/include \
$(KERNEL_INCLUDES) \
$(GLIB_INCLUDES)
COMMON_SRCS = \
../common/cap.c \
../common/cptr_cache.c
export AM_CPPFLAGS COMMON_SRCS
LIBCAP_KBUILD=$(PWD)
LIBCAP_KERNEL_MODULE_KBUILD=$(PWD)/platform/kernel/module
# Automake if's aren't as powerful as GNU Make's (partly since Automake
# doesn't know the config selections when it does its job)
all_cmd = $(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) \
CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" modules
install_cmd = $(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) modules_install
clean_cmd = $(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) clean
if ENABLE_KERNEL_MODULE
all_cmd += ; $(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) \
CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" modules
install_cmd += ; $(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) \
modules_install
clean_cmd += ; $(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) clean
endif
all:
$(all_cmd)
install:
$(install_cmd)
clean:
$(clean_cmd)
# Kernel files
KERNEL_INCLUDES = -Iplatform/kernel/include
# Add includes to include search path
AM_CPPFLAGS = $(COMMON_INCLUDES) $(KERNEL_INCLUDES) $(GLIB_INCLUDES)
export COMMON_INCLUDES COMMON_SRCS
LIBCAP_KBUILD=$(PWD)
LIBCAP_KERNEL_MODULE_KBUILD=$(PWD)/platform/kernel/module
# Automake if's aren't as powerful as GNU Make's (boo)
all_cmd = $(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) \
CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" modules
install_cmd = $(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) modules_install
clean_cmd = $(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) clean
if ENABLE_KERNEL_MODULE
all_cmd += ; $(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) \
CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" modules
install_cmd += ; $(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) \
modules_install
clean_cmd += ; $(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) clean
endif
all:
$(all_cmd)
install:
$(install_cmd)
clean:
$(clean_cmd)
# This file is only used for dist (tarball) targets, etc., not for builds.
# For builds, top_level.am is included in $(top_srcdir)/src/Makefile.am.
# Recurse into subdirs
# Include all dirs for distribution/tarball
DIST_SUBDIRS = include src
# Include all dirs. Only include is really needed now for install.
SUBDIRS = include src
# User files. Note that we need to use absolute paths for
# includes because we're jumping back up the directory tree
# to compile common source.
USER_SRCS = \
../../common/cap.c \
../../common/cptr_cache.c \
src/cap_user.c \
src/cptr_cache_user.c
USER_INCLUDES = -I$(abs_top_srcdir)/src/platform/user/include
# Add includes to include search path
AM_CPPFLAGS = \
-I$(abs_top_srcdir)/src/include \
-I$(abs_top_builddir)/src/include \
$(USER_INCLUDES) \
$(GLIB_INCLUDES)
# Build libcap as static lib
lib_LIBRARIES = libcap.a
libcap_a_SOURCES = $(USER_SRCS)
libcap_a_LIBADD = $(GLIB_LDFLAGS)
# automake hack so we can build both libs:
# (see: https://www.gnu.org/software/automake/manual/html_node/Objects-created-both-with-libtool-and-without.html)
libcap_a_CFLAGS = $(AM_CFLAGS)
# Build libcap as shared lib using libtool
lib_LTLIBRARIES = libcap.la
libcap_la_SOURCES = $(USER_SRCS)
libcap_la_LIBADD = $(GLIB_LDFLAGS)
......@@ -6,8 +6,6 @@
#include <pthread.h>
#include <assert.h>
CAP_BUILD_CORE_TYPES_NOBUILTIN();
#define __cap_err(format,...) \
fprintf(stderr,"CERR: %s:%d: "format,__FUNCTION__,__LINE__,## __VA_ARGS__)
#define __cap_warn(format,...) \
......
# User files
USER_SRCS = \
platform/user/src/cap.o \
platform/user/src/cptr_cache.o
USER_INCLUDES = -Iplatform/user/include
# Add includes to include search path
AM_CPPFLAGS = $(COMMON_INCLUDES) $(USER_INCLUDES) $(GLIB_INCLUDES)
# Build libcap as static lib
lib_LIBRARIES = libcap.a
libcap_a_SOURCES = $(USER_SRCS)
libcap_a_LIBADD = $(GLIB_LDFLAGS)
# Build libcap as shared lib using libtool
lib_LTLIBRARIES = libcap.la
libcap_la_SOURCES = $(USER_SRCS)
libcap_la_LIBADD = $(GLIB_LDFLAGS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment