[Cbe-oss-dev] [patch 2/4] MARS: Build file cleanup

Geoff Levand geoffrey.levand at am.sony.com
Sun Aug 24 12:51:21 EST 2008


Cleanup build files:
 o Use the git revision for package version.
 o Add configure options --with-mars-host and --with-mars-mpu to support
   platform specific builds.
 o Add host lib configure option --with-mars-kernel to allow building with
   custom kernels.
 o Move embedspu from mpu makefile to host makefile.
 o Change default prefix from /usr to /usr/local/mars.
 o Remove 'host_alias=spu' hack with top level configure logic.
 o Remove unneeded Makefile.am files.
 o Remove unneeded files config.sub.patch, VERSION.
 o Update README file.

Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
 Makefile.am                  |   11 ---
 README                       |   76 ++++++-------------------
 VERSION                      |    2 
 bootstrap                    |   61 +++++++++++++-------
 config.sub.patch             |   24 --------
 configure.ac.in              |  113 ++++++++++++++++++++++++++++++++------
 include/Makefile.am          |   90 ------------------------------
 src/Makefile.am              |   41 -------------
 src/host/Makefile.am         |   46 ---------------
 src/host/bootstrap           |   53 ------------------
 src/host/config.sub.patch    |   24 --------
 src/host/configure.ac.in     |   55 ------------------
 src/host/lib/Makefile.am     |  126 +++++++++++++++++++++++++++++++++----------
 src/host/lib/bootstrap       |   48 ++++++++++++++++
 src/host/lib/configure.ac.in |   93 +++++++++++++++++++++++++++++++
 src/mpu/Makefile.am          |    5 -
 src/mpu/bootstrap            |    7 --
 src/mpu/config.sub.patch     |   24 --------
 src/mpu/configure.ac.in      |   55 ++++++++++++------
 src/mpu/kernel/Makefile.am   |   93 +++++++++++++++++++++----------
 src/mpu/lib/Makefile.am      |   79 +++++++++++++++++++-------
 21 files changed, 554 insertions(+), 572 deletions(-)

--- a/Makefile.am
+++ b/Makefile.am
@@ -36,15 +36,8 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
-SUBDIRS = include src
+SUBDIRS = src/mpu src/host/lib
 
-EXTRA_DIST = \
-	bootstrap \
-	configure.ac.in \
-	config.sub.patch \
-	COPYING \
-	INSTALL \
-	README \
-	VERSION
+EXTRA_DIST = bootstrap configure.ac.in
 
 MAINTAINERCLEANFILES = Makefile.in
--- a/README
+++ b/README
@@ -37,24 +37,14 @@
 
 MARS Library README
 
-Index
-=====
-	* Overview
-	* Building Source
-	* Installing Library
-	* Using Library
-
-
 Overview
 ========
-The MARS (Multicore Application Runtime System) provides an API to easily manage
+
+The MARS (Multicore Application Runtime System) provides an API to manage
 and create user programs that will be scheduled to run on various MPUs of a
 multicore-core environment with minimal runtime support required of the host.
 
-For more specific details, please refer to the MARS Reference Manual
-documentation that is generated from the build.
-
-/mars-lib
+/mars
 |
 |---/include		Include directory
 |   |
@@ -81,54 +71,28 @@ documentation that is generated from the
 
 Building Source
 ================
-Run configure and make
-----------------------
-To build the MARS library source, you need to first run ./configure from the
-top-level directory, and then do a ./make. The build supports both native and
-cross compiling.
-
-You need to specify whether you are building libraries for a 32-bit host or
-64-bit host.
-
-32-bit host
----------------------
-[mars-lib]$ ./configure --host=ppu --libdir="/usr/lib"
-[mars-lib]$ make HOST_FLAGS=-m32
-
-64-bit host
----------------------
-[mars-lib]$ ./configure --host=ppu --libdir="/usr/lib64"
-[mars-lib]$ make HOST_FLAGS=-m64
-
-The '--libdir' option to './configure' specifies the target directory to where
-the compiled libraries will be installed. Make sure to specify the correct path
-to the target userland path when doing a cross compile.
-
 
-Installing Library
-==================
-After building of the library is complete, you need to install the library to
-the system standard paths. As an alternative you can also choose to install the
-library using the RPMs explained in the previous section.
+* See the source file INSTALL.
 
-[mars-lib]$ make install
+* The configure scripts require the following options:
 
-When installation is complete, the MARS library files can be found in the
-following locations:
+  --with-mars-host
+  --with-mars-mpu
+  --with-mars-kernel
 
-MARS host includes:	/usr/include
-MARS host libraries:	/usr/lib or /usr/lib64
-MARS MPU includes:	/usr/mpu/include
-MARS MPU libraries:	/usr/mpu/lib
+Run configure with the --help option for more info.  For example, to build for
+the Cell Broadband Engine use options similar to these:
 
+  ./configure --with-mars-host=cell --with-mars-mpu=cell \
+  --with-mars-kernel=`pwd`/src/mpu/kernel/mars-kernel
 
-Using Library
-=============
-Using the library is a matter of including the MARS library headers in your
-programs and linking the appropriate MARS library and C runtime.
+* Use the prefixes PPU_ and SPU_ on command line variables to the top level
+configure or makefile to specify variables for the different toolchains.
+For example, when using the Cell SDK toolchains use options similar to these:
 
-For more information regarding MARS library usage, please refer to the MARS Docs
-package.
+  ./configure PPU_EMBEDSPU=ppu-embedspu PPU_CC=ppu-gcc \
+  PPU_CFLAGS="-m32 -g -DDEBUG" SPU_CC=spu-gcc SPU_CFLAGS="-g -DDEBUG"
 
