Commit 2c945e8c authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

build-refactor-2: Set up liblcd build, and libcap build for liblcd.

The libcap build won't work quite yet, or won't be set up properly
for liblcd rather. I need to tweak the libcap kernel build and/or
add a new platform.
parent 088970e6
......@@ -17,8 +17,11 @@
# under version control though, FYI.)
#
# Common top-level vars used throughout
LCD_DOMAINS_TOP_SRC_DIR=$(PWD)
export LCD_DOMAINS_TOP_SRC_DIR
export LCD_DOMAINS_CFLAGS=-Werror \
-DLCD_DOMAINS
# Don't print "Entering directory..." etc.
MAKEFLAGS += --no-print-directory
......@@ -29,10 +32,12 @@ MAKEFLAGS += --no-print-directory
# in our Kbuild files.)
ARCH=x86
LCD_BUILD_DIR=$(LCD_DOMAINS_TOP_SRC_DIR)/build
# ------------------------------------------------------------
# Microkernel build setup
MICROKERNEL_BUILD_DIR=$(LCD_DOMAINS_TOP_SRC_DIR)/microkernel_build
MICROKERNEL_BUILD_DIR=$(LCD_BUILD_DIR)/microkernel_build
export MICROKERNEL_BUILD_DIR
MICROKERNEL_DIRS= \
......@@ -75,6 +80,49 @@ $(MICROKERNEL_BUILD_DIR)/Kbuild: scripts/Kbuild.microkernel | \
$(MICROKERNEL_BUILD_DIRS):
mkdir -p $@
# ------------------------------------------------------------
# LIBLCD build setup
LIBLCD_BUILD_DIR=$(LCD_BUILD_DIR)/liblcd_build
export LIBLCD_BUILD_DIR
LIBLCD_DIRS= \
lcd-domains \
lcd-domains/async \
mm \
lib \
libcap.build \
libcap.install \
common
LIBLCD_BUILD_DIRS=$(foreach dir,$(LIBLCD_DIRS),\
$(LIBLCD_BUILD_DIR)/$(dir))
LIBLCD_LIBCAP=$(LIBLCD_BUILD_DIR)/libcap.install/lib/libcap.a
liblcd: $(LIBLCD_BUILD_DIR)/Kbuild $(LIBLCD_LIBCAP) | \
$(LIBLCD_BUILD_DIRS)
$(MAKE) -C .. M=$(LIBLCD_BUILD_DIR) -j8
libcap.liblcd: $(LIBLCD_BUILD_DIR)/libcap.build/Makefile
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libcap.build && \
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libcap.build install
$(LIBLCD_BUILD_DIR)/libcap.build/Makefile: libcap/configure | \
$(LIBLCD_BUILD_DIRS)
cd $(LIBLCD_BUILD_DIR)/libcap.build && \
$(LCD_DOMAINS_TOP_SRC_DIR)/libcap/configure \
PLATFORM=kernel --disable-test-build \
--with-kernel-headers=$(LCD_DOMAINS_TOP_SRC_DIR)/.. \
--disable-kernel-module \
--prefix=$(LIBLCD_BUILD_DIR)/libcap.install
$(LIBLCD_BUILD_DIR)/Kbuild: scripts/Kbuild.liblcd | \
$(LIBLCD_BUILD_DIRS)
cp scripts/Kbuild.liblcd $(LIBLCD_BUILD_DIR)/Kbuild
$(LIBLCD_BUILD_DIRS):
mkdir -p $@
# ------------------------------------------------------------
# Some libcap tidbits
......@@ -86,15 +134,26 @@ libcap/configure: libcap/configure.ac
clean:
$(MAKE) -C .. M=$(MICROKERNEL_BUILD_DIR) clean
$(MAKE) -C .. M=$(LIBLCD_BUILD_DIR) clean
if test -d $(MICROKERNEL_BUILD_DIR)/libcap.build; then \
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libcap.build clean; \
fi
if test -d $(LIBLCD_BUILD_DIR)/libcap.build; then \
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libcap.build clean; \
fi
rm -rf $(MICROKERNEL_BUILD_DIR)/libcap.install
rm -rf $(LIBLCD_BUILD_DIR)/libcap.install
distclean:
rm -rf $(MICROKERNEL_BUILD_DIR)
rm -rf $(LCD_BUILD_DIR)
# ------------------------------------------------------------
# phonies
.PHONY: microkernel libcap.microkernel clean distclean
.PHONY: \
microkernel \
libcap.microkernel \
liblcd \
libcap.liblcd \
clean \
distclean
/*
* post_hook.h
*
* #include this file after all #include's in a source
* file. Do not #include this in a header.
*
* This overwrites macros, defs, etc. that the top-level
* kernel puts in place that we want to change for the
* isolated environment.
*/
#include <lcd-domains/liblcd-config.h>
#include <lcd-domains/liblcd.h>
#include <liblcd/liblcd.h>
/*
* Misc macros, etc.
......
/*
* Ensure we use the right config
* pre_hook.h
*
* This should be included at the top of every source
* file that could possibly be built for the isolated
* environment. It ensures the build configuration
* is correct.
*
* This file should never be put in a header itself, only
* in .c files. (We want this file to be included exactly
* once before all other code.)
*/
#undef CONFIG_DEBUG_OBJECTS
#undef CONFIG_KMEMCHECK
#undef CONFIG_DEBUG_KMEMLEAK
......
#
# Build file for liblcd
#
# I hack KBUILD_CFLAGS so we don't have to do this in every kbuild file.
KBUILD_CFLAGS := $(KBUILD_CFLAGS) $(LCD_DOMAINS_CFLAGS)
lib-y += $(addprefix lcd/, cap.o \
enterexit.o \
ipc.o \
page_alloc.o \
printk.o \
dstore.o \
tests.o)
lib-y += $(addprefix async/, thc.o \
thcsync.o)
lib-y += $(addprefix lib/, find_next_bit.o \
kstrtox.o \
string.o \
vsprintf.o \
ctype.o \
hexdump.o \
reciprocal_div.o)
lib-y += $(addprefix mm/, slab.o \
slab_common.o \
util.o)
lib-y += resolve.o
......@@ -29,12 +29,12 @@
#include <barrelfish/waitset.h>
#include <thc/thc.h>
#elif LCD_DOMAINS
#include <lcd-domains/liblcd-config.h>
#include <lcd-domains/thc.h>
#include <lcd-domains/thcsync.h>
#include <lcd-domains/thcinternal.h>
#include <lcd_config/pre_hook.h>
#include <liblcd/thc.h>
#include <liblcd/thcsync.h>
#include <liblcd/thcinternal.h>
#include <linux/slab.h>
#include <lcd-domains/liblcd-hacks.h>
#include <lcd_config/post_hook.h>
#else
#include "thc.h"
#endif
......
......@@ -16,9 +16,9 @@
#include <Windows.h>
#include <thc/thc.h>
#elif LCD_DOMAINS
#include <lcd-domains/liblcd-config.h>
#include <lcd-domains/thc.h>
#include <lcd-domains/liblcd-hacks.h>
#include <lcd_config/pre_hook.h>
#include <liblcd/thc.h>
#include <lcd_config/post_hook.h>
#else
#include "thc.h"
#endif
......
#
# Kernel build file for liblcd
#
# Paths are all relative to the liblcd build dir (exported
# and available in this file as $(LIBLCD_BUILD_DIR)).
# 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 = $(LCD_DOMAINS_TOP_SRC_DIR)/liblcd
lib-y += $(addprefix lcd-domains/, \
allocator.o \
boot_info.o \
cap.o \
console.o \
create.o \
enter_exit.o \
heap.o \
mem_itree.o \
module_load.o \
ram_map.o \
sync_ipc.o \
)
# Soon this will be module'd like libcap
lib-y += $(addprefix lcd-domains/async/, \
thc.o \
thcsync.o \
)
lib-y += $(addprefix lib/, \
find_next_bit.o \
kstrtox.o \
string.o \
vsprintf.o \
ctype.o \
hexdump.o \
reciprocal_div.o \
)
lib-y += $(addprefix mm/,
slab.o \
slab_common.o \
util.o \
)
lib-y += resolve.o
# code shared by kliblcd and isolated liblcd
lib-y += $(addprefix common/, \
resource_tree.o \
module_create.o \
)
# libcap
lib-y += libcap.install/lib/libcap.a
# Extra includes
ccflags-y += \
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(LIBLCD_BUILD_DIR)/libcap.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated \
-DCONFIG_LAZY_THC
......@@ -2,7 +2,8 @@
# Kernel build file for microkernel
#
# Paths are all relative to the microkernel build dir.
# Paths are all relative to the microkernel build dir (exported
# and available in this file as $(MICROKERNEL_BUILD_DIR)).
# 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
......@@ -54,7 +55,8 @@ lcd_domains-y += libcap.install/lib/libcap.a
# Extra includes
ccflags-y += \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(MICROKERNEL_BUILD_DIR)/libcap.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated
\ No newline at end of file
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(MICROKERNEL_BUILD_DIR)/libcap.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated
\ No newline at end of file
......@@ -2,3 +2,5 @@
make libcap.microkernel
make microkernel
make libcap.liblcd
make liblcd
\ No newline at end of file
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