Commit f60bc573 authored by Charlie Jacobsen's avatar Charlie Jacobsen
Browse files

lcd: Finish setting up autoconf crap; first draft.

parent 9a69706b
......@@ -14,12 +14,11 @@ AM_INIT_AUTOMAKE([subdir-objects foreign])
# libfipc features, packages, and config
# --------------------------------------------------
# Platform = user xor kernel
# Platform = kernel
# (other platforms to be added later ... )
AC_ARG_VAR([PLATFORM],
[The platform to build for @{:@user|kernel@:}@ (default=kernel)])
[The platform to build for @{:@kernel@:}@ (default=kernel)])
AS_CASE([$PLATFORM],
[user],
[PLATFORM_DIR=platform/user],
[kernel],
[PLATFORM_DIR=platform/kernel],
[*],
......@@ -33,45 +32,30 @@ AC_MSG_NOTICE([Building for PLATFORM=$PLATFORM.])
AC_SUBST(PLATFORM)
AC_SUBST(PLATFORM_DIR)
# Kernel module build?
# Build kernel test modules?
AS_IF([test "x$PLATFORM" = "xkernel"],
[
# Build libcap as kernel module, in addition to static lib.a
AC_ARG_ENABLE([kernel_module],
[AS_HELP_STRING([--disable-kernel-module],
[Disable kernel module build (default=no)])],
[],
[enable_kernel_module="yes"])
AM_CONDITIONAL(ENABLE_KERNEL_MODULE,
[test "x$enable_kernel_module" = "xyes"])
AM_COND_IF([ENABLE_KERNEL_MODULE],
[AC_MSG_NOTICE([Building kernel module.])],
[AC_MSG_NOTICE([Not building kernel module.])])
AC_ARG_ENABLE([kernel_tests_build],
[AS_HELP_STRING([--enable-kernel-tests-build],
[Enable building kernel test modules (default=no)])],
[],
[enable_kernel_tests_build="no"])
AM_CONDITIONAL(ENABLE_KERNEL_TESTS_BUILD,
[test "x$enable_kernel_tests_build" = "xyes"])
AM_COND_IF([ENABLE_KERNEL_TESTS_BUILD],
[AC_MSG_NOTICE([Building kernel tests.])],
[AC_MSG_NOTICE([Not building kernel tests.])])
],
[
AM_CONDITIONAL(ENABLE_KERNEL_MODULE,
AM_CONDITIONAL(ENABLE_KERNEL_TESTS_BUILD,
[false])
])
# Build tests?
AC_ARG_ENABLE([test_build],
[AS_HELP_STRING([--enable-test-build],
[Enable building test applications (default=no)])],
[],
[enable_test_build="no"])
AM_CONDITIONAL(ENABLE_TEST_BUILD,
[test "x$enable_test_build" = "xyes"])
AM_COND_IF([ENABLE_TEST_BUILD],
[AC_MSG_NOTICE([Building tests.])],
[AC_MSG_NOTICE([Not building tests.])])
# --------------------------------------------------
# Checks for programs.
# --------------------------------------------------
......@@ -145,23 +129,13 @@ AC_CONFIG_FILES(
src/common/Makefile
src/include/Makefile
src/include/libcap_config.h
src/include/libcap_types.h
src/include/libcap.h
src/platform/Makefile
src/platform/kernel/Makefile
src/Kbuild:src/platform/kernel/Kbuild.in
src/platform/kernel/src/Makefile
src/platform/kernel/module/Makefile
src/platform/kernel/module/Kbuild
src/platform/kernel/Kbuild.in
src/platform/kernel/include/Makefile
src/platform/kernel/test/Makefile
src/platform/user/Makefile
src/platform/user/src/Makefile
src/platform/user/include/Makefile
src/platform/user/test/Makefile
src/platform/kernel/tests/Makefile
src/platform/kernel/tests/Kbuild.in
)
AC_OUTPUT
COMMON_SRCS = \
common/ipc.o \
COMMON_INCLUDES = include
SUBDIRS = common include $(PLATFORM_DIR)
DIST_SUBDIRS = common include platform
nobase_include_HEADERS = libfipc.h libfipc_types.h
noinst_HEADERS = libfipc_internal.h
# Recurse into correct subdir
SUBDIR = $(PLATFORM)
# Include all platforms in a tarball distribution
DIST_SUBDIRS = kernel
# @FIPC_AUTOCONF_NOTICE@
# Build libfipc as static library. Unfortunately, the name of the
# library is hard-coded in the kernel build system to be lib.a. (We
# have an extra build step that cp's lib.a -> libfipc.a.)
# Note: Kernel expects the files to be relative paths (it always prepends
# the current directory).
# This single line of magic makes it so we can do an out of src tree
# build. It has to do with how and where this Kbuild file is included
# in the kernel build system.
src = @abs_top_srcdir@/src
# Sources that make up library
lib-y += \
$(COMMON_SRCS:.c=.o)
# Pass along include directories from the Automake file
ccflags-y += $(CFLAGS) $(AM_CPPFLAGS)
# Part of what makes the kernel build more complex is we need to use
# phony targets to link the kernel build system in with this one.
# Include all dirs for distribution/tarball
DIST_SUBDIRS = include tests
# Recurse into headers only for all targets (we manually recur into
# other dirs)
SUBDIRS = include
# Kernel headers
KERNEL_INCLUDES = -I$(abs_top_srcdir)/src/platform/kernel/include
# Add includes to include search path. (The root of the builddir is necessary to
# add explicitly for the kernel build, because some of the headers are
# generated by configure.)
AM_CPPFLAGS = \
-I$(abs_top_builddir) \
-I$(abs_top_srcdir)/src/include \
-I$(abs_top_builddir)/src/include \
$(KERNEL_INCLUDES)
# Necessary to export so that these variables are available in Kbuilds
export AM_CPPFLAGS COMMON_SRCS
LIBFIPC_KBUILD=@abs_top_builddir@/src/platform/kernel
LIBFIPC_TESTS_KBUILD=@abs_top_builddir@/src/platform/kernel/tests
if ENABLE_KERNEL_TESTS_BUILD
MAYBE_ALL_TESTS = all-tests
MAYBE_INSTALL_TESTS = install-tests
MAYBE_DO_MODULES_INSTALL = do-modules-install
MAYBE_CLEAN_TESTS = clean-tests
endif
# BUILD ------------------------------------------------------------
# Sequence the build, so we build libfipc first
all: all-lib-cp $(MAYBE_ALL_TESTS)
all-tests: all-lib-cp
$(MAKE) -C $(KDIR) M=$(LIBFIPC_TESTS_KBUILD) modules
all-lib-cp: all-lib
cp $(LIBFIPC_KBUILD)/lib.a $(LIBFIPC_KBUILD)/libfipc.a
all-lib:
$(MAKE) -C $(KDIR) M=$(LIBFIPC_KBUILD)
# INSTALL ------------------------------------------------------------
# Move libfipc.a into install dir, and conditionally move test modules
install-exec-hook: install-libfipc $(MAYBE_INSTALL_TESTS)
install-tests: install-setup-dir
$(MAKE) -C tests install-tests D=$(DESTDIR)$(libdir) # manually recur
install-libfipc: install-setup-dir
cp $(LIBFIPC_KBUILD)/libfipc.a $(DESTDIR)$(libdir)
install-setup-dir:
$(MKDIR_P) $(DESTDIR)$(libdir)
# MODULES INSTALL --------------------------------------------------
do-modules-install:
$(MAKE) -C $(KDIR) M=$(LIBFIPC_TESTS_KBUILD) modules_install
modules_install: $(MAYBE_DO_MODULES_INSTALL)
# CLEAN ------------------------------------------------------------
clean: clean-lib $(MAYBE_CLEAN_TESTS)
clean-tests:
$(MAKE) -C $(KDIR) M=$(LIBFIPC_TESTS_KBUILD) clean
clean-lib:
$(MAKE) -C $(KDIR) M=$(LIBFIPC_KBUILD) clean
rm -f $(LIBFIPC_KBUILD)/libcap.a
.PHONY: all-tests all-lib all-lib-cp \
install-tests install-libfipc install-setup-dir \
do-modules-install modules_install \
clean-tests clean-lib
nobase_include_HEADERS = \
libfipc_platform_types.h
noinst_HEADERS = \
libfipc_platform_internal.h
# Empty for now
\ No newline at end of file
# No op for now
# D=install dir
install-tests:
Supports Markdown
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