-For sample code that shows usage of the MARS library, please refer to the MARS
-Samples package.
+* When building 64-bit libraries for a powerpc host it is customary to use
+the --libdir configure option install the libraries in a EPREFIX/lib64
+directory.  Run configure with the --help option for more info.
--- a/VERSION
+++ /dev/null
@@ -1,2 +0,0 @@
-0.9.0
-
--- a/bootstrap
+++ b/bootstrap
@@ -37,33 +37,54 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
-if [ $VERSION ]; then
-	version=$VERSION
-	echo "VERSION =" $version
-elif [ -f VERSION ]; then
-	version=`cat VERSION`
-	echo "VERSION =" $version
+version=
+
+if [ "$1" ]; then
+	version=$1
+elif head=$(git rev-parse --short --verify HEAD 2>/dev/null); then
+
+	# If available, use the git commit revision for the package version.
+
+	months="Jan:01 Feb:02 Mar:03 Apr:04 May:05 Jun:06 Jul:07 Aug:08 \
+		Sep:09 Oct:10 Nov:11 Dec:12"
+
+	# Add a date prefix for easy reading.
+
+	date=$(git-log --pretty=format:"%cD" -1 HEAD)
+
+	# date='Fri, 2 Aug 2007 19:36:06 -0700'
+
+	date=${date##*, }
+	date=${date% [0-9][0-9]:*}
+	day=${date%* [A-Z][a-z][a-z] *}
+	year=${date##* [A-Z][a-z][a-z] 20}
+	month=${date##${day} }
+	month=${month%% 20${year}}
+	month=${months##*${month}:}
+	month=${month%% *}
+	[ ! ${day#[0-9][0-9]} ] || day="0$day"
+
+	version=$(printf '%s.%s.%s-%s%s' ${year} ${month} ${day} g ${head})
+
+	# Add a '-dirty' postfix for uncommitted changes.
+
+	if git diff-index HEAD | read dummy; then
+		version=`printf '%s%s' ${version} -dirty`
+	fi
 else
-	version=""
-	echo "No VERSION file found!"
+	# Default to date and time.
+
+	version="dev-$(date +%y.%m.%d-%H.%M.%S)"
 fi
 
-version_maj=$(echo ${version} | sed -e 's/\.[0-9.]*//')
-version_min=$(echo ${version} | sed -e 's/^[0-9]*\.//' | sed -e 's/\.[0-9]*$//')
-version_rev=$(echo ${version} | sed -e 's/[0-9.]*\.//')
+set -x
 
-sed -e s, at version@,${version},g \
-	configure.ac.in > configure.ac
+sed -e s, at version@,${version},g configure.ac.in > configure.ac
 
 aclocal
-libtoolize --force --copy
 autoheader
 automake --foreign --add-missing --copy
 autoconf
 
-pushd src/host && ./bootstrap $version && popd
-pushd src/mpu && ./bootstrap $version && popd
-
-if [ -e config.sub ]; then
-	patch -p1 < config.sub.patch
-fi
+pushd src/mpu && ./bootstrap ${version} ; popd
+pushd src/host/lib && ./bootstrap ${version} ; popd
--- a/config.sub.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/config.sub	2005-11-22 05:18:02.000000000 -0800
-+++ b/config.sub	2006-07-11 12:09:36.000000000 -0700
-@@ -816,6 +816,10 @@
- 	ppc64le-* | powerpc64little-*)
- 		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- 		;;
-+	ppu)
-+		basic_machine=powerpc64-cell
-+		os=-linux
-+		;;
- 	ps2)
- 		basic_machine=i386-ibm
- 		;;
-@@ -868,6 +872,10 @@
- 	spur)
- 		basic_machine=spur-unknown
- 		;;
-+	spu)
-+		basic_machine=spu-cell
-+		os=-none
-+		;;
- 	st2000)
- 		basic_machine=m68k-tandem
- 		;;
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -36,28 +36,105 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
-AC_INIT(mars, @version@, Yuji Mano <yuji.mano at am.sony.com>)
+AC_INIT([mars], [@version@], [MARS <cbe-oss-dev at ozlabs.org>])
 
-AC_PREFIX_DEFAULT(/usr)
+AC_PREFIX_DEFAULT([/usr/local/mars])
 
-if test "x${prefix}" = "xNONE"; then
-	prefix=$ac_default_prefix
-	ac_configure_args="$ac_configure_args --prefix $prefix"
-fi
+AC_ARG_WITH([mars-kernel],
+	[AS_HELP_STRING([--with-mars-kernel=PATH-TO-FILE],
+		[specify mars kernel ELF file])],
+	[MARS_KERNEL=${withval}],
+	[AC_MSG_ERROR([missing option --with-mars-kernel=])])
+AC_SUBST([MARS_KERNEL])
+AC_MSG_RESULT([using mars-kernel ${MARS_KERNEL}])
+
+AC_ARG_WITH([mars-host],
+	[AS_HELP_STRING([--with-mars-host=TYPE],
+		[specify mars host TYPE (cell | x86)])],
+	[],
+	[AC_MSG_ERROR([missing option --with-mars-host=])])
+AS_CASE([${with_mars_host}],
+	[cell],[],
+	[x86],[],
+	[AC_MSG_ERROR([invalid option --with-mars-host=${with_mars_host}])])
+AM_CONDITIONAL([MARS_HOST_CELL], [test "x${with_mars_host}" = "xcell"])
+AM_CONDITIONAL([MARS_HOST_X86], [test "x${with_mars_host}" = "xx86"])
+AC_MSG_RESULT([using mars-host ${with_mars_host}])
+
+AC_ARG_WITH([mars-mpu],
+	[AS_HELP_STRING([--with-mars-mpu=TYPE],
+		[specify mars mpu TYPE (cell | spursengine)])],
+	[],
+	[AC_MSG_ERROR([missing option --with-mars-mpu=])])
+AS_CASE([${with_mars_mpu}],
+	[cell],[],
+	[spursengine],[],
+	[AC_MSG_ERROR([invalid option --with-mars-mpu=${with_mars_mpu}])])
+AM_CONDITIONAL([MARS_MPU_CELL], [test "x${with_mars_mpu}" = "xcell"])
+AM_CONDITIONAL([MARS_MPU_SPURSENGINE], [test "x${with_mars_mpu}" = "xspursengine"])
+AC_MSG_RESULT([using mars-mpu ${with_mars_mpu}])
+
+AC_ARG_ENABLE(
+	[debug],
+	[AS_HELP_STRING([--enable-debug], [build debug versions of mars])])
+AM_CONDITIONAL([DEBUG], [test "x${enable_debug}" = "xyes"])
+AC_MSG_RESULT([using enable-debug ${enable_debug}])
+
+AC_CONFIG_AUX_DIR([.])
 
 AM_INIT_AUTOMAKE
-AC_PROG_LIBTOOL
+AC_SUBST([DESTDIR])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+
+mars_arg_host=
+mars_arg_prefix=
+mars_arg_other=
+
+for a in $ac_configure_args; do
+	case ${a} in
+	\'--host=*\' )
+		mars_arg_host=${a}
+		;;
+	\'--prefix=*\' )
+		mars_arg_prefix=${a}
+		;;
+	\'host_alias=*\' )
+		# ignore
+		;;
+	* )
+		mars_arg_other="${mars_arg_other} ${a}"
+		;;
+	esac
+done
+
+mars_args_prefix_spu=`echo "$mars_arg_prefix" | sed 's,'\''$,/spu'\'',g'`
+
+mars_args_ppu=`echo "$mars_arg_other" | sed 's,'\''PPU_,'\'',g'`
+mars_args_ppu="$mars_args_ppu $mars_arg_prefix $mars_arg_host"
+
+mars_args_spu=`echo "$mars_arg_other" | sed 's,'\''SPU_,'\'',g'`
+mars_args_spu="$mars_args_spu $mars_args_prefix_spu --host=spu"
+
+AC_MSG_RESULT([using mars_srcdir $ac_abs_confdir])
+AC_MSG_RESULT([using mars_builddir $ac_pwd])
+
+#echo '-------------------'
+#echo "$ac_configure_args"
+#echo '-------------------'
+#echo '-------------------'
+#echo "mars_arg_host=@$mars_arg_host@"
+#echo "mars_arg_other=@$mars_arg_other@"
+#echo "mars_arg_prefix=@$mars_arg_prefix@"
+#echo "mars_args_prefix_spu=@$mars_args_prefix_spu@"
+echo "mars_args_ppu=@$mars_args_ppu@"
+echo "mars_args_spu=@$mars_args_spu@"
+#echo '-------------------'
+
+mkdir -p ${ac_pwd}/src/mpu
+pushd ${ac_pwd}/src/mpu && eval "${ac_abs_confdir}/src/mpu/configure $mars_args_spu"; popd
 
-AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_FILES([
-	Makefile
-	include/Makefile
-	src/Makefile
-])
-
-AC_CONFIG_SUBDIRS([
-	src/host
-	src/mpu
-])
+mkdir -p ${ac_pwd}/src/host/lib
+pushd ${ac_pwd}/src/host/lib && eval "${ac_abs_confdir}/src/host/lib/configure $mars_args_ppu" ; popd
 
 AC_OUTPUT
--- a/include/Makefile.am
+++ /dev/null
@@ -1,90 +0,0 @@
-## Makefile.am -- Process this file with automake to produce Makefile.in
-#
-#  Copyright 2008 Sony Corporation of America
-#
-#
-#  Permission is hereby granted, free of charge, to any person obtaining
-#  a copy of this Library and associated documentation files (the
-#  "Library"), to deal in the Library without restriction, including
-#  without limitation the rights to use, copy, modify, merge, publish,
-#  distribute, sublicense, and/or sell copies of the Library, and to
-#  permit persons to whom the Library is furnished to do so, subject to
-#  the following conditions:
-#
-#   The above copyright notice and this permission notice shall be
-#   included in all copies or substantial portions of the Library.
-#
-#   If you modify the Library, you may copy and distribute your modified
-#   version of the Library in object code or as an executable provided
-#   that you also do one of the following:
-#
-#    Accompany the modified version of the Library with the complete
-#    corresponding machine-readable source code for the modified version
-#    of the Library; or,
-#
-#    Accompany the modified version of the Library with a written offer
-#    for a complete machine-readable copy of the corresponding source
-#    code of the modified version of the Library.
-#
-#
-#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
-#
-
-MAINTAINERCLEANFILES = Makefile.in
-
-hostdir = $(prefix)/include/mars
-mpudir = $(prefix)/spu/include/mars
-
-host_HEADERS = \
-	common/mars/mars_error.h \
-	common/mars/mars_mutex_types.h \
-	common/mars/mars_task_types.h \
-	common/mars/mars_task_barrier_types.h \
-	common/mars/mars_task_event_flag_types.h \
-	common/mars/mars_task_queue_types.h \
-	common/mars/mars_task_semaphore_types.h \
-	host/mars/mars.h \
-	host/mars/mars_mutex.h \
-	host/mars/mars_task.h \
-	host/mars/mars_task_barrier.h \
-	host/mars/mars_task_event_flag.h \
-	host/mars/mars_task_queue.h \
-	host/mars/mars_task_semaphore.h \
-	host/mars/mars_task_signal.h
-
-mpu_HEADERS = \
-	common/mars/mars_error.h \
-	common/mars/mars_mutex_types.h \
-	common/mars/mars_task_types.h \
-	common/mars/mars_task_barrier_types.h \
-	common/mars/mars_task_event_flag_types.h \
-	common/mars/mars_task_queue_types.h \
-	common/mars/mars_task_semaphore_types.h \
-	mpu/mars/mars.h \
-	mpu/mars/mars_mutex.h \
-	mpu/mars/mars_task.h \
-	mpu/mars/mars_task_barrier.h \
-	mpu/mars/mars_task_event_flag.h \
-	mpu/mars/mars_task_queue.h \
-	mpu/mars/mars_task_semaphore.h \
-	mpu/mars/mars_task_signal.h
-
-EXTRA_DIST = \
-	common/mars/mars_debug.h \
-	common/mars/mars_kernel_types.h \
-	common/mars/mars_workload_types.h \
-	host/mars/mars_atomic.h \
-	host/mars/mars_elf.h \
-	host/mars/mars_timer.h \
-	host/mars/mars_workload_queue.h \
-	mpu/mars/mars_atomic.h \
-	mpu/mars/mars_dma.h \
-	mpu/mars/mars_kernel.h \
-	mpu/mars/mars_timer.h \
-	mpu/mars/mars_syscalls.h
--- a/src/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Makefile.am -- Process this file with automake to produce Makefile.in
-#
-#  Copyright 2008 Sony Corporation of America
-#
-#
-#  Permission is hereby granted, free of charge, to any person obtaining
-#  a copy of this Library and associated documentation files (the
-#  "Library"), to deal in the Library without restriction, including
-#  without limitation the rights to use, copy, modify, merge, publish,
-#  distribute, sublicense, and/or sell copies of the Library, and to
-#  permit persons to whom the Library is furnished to do so, subject to
-#  the following conditions:
-#
-#   The above copyright notice and this permission notice shall be
-#   included in all copies or substantial portions of the Library.
-#
-#   If you modify the Library, you may copy and distribute your modified
-#   version of the Library in object code or as an executable provided
-#   that you also do one of the following:
-#
-#    Accompany the modified version of the Library with the complete
-#    corresponding machine-readable source code for the modified version
-#    of the Library; or,
-#
-#    Accompany the modified version of the Library with a written offer
-#    for a complete machine-readable copy of the corresponding source
-#    code of the modified version of the Library.
-#
-#
-#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
-#
-
-SUBDIRS = mpu host
-
-MAINTAINERCLEANFILES = Makefile.in
--- a/src/host/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-## Makefile.am -- Process this file with automake to produce Makefile.in
-#
-#  Copyright 2008 Sony Corporation of America
-#
-#
-#  Permission is hereby granted, free of charge, to any person obtaining
-#  a copy of this Library and associated documentation files (the
-#  "Library"), to deal in the Library without restriction, including
-#  without limitation the rights to use, copy, modify, merge, publish,
-#  distribute, sublicense, and/or sell copies of the Library, and to
-#  permit persons to whom the Library is furnished to do so, subject to
-#  the following conditions:
-#
-#   The above copyright notice and this permission notice shall be
-#   included in all copies or substantial portions of the Library.
-#
-#   If you modify the Library, you may copy and distribute your modified
-#   version of the Library in object code or as an executable provided
-#   that you also do one of the following:
-#
-#    Accompany the modified version of the Library with the complete
-#    corresponding machine-readable source code for the modified version
-#    of the Library; or,
-#
-#    Accompany the modified version of the Library with a written offer
-#    for a complete machine-readable copy of the corresponding source
-#    code of the modified version of the Library.
-#
-#
-#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
-#
-
-SUBDIRS = lib
-
-EXTRA_DIST = \
-	bootstrap \
-	configure.ac.in \
-	config.sub.patch
-
-MAINTAINERCLEANFILES = Makefile.in
--- a/src/host/bootstrap
+++ /dev/null
@@ -1,53 +0,0 @@
-#! /bin/bash
-#  bootstrap -- Use this script to create generated files from a VCS checkout
-#
-#  Copyright 2008 Sony Corporation of America
-#
-#
-#  Permission is hereby granted, free of charge, to any person obtaining
-#  a copy of this Library and associated documentation files (the
-#  "Library"), to deal in the Library without restriction, including
-#  without limitation the rights to use, copy, modify, merge, publish,
-#  distribute, sublicense, and/or sell copies of the Library, and to
-#  permit persons to whom the Library is furnished to do so, subject to
-#  the following conditions:
-#
-#   The above copyright notice and this permission notice shall be
-#   included in all copies or substantial portions of the Library.
-#
-#   If you modify the Library, you may copy and distribute your modified
-#   version of the Library in object code or as an executable provided
-#   that you also do one of the following:
-#
-#    Accompany the modified version of the Library with the complete
-#    corresponding machine-readable source code for the modified version
-#    of the Library; or,
-#
-#    Accompany the modified version of the Library with a written offer
-#    for a complete machine-readable copy of the corresponding source
-#    code of the modified version of the Library.
-#
-#
-#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
-#
-
-version="$1"
-
-sed -e s, at version@,${version},g \
-	configure.ac.in > configure.ac
-
-aclocal
-libtoolize --force --copy
-autoheader
-automake --foreign --add-missing --copy
-autoconf
-
-if [ -e config.sub ]; then
-	patch -p1 < config.sub.patch
-fi
--- a/src/host/config.sub.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/config.sub	2005-11-22 05:18:02.000000000 -0800
-+++ b/config.sub	2006-07-11 12:09:36.000000000 -0700
-@@ -816,6 +816,10 @@
- 	ppc64le-* | powerpc64little-*)
- 		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- 		;;
-+	ppu)
-+		basic_machine=powerpc64-cell
-+		os=-linux
-+		;;
- 	ps2)
- 		basic_machine=i386-ibm
- 		;;
-@@ -868,6 +872,10 @@
- 	spur)
- 		basic_machine=spur-unknown
- 		;;
-+	spu)
-+		basic_machine=spu-cell
-+		os=-none
-+		;;
- 	st2000)
- 		basic_machine=m68k-tandem
- 		;;
--- a/src/host/configure.ac.in
+++ /dev/null
@@ -1,55 +0,0 @@
-## configure.ac -- Process this file with autoconf to produce configure
-#
-#  Copyright 2008 Sony Corporation of America
-#
-#
-#  Permission is hereby granted, free of charge, to any person obtaining
-#  a copy of this Library and associated documentation files (the
-#  "Library"), to deal in the Library without restriction, including
-#  without limitation the rights to use, copy, modify, merge, publish,
-#  distribute, sublicense, and/or sell copies of the Library, and to
-#  permit persons to whom the Library is furnished to do so, subject to
-#  the following conditions:
-#
-#   The above copyright notice and this permission notice shall be
-#   included in all copies or substantial portions of the Library.
-#
-#   If you modify the Library, you may copy and distribute your modified
-#   version of the Library in object code or as an executable provided
-#   that you also do one of the following:
-#
-#    Accompany the modified version of the Library with the complete
-#    corresponding machine-readable source code for the modified version
-#    of the Library; or,
-#
-#    Accompany the modified version of the Library with a written offer
-#    for a complete machine-readable copy of the corresponding source
-#    code of the modified version of the Library.
-#
-#
-#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
-#
-
-AC_INIT(host, @version@, Yuji Mano <yuji.mano at am.sony.com>)
-
-host_alias=ppu
-AC_SUBST(host_alias)
-
-AC_CONFIG_AUX_DIR([.])
-
-AC_PROG_LIBTOOL
-AM_INIT_AUTOMAKE
-
-AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_FILES([
-	Makefile
-	lib/Makefile
-])
-
-AC_OUTPUT
--- a/src/host/lib/Makefile.am
+++ b/src/host/lib/Makefile.am
@@ -36,23 +36,98 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
+extra_cppflags =
+extra_cflags =
+extra_ldflags =
+
+if DEBUG
+  extra_cppflags += "-DDEBUG"
+else
+  extra_cppflags += "-DNDEBUG"
+endif
+
+if MARS_HOST_CELL
+endif
+
+if MARS_HOST_X86
+endif
+
+if MARS_MPU_CELL
+if DEBUG
+  # debug kernel is 64K
+else
+  # release kernel is 16K
+endif
+endif
+
+if MARS_MPU_SPURSENGINE
+endif
+
+EXTRA_DIST = bootstrap configure.ac.in
+
 MAINTAINERCLEANFILES = Makefile.in
 
+include_HEADERS =                                                    \
+ $(srcdir)/../../../include/common/mars/mars_error.h                 \
+ $(srcdir)/../../../include/common/mars/mars_mutex_types.h           \
+ $(srcdir)/../../../include/common/mars/mars_task_barrier_types.h    \
+ $(srcdir)/../../../include/common/mars/mars_task_event_flag_types.h \
+ $(srcdir)/../../../include/common/mars/mars_task_queue_types.h      \
+ $(srcdir)/../../../include/common/mars/mars_task_semaphore_types.h  \
+ $(srcdir)/../../../include/common/mars/mars_task_types.h            \
+ $(srcdir)/../../../include/host/mars/mars.h                         \
+ $(srcdir)/../../../include/host/mars/mars_mutex.h                   \
+ $(srcdir)/../../../include/host/mars/mars_task.h                    \
+ $(srcdir)/../../../include/host/mars/mars_task_barrier.h            \
+ $(srcdir)/../../../include/host/mars/mars_task_event_flag.h         \
+ $(srcdir)/../../../include/host/mars/mars_task_queue.h              \
+ $(srcdir)/../../../include/host/mars/mars_task_semaphore.h          \
+ $(srcdir)/../../../include/host/mars/mars_task_signal.h
+
+EXTRA_DIST +=                                                        \
+ $(srcdir)/../../../include/host/mars/mars_atomic.h                  \
+ $(srcdir)/../../../include/host/mars/mars_elf.h                     \
+ $(srcdir)/../../../include/host/mars/mars_timer.h                   \
+ $(srcdir)/../../../include/host/mars/mars_workload_queue.h          \
+ $(srcdir)/../../../include/common/mars/mars_debug.h                 \
+ $(srcdir)/../../../include/common/mars/mars_kernel_types.h          \
+ $(srcdir)/../../../include/common/mars/mars_workload_types.h
+
+AM_CPPFLAGS =                                                        \
+ $(extra_cppflags)                                                   \
+ -I$(srcdir)/../../../include/host/mars                              \
+ -I$(srcdir)/../../../include/common/mars
+
+AM_CFLAGS =                            \
+ $(extra_cflags)                       \
+ -g                                    \
+ -Wall                                 \
+ -W                                    \
+ -Wunused                              \
+ -Wstrict-prototypes                   \
+ -Wmissing-prototypes                  \
+ -Wmissing-declarations                \
+ -Wredundant-decls                     \
+ -Winline
+
+AM_LDFLAGS =                           \
+ $(extra_ldflags)
+
 lib_LTLIBRARIES = libmars.la
 
-libmars_la_CPPFLAGS = \
-	-I$(srcdir)/../../../include/host/mars \
-	-I$(srcdir)/../../../include/common/mars
-
-libmars_la_CFLAGS = \
-	$(HOST_FLAGS)
-	-Wall \
-	-Wunused \
-	-Winline \
-	-Wredundant-decls \
-	-Wstrict-prototypes \
-	-Wmissing-prototypes \
-	-Wmissing-declarations
+libmars_la_SOURCES =                   \
+ mars.c                                \
+ mars_elf.c                            \
+ mars_mutex.c                          \
+ mars_workload_queue.c                 \
+ mars_task.c                           \
+ mars_task_barrier.c                   \
+ mars_task_event_flag.c                \
+ mars_task_queue.c                     \
+ mars_task_semaphore.c                 \
+ mars_task_signal.c
+
+libmars_la_DEPENDENCIES = mars-kernel.eo
 
 # version-info rules (current:revision:age):
 # * If the library source code has changed since the last release, then
@@ -64,18 +139,13 @@ libmars_la_CFLAGS = \
 # * If any interfaces have been removed since the last release, then
 #   set age to 0.
 
-libmars_la_LDFLAGS = \
-	-version-info 0:0:0 \
-	-Wl,../../mpu/kernel/mars_kernel.eo
-
-libmars_la_SOURCES = \
-	mars.c \
-	mars_elf.c \
-	mars_mutex.c \
-	mars_workload_queue.c \
-	mars_task.c \
-	mars_task_barrier.c \
-	mars_task_event_flag.c \
-	mars_task_queue.c \
-	mars_task_semaphore.c \
-	mars_task_signal.c
+libmars_la_LDFLAGS =                   \
+ -version-info 0:0:0                   \
+ -Wl,mars-kernel.eo
+
+libmars_la_LIBADD = -lspe2
+
+mars-kernel.eo: ${MARS_KERNEL}
+	$(EMBEDSPU) $(CFLAGS) mars_kernel_entry  $< $@
+
+CLEANFILES = *.eo
--- /dev/null
+++ b/src/host/lib/bootstrap
@@ -0,0 +1,48 @@
+#! /bin/bash
+#  bootstrap -- Use this script to create generated files from a VCS checkout
+#
+#  Copyright 2008 Sony Corporation of America
+#
+#
+#  Permission is hereby granted, free of charge, to any person obtaining
+#  a copy of this Library and associated documentation files (the
+#  "Library"), to deal in the Library without restriction, including
+#  without limitation the rights to use, copy, modify, merge, publish,
+#  distribute, sublicense, and/or sell copies of the Library, and to
+#  permit persons to whom the Library is furnished to do so, subject to
+#  the following conditions:
+#
+#   The above copyright notice and this permission notice shall be
+#   included in all copies or substantial portions of the Library.
+#
+#   If you modify the Library, you may copy and distribute your modified
+#   version of the Library in object code or as an executable provided
+#   that you also do one of the following:
+#
+#    Accompany the modified version of the Library with the complete
+#    corresponding machine-readable source code for the modified version
+#    of the Library; or,
+#
+#    Accompany the modified version of the Library with a written offer
+#    for a complete machine-readable copy of the corresponding source
+#    code of the modified version of the Library.
+#
+#
+#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
+#
+
+version="$1"
+
+sed -e s, at version@,${version},g configure.ac.in > configure.ac
+
+aclocal
+libtoolize --force --copy
+autoheader
+automake --foreign --add-missing --copy
+autoconf
--- /dev/null
+++ b/src/host/lib/configure.ac.in
@@ -0,0 +1,93 @@
+## configure.ac -- Process this file with autoconf to produce configure
+#
+#  Copyright 2008 Sony Corporation of America
+#
+#
+#  Permission is hereby granted, free of charge, to any person obtaining
+#  a copy of this Library and associated documentation files (the
+#  "Library"), to deal in the Library without restriction, including
+#  without limitation the rights to use, copy, modify, merge, publish,
+#  distribute, sublicense, and/or sell copies of the Library, and to
+#  permit persons to whom the Library is furnished to do so, subject to
+#  the following conditions:
+#
+#   The above copyright notice and this permission notice shall be
+#   included in all copies or substantial portions of the Library.
+#
+#   If you modify the Library, you may copy and distribute your modified
+#   version of the Library in object code or as an executable provided
+#   that you also do one of the following:
+#
+#    Accompany the modified version of the Library with the complete
+#    corresponding machine-readable source code for the modified version
+#    of the Library; or,
+#
+#    Accompany the modified version of the Library with a written offer
+#    for a complete machine-readable copy of the corresponding source
+#    code of the modified version of the Library.
+#
+#
+#  THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
+#
+
+AC_INIT([mars-host], [@version@], [MARS <cbe-oss-dev at ozlabs.org>])
+
+AC_PREFIX_DEFAULT([/usr/local/mars])
+
+AC_ARG_WITH([mars-kernel],
+	[AS_HELP_STRING([--with-mars-kernel=PATH-TO-FILE],
+		[specify mars kernel ELF file])],
+	[MARS_KERNEL=${withval}],
+	[AC_MSG_ERROR([missing option --with-mars-kernel=])])
+AC_SUBST([MARS_KERNEL])
+AC_MSG_RESULT([using mars-kernel ${MARS_KERNEL}])
+
+AC_ARG_WITH([mars-host],
+	[AS_HELP_STRING([--with-mars-host=TYPE],
+		[specify mars host TYPE (cell | x86)])],
+	[],
+	[AC_MSG_ERROR([missing option --with-mars-host=])])
+AS_CASE([${with_mars_host}],
+	[cell],[],
+	[x86],[],
+	[AC_MSG_ERROR([invalid option --with-mars-host=${with_mars_host}])])
+AM_CONDITIONAL([MARS_HOST_CELL], [test "x${with_mars_host}" = "xcell"])
+AM_CONDITIONAL([MARS_HOST_X86], [test "x${with_mars_host}" = "xx86"])
+AC_MSG_RESULT([using mars-host ${with_mars_host}])
+
+AC_ARG_WITH([mars-mpu],
+	[AS_HELP_STRING([--with-mars-mpu=TYPE],
+		[specify mars mpu TYPE (cell | spursengine)])],
+	[],
+	[AC_MSG_ERROR([missing option --with-mars-mpu=])])
+AS_CASE([${with_mars_mpu}],
+	[cell],[],
+	[spursengine],[],
+	[AC_MSG_ERROR([invalid option --with-mars-mpu=${with_mars_mpu}])])
+AM_CONDITIONAL([MARS_MPU_CELL], [test "x${with_mars_mpu}" = "xcell"])
+AM_CONDITIONAL([MARS_MPU_SPURSENGINE], [test "x${with_mars_mpu}" = "xspursengine"])
+AC_MSG_RESULT([using mars-mpu ${with_mars_mpu}])
+
+AC_ARG_ENABLE(
+	[debug],
+	[AS_HELP_STRING([--enable-debug], [build debug versions of mars])])
+AM_CONDITIONAL([DEBUG], [test "x${enable_debug}" = "xyes"])
+AC_MSG_RESULT([using enable-debug ${enable_debug}])
+
+AC_CONFIG_AUX_DIR([.])
+
+AC_CHECK_TARGET_TOOL([EMBEDSPU], [embedspu], [embedspu-not-found])
+
+AC_PROG_LIBTOOL
+AM_INIT_AUTOMAKE
+AC_SUBST([DESTDIR])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+
+AC_OUTPUT
--- a/src/mpu/Makefile.am
+++ b/src/mpu/Makefile.am
@@ -38,9 +38,6 @@
 
 SUBDIRS = kernel lib
 
-EXTRA_DIST = \
-	bootstrap \
-	configure.ac.in \
-	config.sub.patch
+EXTRA_DIST = bootstrap configure.ac.in
 
 MAINTAINERCLEANFILES = Makefile.in
--- a/src/mpu/bootstrap
+++ b/src/mpu/bootstrap
@@ -39,15 +39,10 @@
 
 version="$1"
 
-sed -e s, at version@,${version},g \
-	configure.ac.in > configure.ac
+sed -e s, at version@,${version},g configure.ac.in > configure.ac
 
 aclocal
 libtoolize --force --copy
 autoheader
 automake --foreign --add-missing --copy
 autoconf
-
-if [ -e config.sub ]; then
-	patch -p1 < config.sub.patch
-fi
--- a/src/mpu/config.sub.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/config.sub	2005-11-22 05:18:02.000000000 -0800
-+++ b/config.sub	2006-07-11 12:09:36.000000000 -0700
-@@ -816,6 +816,10 @@
- 	ppc64le-* | powerpc64little-*)
- 		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- 		;;
-+	ppu)
-+		basic_machine=powerpc64-cell
-+		os=-linux
-+		;;
- 	ps2)
- 		basic_machine=i386-ibm
- 		;;
-@@ -868,6 +872,10 @@
- 	spur)
- 		basic_machine=spur-unknown
- 		;;
-+	spu)
-+		basic_machine=spu-cell
-+		os=-none
-+		;;
- 	st2000)
- 		basic_machine=m68k-tandem
- 		;;
--- a/src/mpu/configure.ac.in
+++ b/src/mpu/configure.ac.in
@@ -36,30 +36,49 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
-AC_INIT(mpu, @version@, Yuji Mano <yuji.mano at am.sony.com>)
+AC_INIT([mars-mpu], [@version@], [MARS <cbe-oss-dev at ozlabs.org>])
 
-host_alias=spu
-AC_SUBST(host_alias)
+AC_PREFIX_DEFAULT([/usr/local/mars/mpu])
 
-libdir=${prefix}/spu/lib
-ac_configure_args="$ac_configure_args --libdir $libdir"
+AC_ARG_WITH([mars-host],
+	[AS_HELP_STRING([--with-mars-host=TYPE],
+		[specify mars host TYPE (cell | x86)])],
+	[],
+	[AC_MSG_ERROR([missing option --with-mars-host=])])
+AS_CASE([${with_mars_host}],
+	[cell],[],
+	[x86],[],
+	[AC_MSG_ERROR([invalid option --with-mars-host=${with_mars_host}])])
+AM_CONDITIONAL([MARS_HOST_CELL], [test "x${with_mars_host}" = "xcell"])
+AM_CONDITIONAL([MARS_HOST_X86], [test "x${with_mars_host}" = "xx86"])
+AC_MSG_RESULT([using mars-host ${with_mars_host}])
+
+AC_ARG_WITH([mars-mpu],
+	[AS_HELP_STRING([--with-mars-mpu=TYPE],
+		[specify mars mpu TYPE (cell | spursengine)])],
+	[],
+	[AC_MSG_ERROR([missing option --with-mars-mpu=])])
+AS_CASE([${with_mars_mpu}],
+	[cell],[],
+	[spursengine],[],
+	[AC_MSG_ERROR([invalid option --with-mars-mpu=${with_mars_mpu}])])
+AM_CONDITIONAL([MARS_MPU_CELL], [test "x${with_mars_mpu}" = "xcell"])
+AM_CONDITIONAL([MARS_MPU_SPURSENGINE], [test "x${with_mars_mpu}" = "xspursengine"])
+AC_MSG_RESULT([using mars-mpu ${with_mars_mpu}])
+
+AC_ARG_ENABLE(
+	[debug],
+	[AS_HELP_STRING([--enable-debug], [build debug versions of mars])])
+AM_CONDITIONAL([DEBUG], [test "x${enable_debug}" = "xyes"])
+AC_MSG_RESULT([using enable-debug ${enable_debug}])
 
 AC_CONFIG_AUX_DIR([.])
 
-AC_PROG_CC(spu-gcc)
-AC_PROG_CXX(spu-g++)
-AC_PROG_LD(spu-ld)
-AM_PROG_AS(spu-as)
-AC_PATH_TOOL(PPU_EMBEDSPU, ppu-embedspu)
-
 AC_PROG_LIBTOOL
 AM_INIT_AUTOMAKE
-
-AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_FILES([
-	Makefile
-	kernel/Makefile
-	lib/Makefile
-])
+AM_PROG_AS
+AC_SUBST([DESTDIR])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile kernel/Makefile lib/Makefile])
 
 AC_OUTPUT
--- a/src/mpu/kernel/Makefile.am
+++ b/src/mpu/kernel/Makefile.am
@@ -36,37 +36,68 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
+extra_cppflags =
+extra_cflags =
+extra_ldflags =
+
+if DEBUG
+  extra_cppflags += "-DDEBUG"
+else
+  extra_cppflags += "-DNDEBUG"
+endif
+
+if MARS_MPU_CELL
+if DEBUG
+  # debug kernel is 64K
+  extra_ldflags += -Wl,--defsym=__stack=0x0fff0
+else
+  # release kernel is 16K
+  #**todo**
+  extra_ldflags += -Wl,--defsym=__stack=0x0fff0
+endif
+endif
+
 MAINTAINERCLEANFILES = Makefile.in
 
-noinst_PROGRAMS = mars_kernel mars_kernel.eo
+EXTRA_DIST =                                                         \
+ $(srcdir)/../../../include/mpu/mars/mars_kernel.h                   \
+ $(srcdir)/../../../include/mpu/mars/mars_syscalls.h
+
+AM_CPPFLAGS =                                                        \
+ $(extra_cppflags)                                                   \
+ -I$(srcdir)/../../../include/mpu/mars                               \
+ -I$(srcdir)/../../../include/common/mars
+
+AM_CCASFLAGS =                         \
+ $(extra_cppflags)
+
+AM_CFLAGS =                            \
+ $(extra_cflags)                       \
+ -g                                    \
+ -Wall                                 \
+ -W                                    \
+ -Wunused                              \
+ -Wstrict-prototypes                   \
+ -Wmissing-prototypes                  \
+ -Wmissing-declarations                \
+ -Wredundant-decls                     \
+ -Winline
+
+AM_LDFLAGS =                           \
+ $(extra_ldflags)                      \
+ -Wl,-Map -Wl,$@.map -Wl,--cref        \
+ -Wl,-gc-sections                      \
+ -Wl,-N                                \
+ -Wl,-s
+
+noinst_PROGRAMS = mars-kernel
+
+mars_kernel_SOURCES =                  \
+ mars_kernel.c                         \
+ mars_kernel_registers.c               \
+ mars_kernel_scheduler.c               \
+ mars_kernel_syscalls.c                \
+ mars_kernel_task.c                    \
+ mars_kernel_workload.c
 
-mars_kernel_CPPFLAGS = \
-	-I$(srcdir)/../../../include/mpu/mars \
-	-I$(srcdir)/../../../include/common/mars
-
-mars_kernel_CFLAGS = \
-	-Wall \
-	-Wunused \
-	-Winline \
-	-Wredundant-decls \
-	-Wstrict-prototypes \
-	-Wmissing-prototypes \
-	-Wmissing-declarations
-
-mars_kernel_LDFLAGS = \
-	-Wl,--defsym=__stack=0x0fff0 \
-	-Wl,-gc-sections \
-	-Wl,-N \
-	-Wl,-s
-
-mars_kernel_SOURCES = \
-	mars_kernel.c \
-	mars_kernel_registers.c \
-	mars_kernel_scheduler.c \
-	mars_kernel_syscalls.c \
-	mars_kernel_task.c \
-	mars_kernel_workload.c
-
-mars_kernel_eo_SOURCES =
-mars_kernel.eo: mars_kernel
-	$(PPU_EMBEDSPU) $(HOST_FLAGS) mars_kernel_entry mars_kernel mars_kernel.eo
+CLEANFILES = *.map
--- a/src/mpu/lib/Makefile.am
+++ b/src/mpu/lib/Makefile.am
@@ -36,30 +36,63 @@
 #  LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
 #
 
+extra_cppflags =
+extra_cflags =
+extra_ldflags =
+
+if DEBUG
+  extra_cppflags += "-DDEBUG"
+else
+  extra_cppflags += "-DNDEBUG"
+endif
+
 MAINTAINERCLEANFILES = Makefile.in
 
+include_HEADERS =                                                    \
+ $(srcdir)/../../../include/common/mars/mars_error.h                 \
+ $(srcdir)/../../../include/common/mars/mars_mutex_types.h           \
+ $(srcdir)/../../../include/common/mars/mars_task_types.h            \
+ $(srcdir)/../../../include/common/mars/mars_task_barrier_types.h    \
+ $(srcdir)/../../../include/common/mars/mars_task_event_flag_types.h \
+ $(srcdir)/../../../include/common/mars/mars_task_queue_types.h      \
+ $(srcdir)/../../../include/common/mars/mars_task_semaphore_types.h  \
+ $(srcdir)/../../../include/mpu/mars/mars.h                          \
+ $(srcdir)/../../../include/mpu/mars/mars_mutex.h                    \
+ $(srcdir)/../../../include/mpu/mars/mars_task.h                     \
+ $(srcdir)/../../../include/mpu/mars/mars_task_barrier.h             \
+ $(srcdir)/../../../include/mpu/mars/mars_task_event_flag.h          \
+ $(srcdir)/../../../include/mpu/mars/mars_task_queue.h               \
+ $(srcdir)/../../../include/mpu/mars/mars_task_semaphore.h           \
+ $(srcdir)/../../../include/mpu/mars/mars_task_signal.h
+
+EXTRA_DIST =                                                         \
+ $(srcdir)/../../../include/mpu/mars/mars_atomic.h                   \
+ $(srcdir)/../../../include/mpu/mars/mars_dma.h                      \
+ $(srcdir)/../../../include/mpu/mars/mars_timer.h
+
+AM_CPPFLAGS =                                                        \
+ $(extra_cppflags)                                                   \
+ -I$(srcdir)/../../../include/mpu/mars                               \
+ -I$(srcdir)/../../../include/common/mars
+
+AM_CFLAGS =                            \
+ -Wall                                 \
+ -Wunused                              \
+ -Winline                              \
+ -Wredundant-decls                     \
+ -Wstrict-prototypes                   \
+ -Wmissing-prototypes                  \
+ -Wmissing-declarations
+
 lib_LIBRARIES = libmars.a
 
-libmars_a_CPPFLAGS = \
-	-I$(srcdir)/../../../include/mpu/mars \
-	-I$(srcdir)/../../../include/common/mars
-
-libmars_a_CFLAGS = \
-	-Wall \
-	-Wunused \
-	-Winline \
-	-Wredundant-decls \
-	-Wstrict-prototypes \
-	-Wmissing-prototypes \
-	-Wmissing-declarations
-
-libmars_a_SOURCES = \
-	mars_entry.S \
-	mars_mutex.c \
-	mars_syscalls.c \
-	mars_task.c \
-	mars_task_barrier.c \
-	mars_task_event_flag.c \
-	mars_task_queue.c \
-	mars_task_semaphore.c \
-	mars_task_signal.c
+libmars_a_SOURCES =                    \
+ mars_entry.S                          \
+ mars_mutex.c                          \
+ mars_syscalls.c                       \
+ mars_task.c                           \
+ mars_task_barrier.c                   \
+ mars_task_event_flag.c                \
+ mars_task_queue.c                     \
+ mars_task_semaphore.c                 \
+ mars_task_signal.c





More information about the cbe-oss-dev mailing list