From 27142799b33dabc075f660e5de8ab375a1ac9314 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Tue, 25 Feb 2014 10:08:02 +0200
Subject: Update and improve for new dependencies

---
 README                                             | 62 ++++++++++------------
 .../build/cxx/configuration-dynamic.make           | 14 -----
 .../build/cxx/gnu/configuration-dynamic.make       |  8 ---
 .../import/libboost/configuration-dynamic.make     |  8 ---
 .../import/libcult/configuration-dynamic.make      |  4 --
 .../build/ld/configuration-lib-dynamic.make        | 13 -----
 libcult/build/configuration-dynamic.make           |  3 --
 libcult/build/cxx/configuration-dynamic.make       | 14 -----
 libcult/build/cxx/gnu/configuration-dynamic.make   |  8 ---
 libcult/build/ld/configuration-lib-dynamic.make    | 13 -----
 libcutl/build/c/configuration-dynamic.make         | 11 ++++
 libcutl/build/c/generic/configuration-dynamic.make |  5 ++
 libcutl/build/cxx/configuration-dynamic.make       | 11 ++++
 .../build/cxx/generic/configuration-dynamic.make   |  5 ++
 libcutl/build/ld/configuration-lib-dynamic.make    | 13 +++++
 .../build/cxx/configuration-dynamic.make           | 14 -----
 .../build/cxx/gnu/configuration-dynamic.make       |  8 ---
 .../import/libcult/configuration-dynamic.make      |  4 --
 .../build/ld/configuration-lib-dynamic.make        | 13 -----
 libxsd-frontend/build/configuration-dynamic.make   |  1 +
 .../build/cxx/configuration-dynamic.make           |  5 +-
 .../build/cxx/generic/configuration-dynamic.make   |  5 ++
 .../build/cxx/gnu/configuration-dynamic.make       |  8 ---
 .../import/libboost/configuration-dynamic.make     |  8 ---
 .../import/libcult/configuration-dynamic.make      |  4 --
 .../import/libcutl/configuration-dynamic.make      |  8 +++
 .../configuration-dynamic.make                     |  4 --
 .../build/ld/configuration-lib-dynamic.make        |  4 +-
 makefile                                           | 21 +++-----
 xsde/build/c/configuration-dynamic.make            |  5 +-
 xsde/build/c/generic/configuration-dynamic.make    |  5 ++
 xsde/build/c/gnu/configuration-dynamic.make        |  8 ---
 xsde/build/configuration-dynamic.make              |  2 +
 xsde/build/cxx/configuration-dynamic.make          |  5 +-
 xsde/build/cxx/generic/configuration-dynamic.make  | 16 ++++++
 xsde/build/cxx/gnu/configuration-dynamic.make      |  8 ---
 xsde/build/import/cli/configuration-dynamic.make   |  3 ++
 .../libbackend-elements/configuration-dynamic.make |  4 --
 .../import/libboost/configuration-dynamic.make     |  8 ---
 .../import/libcult/configuration-dynamic.make      |  4 --
 .../import/libcutl/configuration-dynamic.make      |  8 +++
 xsde/build/ld/configuration-lib-dynamic.make       |  3 --
 42 files changed, 132 insertions(+), 246 deletions(-)
 delete mode 100644 libbackend-elements/build/cxx/configuration-dynamic.make
 delete mode 100644 libbackend-elements/build/cxx/gnu/configuration-dynamic.make
 delete mode 100644 libbackend-elements/build/import/libboost/configuration-dynamic.make
 delete mode 100644 libbackend-elements/build/import/libcult/configuration-dynamic.make
 delete mode 100644 libbackend-elements/build/ld/configuration-lib-dynamic.make
 delete mode 100644 libcult/build/configuration-dynamic.make
 delete mode 100644 libcult/build/cxx/configuration-dynamic.make
 delete mode 100644 libcult/build/cxx/gnu/configuration-dynamic.make
 delete mode 100644 libcult/build/ld/configuration-lib-dynamic.make
 create mode 100644 libcutl/build/c/configuration-dynamic.make
 create mode 100644 libcutl/build/c/generic/configuration-dynamic.make
 create mode 100644 libcutl/build/cxx/configuration-dynamic.make
 create mode 100644 libcutl/build/cxx/generic/configuration-dynamic.make
 create mode 100644 libcutl/build/ld/configuration-lib-dynamic.make
 delete mode 100644 libfrontend-elements/build/cxx/configuration-dynamic.make
 delete mode 100644 libfrontend-elements/build/cxx/gnu/configuration-dynamic.make
 delete mode 100644 libfrontend-elements/build/import/libcult/configuration-dynamic.make
 delete mode 100644 libfrontend-elements/build/ld/configuration-lib-dynamic.make
 create mode 100644 libxsd-frontend/build/configuration-dynamic.make
 create mode 100644 libxsd-frontend/build/cxx/generic/configuration-dynamic.make
 delete mode 100644 libxsd-frontend/build/cxx/gnu/configuration-dynamic.make
 delete mode 100644 libxsd-frontend/build/import/libboost/configuration-dynamic.make
 delete mode 100644 libxsd-frontend/build/import/libcult/configuration-dynamic.make
 create mode 100644 libxsd-frontend/build/import/libcutl/configuration-dynamic.make
 delete mode 100644 libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make
 create mode 100644 xsde/build/c/generic/configuration-dynamic.make
 delete mode 100644 xsde/build/c/gnu/configuration-dynamic.make
 create mode 100644 xsde/build/cxx/generic/configuration-dynamic.make
 delete mode 100644 xsde/build/cxx/gnu/configuration-dynamic.make
 create mode 100644 xsde/build/import/cli/configuration-dynamic.make
 delete mode 100644 xsde/build/import/libbackend-elements/configuration-dynamic.make
 delete mode 100644 xsde/build/import/libboost/configuration-dynamic.make
 delete mode 100644 xsde/build/import/libcult/configuration-dynamic.make
 create mode 100644 xsde/build/import/libcutl/configuration-dynamic.make
 delete mode 100644 xsde/build/ld/configuration-lib-dynamic.make

diff --git a/README b/README
index 9aa5ced..abea321 100644
--- a/README
+++ b/README
@@ -1,68 +1,62 @@
-This archive contains pre-configured CodeSynthesis XSD/e source code 
-with all its dependencies (except Xerces-C++ and Boost). It allows 
-you to build the XSD/e compiler in non-interactive mode (that is,
-without answering any configuration questions).
+This archive contains pre-configured CodeSynthesis XSD/e source code
+with all its dependencies (except Xerces-C++). It allows you to build
+the XSD/e compiler in non-interactive mode (that is, without answering
+any configuration questions).
 
-The following GNU tools are required to build XSD/e. Any fairly recent 
-GNU/Linux distribution should have these already installed:
+The following GNU tools are required to build XSD/e. Any fairly recent
+GNU/Linux distribution should have all of them already installed:
 
 GNU bash >= 2.00   (bash --version)  http://www.gnu.org/software/bash/
-GNU m4   >= 1.4    (m4 --version)    http://www.gnu.org/software/m4/
 GNU make >= 3.81   (make --version)  http://www.gnu.org/software/make/
-GNU g++  >= 3.4.3  (g++ --version)   http://gcc.gnu.org/
+GNU g++  >= 4.2.0  (g++ --version)   http://gcc.gnu.org/
 
-The build system expects you to have the Xerces-C++ (2.6.0 or later)
-as well as Boost filesystem and regex (1.33.1 or later) libraries
-built and installed in a location where the C++ compiler looks by
-default (normally /usr/lib/ and /usr/local/lib/). Alternatively, you
-can provide include (-I) and library (-L) paths for this packages via
-the CPPFLAGS and LDFLAGS variables, respectively.
+The build system expects you to have the Xerces-C++ library version
+3.0.0 or later built and installed in a location where the C++ compiler
+will find them by default (normally /usr/lib/ and /usr/local/lib/).
+Alternatively, you can provide include (-I) and library (-L) paths
+for this library via the CPPFLAGS and LDFLAGS variables, respectively.
 
 The build system supports the following variables:
 
+CC  	  	  (defaults to gcc if not set)
 CXX               (defaults to g++ if not set)
 AR                (defaults to ar if not set)
 RANLIB            (defaults to ranlib if not set)
 CPPFLAGS
+CFLAGS
 CXXFLAGS
 LDFLAGS
 LIBS
-BOOST_LIB_SUFFIX
-BOOST_LINK_SYSTEM
+EXTERNAL_LIBCUTL
 
 For example:
 
-$ make CXX=g++-4.2 CXXFLAGS=-O3 -j 4
+$ make CC=gcc-4.8 CXX=g++-4.8 CFLAGS=-O3 CXXFLAGS=-O3 -j 4
 
-The BOOST_LIB_SUFFIX variable allows you to specify the optional
-Boost library suffix. For example, if your Boost library names are
-in the libboost_regex-gcc41-mt-d.so format, then you will need to
-set BOOST_LIB_SUFFIX to -gcc41-mt-d.
-
-The BOOST_LINK_SYSTEM variable allows you to specify whether the
-Boost system library should be explicitly linked to which may be
-required by newer linkers. The valid values are 'y' (default) and 
-'n'.
+The EXTERNAL_LIBCUTL variable allows you to use an external build
+of libcutl, for example, if you already have this library installed.
+The valid values are 'n' (default) and 'y'.
 
 If you would like to see the full compiler/linker/etc., command lines,
 you can add verbose=1 to the make command line:
 
 $ make verbose=1
 
-After the build is complete, the XSD/e compiler can be found in the 
-xsde/xsde/ directory. You can also create a distribution package with
-the XSD/e compiler binary, source code and build system for the runtime
-library and examples, as well as the documentation using the dist and
-dist-win targets, for example:
+After the build is complete, the XSD/e compiler can be found in the
+xsde/xsde/ sub-directory. You can also create a distribution package
+with the XSD/e compiler binary, source code for the runtime library
+and examples, as well as the documentation using the dist and dist-win
+targets, for example:
 
-$ make dist_prefix=./xsde-x.y.z dist
+$ make dist_prefix=/tmp/xsde-x.y.z dist
 
 Or, for Windows:
 
-$ make dist_prefix=./xsde-x.y.z dist-win
+$ make dist_prefix=/tmp/xsde-x.y.z dist-win
 
-The build system also supports the clean target:
+The build system also supports the test and clean targets, for example:
 
+$ make test
 $ make clean
 
 Send bug reports or any other feedback to the xsde-users@codesynthesis.com
diff --git a/libbackend-elements/build/cxx/configuration-dynamic.make b/libbackend-elements/build/cxx/configuration-dynamic.make
deleted file mode 100644
index 568ab40..0000000
--- a/libbackend-elements/build/cxx/configuration-dynamic.make
+++ /dev/null
@@ -1,14 +0,0 @@
-cxx_id       := gnu
-cxx_optimize := n
-cxx_debug    := n
-cxx_rpath    := n
-cxx_pp_extra_options := $(CPPFLAGS)
-cxx_extra_options    := $(CXXFLAGS)
-cxx_ld_extra_options := $(LDFLAGS)
-cxx_extra_libs       := $(LIBS)
-
-r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g')
-r := $(patsubst -L%,%,$(filter -L%,$(r)))
-r := $(shell echo $(r) | sed -e 's/ /:/g')
-
-cxx_extra_lib_paths  := $(r)
diff --git a/libbackend-elements/build/cxx/gnu/configuration-dynamic.make b/libbackend-elements/build/cxx/gnu/configuration-dynamic.make
deleted file mode 100644
index f3fe64d..0000000
--- a/libbackend-elements/build/cxx/gnu/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-ifneq ($(CXX),)
-cxx_gnu := $(CXX)
-else
-cxx_gnu := g++
-endif
-
-cxx_gnu_libraries := 
-cxx_gnu_optimization_options :=
diff --git a/libbackend-elements/build/import/libboost/configuration-dynamic.make b/libbackend-elements/build/import/libboost/configuration-dynamic.make
deleted file mode 100644
index ab55882..0000000
--- a/libbackend-elements/build/import/libboost/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-libboost_installed := y
-libboost_suffix := $(BOOST_LIB_SUFFIX)
-
-ifeq ($(BOOST_LINK_SYSTEM),n)
-libboost_system := n
-else
-libboost_system := y
-endif
diff --git a/libbackend-elements/build/import/libcult/configuration-dynamic.make b/libbackend-elements/build/import/libcult/configuration-dynamic.make
deleted file mode 100644
index 73c92bb..0000000
--- a/libbackend-elements/build/import/libcult/configuration-dynamic.make
+++ /dev/null
@@ -1,4 +0,0 @@
-libcult_installed := n
-src_root := $(abspath $(src_root)/../libcult)
-scf_root := $(src_root)/build
-out_root := $(src_root)
diff --git a/libbackend-elements/build/ld/configuration-lib-dynamic.make b/libbackend-elements/build/ld/configuration-lib-dynamic.make
deleted file mode 100644
index 74c8885..0000000
--- a/libbackend-elements/build/ld/configuration-lib-dynamic.make
+++ /dev/null
@@ -1,13 +0,0 @@
-ld_lib_type   := archive
-
-ifneq ($(AR),)
-ld_lib_ar     := $(AR)
-else
-ld_lib_ar     := ar
-endif
-
-ifneq ($(RANLIB),)
-ld_lib_ranlib := $(RANLIB)
-else
-ld_lib_ranlib := ranlib
-endif
diff --git a/libcult/build/configuration-dynamic.make b/libcult/build/configuration-dynamic.make
deleted file mode 100644
index e027b0b..0000000
--- a/libcult/build/configuration-dynamic.make
+++ /dev/null
@@ -1,3 +0,0 @@
-cult_dr := n
-cult_threads := n
-cult_network := n
diff --git a/libcult/build/cxx/configuration-dynamic.make b/libcult/build/cxx/configuration-dynamic.make
deleted file mode 100644
index 568ab40..0000000
--- a/libcult/build/cxx/configuration-dynamic.make
+++ /dev/null
@@ -1,14 +0,0 @@
-cxx_id       := gnu
-cxx_optimize := n
-cxx_debug    := n
-cxx_rpath    := n
-cxx_pp_extra_options := $(CPPFLAGS)
-cxx_extra_options    := $(CXXFLAGS)
-cxx_ld_extra_options := $(LDFLAGS)
-cxx_extra_libs       := $(LIBS)
-
-r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g')
-r := $(patsubst -L%,%,$(filter -L%,$(r)))
-r := $(shell echo $(r) | sed -e 's/ /:/g')
-
-cxx_extra_lib_paths  := $(r)
diff --git a/libcult/build/cxx/gnu/configuration-dynamic.make b/libcult/build/cxx/gnu/configuration-dynamic.make
deleted file mode 100644
index f3fe64d..0000000
--- a/libcult/build/cxx/gnu/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-ifneq ($(CXX),)
-cxx_gnu := $(CXX)
-else
-cxx_gnu := g++
-endif
-
-cxx_gnu_libraries := 
-cxx_gnu_optimization_options :=
diff --git a/libcult/build/ld/configuration-lib-dynamic.make b/libcult/build/ld/configuration-lib-dynamic.make
deleted file mode 100644
index 74c8885..0000000
--- a/libcult/build/ld/configuration-lib-dynamic.make
+++ /dev/null
@@ -1,13 +0,0 @@
-ld_lib_type   := archive
-
-ifneq ($(AR),)
-ld_lib_ar     := $(AR)
-else
-ld_lib_ar     := ar
-endif
-
-ifneq ($(RANLIB),)
-ld_lib_ranlib := $(RANLIB)
-else
-ld_lib_ranlib := ranlib
-endif
diff --git a/libcutl/build/c/configuration-dynamic.make b/libcutl/build/c/configuration-dynamic.make
new file mode 100644
index 0000000..17788dd
--- /dev/null
+++ b/libcutl/build/c/configuration-dynamic.make
@@ -0,0 +1,11 @@
+c_id               := generic
+c_pp_extra_options := $(CPPFLAGS)
+c_extra_options    := $(CFLAGS)
+c_ld_extra_options := $(LDFLAGS)
+c_extra_libs       := $(LIBS)
+
+r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g')
+r := $(patsubst -L%,%,$(filter -L%,$(r)))
+r := $(shell echo $(r) | sed -e 's/ /:/g')
+
+c_extra_lib_paths  := $(r)
diff --git a/libcutl/build/c/generic/configuration-dynamic.make b/libcutl/build/c/generic/configuration-dynamic.make
new file mode 100644
index 0000000..319a86d
--- /dev/null
+++ b/libcutl/build/c/generic/configuration-dynamic.make
@@ -0,0 +1,5 @@
+ifeq ($(filter $(origin CC),undefined default),)
+c_generic := $(CC)
+else
+c_generic := gcc
+endif
diff --git a/libcutl/build/cxx/configuration-dynamic.make b/libcutl/build/cxx/configuration-dynamic.make
new file mode 100644
index 0000000..83cf860
--- /dev/null
+++ b/libcutl/build/cxx/configuration-dynamic.make
@@ -0,0 +1,11 @@
+cxx_id               := generic
+cxx_pp_extra_options := $(CPPFLAGS)
+cxx_extra_options    := $(CXXFLAGS)
+cxx_ld_extra_options := $(LDFLAGS)
+cxx_extra_libs       := $(LIBS)
+
+r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g')
+r := $(patsubst -L%,%,$(filter -L%,$(r)))
+r := $(shell echo $(r) | sed -e 's/ /:/g')
+
+cxx_extra_lib_paths  := $(r)
diff --git a/libcutl/build/cxx/generic/configuration-dynamic.make b/libcutl/build/cxx/generic/configuration-dynamic.make
new file mode 100644
index 0000000..c43865a
--- /dev/null
+++ b/libcutl/build/cxx/generic/configuration-dynamic.make
@@ -0,0 +1,5 @@
+ifeq ($(filter $(origin CXX),undefined default),)
+cxx_generic := $(CXX)
+else
+cxx_generic := g++
+endif
diff --git a/libcutl/build/ld/configuration-lib-dynamic.make b/libcutl/build/ld/configuration-lib-dynamic.make
new file mode 100644
index 0000000..63d2ed3
--- /dev/null
+++ b/libcutl/build/ld/configuration-lib-dynamic.make
@@ -0,0 +1,13 @@
+ld_lib_type   := archive
+
+ifeq ($(filter $(origin AR),undefined default),)
+ld_lib_ar     := $(AR)
+else
+ld_lib_ar     := ar
+endif
+
+ifeq ($(filter $(origin RANLIB),undefined default),)
+ld_lib_ranlib := $(RANLIB)
+else
+ld_lib_ranlib := ranlib
+endif
diff --git a/libfrontend-elements/build/cxx/configuration-dynamic.make b/libfrontend-elements/build/cxx/configuration-dynamic.make
deleted file mode 100644
index 568ab40..0000000
--- a/libfrontend-elements/build/cxx/configuration-dynamic.make
+++ /dev/null
@@ -1,14 +0,0 @@
-cxx_id       := gnu
-cxx_optimize := n
-cxx_debug    := n
-cxx_rpath    := n
-cxx_pp_extra_options := $(CPPFLAGS)
-cxx_extra_options    := $(CXXFLAGS)
-cxx_ld_extra_options := $(LDFLAGS)
-cxx_extra_libs       := $(LIBS)
-
-r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g')
-r := $(patsubst -L%,%,$(filter -L%,$(r)))
-r := $(shell echo $(r) | sed -e 's/ /:/g')
-
-cxx_extra_lib_paths  := $(r)
diff --git a/libfrontend-elements/build/cxx/gnu/configuration-dynamic.make b/libfrontend-elements/build/cxx/gnu/configuration-dynamic.make
deleted file mode 100644
index f3fe64d..0000000
--- a/libfrontend-elements/build/cxx/gnu/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-ifneq ($(CXX),)
-cxx_gnu := $(CXX)
-else
-cxx_gnu := g++
-endif
-
-cxx_gnu_libraries := 
-cxx_gnu_optimization_options :=
diff --git a/libfrontend-elements/build/import/libcult/configuration-dynamic.make b/libfrontend-elements/build/import/libcult/configuration-dynamic.make
deleted file mode 100644
index 73c92bb..0000000
--- a/libfrontend-elements/build/import/libcult/configuration-dynamic.make
+++ /dev/null
@@ -1,4 +0,0 @@
-libcult_installed := n
-src_root := $(abspath $(src_root)/../libcult)
-scf_root := $(src_root)/build
-out_root := $(src_root)
diff --git a/libfrontend-elements/build/ld/configuration-lib-dynamic.make b/libfrontend-elements/build/ld/configuration-lib-dynamic.make
deleted file mode 100644
index 74c8885..0000000
--- a/libfrontend-elements/build/ld/configuration-lib-dynamic.make
+++ /dev/null
@@ -1,13 +0,0 @@
-ld_lib_type   := archive
-
-ifneq ($(AR),)
-ld_lib_ar     := $(AR)
-else
-ld_lib_ar     := ar
-endif
-
-ifneq ($(RANLIB),)
-ld_lib_ranlib := $(RANLIB)
-else
-ld_lib_ranlib := ranlib
-endif
diff --git a/libxsd-frontend/build/configuration-dynamic.make b/libxsd-frontend/build/configuration-dynamic.make
new file mode 100644
index 0000000..d681b0b
--- /dev/null
+++ b/libxsd-frontend/build/configuration-dynamic.make
@@ -0,0 +1 @@
+libxsd_frontend_clean_gen := n
diff --git a/libxsd-frontend/build/cxx/configuration-dynamic.make b/libxsd-frontend/build/cxx/configuration-dynamic.make
index 568ab40..83cf860 100644
--- a/libxsd-frontend/build/cxx/configuration-dynamic.make
+++ b/libxsd-frontend/build/cxx/configuration-dynamic.make
@@ -1,7 +1,4 @@
-cxx_id       := gnu
-cxx_optimize := n
-cxx_debug    := n
-cxx_rpath    := n
+cxx_id               := generic
 cxx_pp_extra_options := $(CPPFLAGS)
 cxx_extra_options    := $(CXXFLAGS)
 cxx_ld_extra_options := $(LDFLAGS)
diff --git a/libxsd-frontend/build/cxx/generic/configuration-dynamic.make b/libxsd-frontend/build/cxx/generic/configuration-dynamic.make
new file mode 100644
index 0000000..c43865a
--- /dev/null
+++ b/libxsd-frontend/build/cxx/generic/configuration-dynamic.make
@@ -0,0 +1,5 @@
+ifeq ($(filter $(origin CXX),undefined default),)
+cxx_generic := $(CXX)
+else
+cxx_generic := g++
+endif
diff --git a/libxsd-frontend/build/cxx/gnu/configuration-dynamic.make b/libxsd-frontend/build/cxx/gnu/configuration-dynamic.make
deleted file mode 100644
index f3fe64d..0000000
--- a/libxsd-frontend/build/cxx/gnu/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-ifneq ($(CXX),)
-cxx_gnu := $(CXX)
-else
-cxx_gnu := g++
-endif
-
-cxx_gnu_libraries := 
-cxx_gnu_optimization_options :=
diff --git a/libxsd-frontend/build/import/libboost/configuration-dynamic.make b/libxsd-frontend/build/import/libboost/configuration-dynamic.make
deleted file mode 100644
index ab55882..0000000
--- a/libxsd-frontend/build/import/libboost/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-libboost_installed := y
-libboost_suffix := $(BOOST_LIB_SUFFIX)
-
-ifeq ($(BOOST_LINK_SYSTEM),n)
-libboost_system := n
-else
-libboost_system := y
-endif
diff --git a/libxsd-frontend/build/import/libcult/configuration-dynamic.make b/libxsd-frontend/build/import/libcult/configuration-dynamic.make
deleted file mode 100644
index 73c92bb..0000000
--- a/libxsd-frontend/build/import/libcult/configuration-dynamic.make
+++ /dev/null
@@ -1,4 +0,0 @@
-libcult_installed := n
-src_root := $(abspath $(src_root)/../libcult)
-scf_root := $(src_root)/build
-out_root := $(src_root)
diff --git a/libxsd-frontend/build/import/libcutl/configuration-dynamic.make b/libxsd-frontend/build/import/libcutl/configuration-dynamic.make
new file mode 100644
index 0000000..4e4bb83
--- /dev/null
+++ b/libxsd-frontend/build/import/libcutl/configuration-dynamic.make
@@ -0,0 +1,8 @@
+ifeq ($(EXTERNAL_LIBCUTL),y)
+libcutl_installed := y
+else
+libcutl_installed := n
+src_root := $(abspath $(src_root)/../libcutl)
+scf_root := $(src_root)/build
+out_root := $(src_root)
+endif
diff --git a/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make b/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make
deleted file mode 100644
index 70d0da6..0000000
--- a/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make
+++ /dev/null
@@ -1,4 +0,0 @@
-libfrontend_elements_installed := n
-src_root := $(abspath $(src_root)/../libfrontend-elements)
-scf_root := $(src_root)/build
-out_root := $(src_root)
diff --git a/libxsd-frontend/build/ld/configuration-lib-dynamic.make b/libxsd-frontend/build/ld/configuration-lib-dynamic.make
index 74c8885..63d2ed3 100644
--- a/libxsd-frontend/build/ld/configuration-lib-dynamic.make
+++ b/libxsd-frontend/build/ld/configuration-lib-dynamic.make
@@ -1,12 +1,12 @@
 ld_lib_type   := archive
 
-ifneq ($(AR),)
+ifeq ($(filter $(origin AR),undefined default),)
 ld_lib_ar     := $(AR)
 else
 ld_lib_ar     := ar
 endif
 
-ifneq ($(RANLIB),)
+ifeq ($(filter $(origin RANLIB),undefined default),)
 ld_lib_ranlib := $(RANLIB)
 else
 ld_lib_ranlib := ranlib
diff --git a/makefile b/makefile
index aab9fb2..c8330a6 100644
--- a/makefile
+++ b/makefile
@@ -28,26 +28,17 @@ dist-win: $(out_base)/xsde/.dist-win
 
 # Clean.
 #
-clean: $(out_base)/libcult/.clean              \
-       $(out_base)/libfrontend-elements/.clean \
-       $(out_base)/libbackend-elements/.clean  \
-       $(out_base)/libxsd-frontend/.clean      \
+clean: $(out_base)/libxsd-frontend/.clean      \
        $(out_base)/xsde/.clean
 
-src_root := $(src_base)/libcult
+ifneq ($(EXTERNAL_LIBCUTL),y)
+src_root := $(src_base)/libcutl
 scf_root := $(src_root)/build
 out_root := $(src_root)
-$(call import,$(src_base)/libcult/makefile)
+$(call import,$(src_base)/libcutl/makefile)
 
-src_root := $(src_base)/libfrontend-elements
-scf_root := $(src_root)/build
-out_root := $(src_root)
-$(call import,$(src_base)/libfrontend-elements/makefile)
-
-src_root := $(src_base)/libbackend-elements
-scf_root := $(src_root)/build
-out_root := $(src_root)
-$(call import,$(src_base)/libbackend-elements/makefile)
+clean: $(out_base)/libcutl/.clean
+endif
 
 src_root := $(src_base)/libxsd-frontend
 scf_root := $(src_root)/build
diff --git a/xsde/build/c/configuration-dynamic.make b/xsde/build/c/configuration-dynamic.make
index 2003d76..17788dd 100644
--- a/xsde/build/c/configuration-dynamic.make
+++ b/xsde/build/c/configuration-dynamic.make
@@ -1,7 +1,4 @@
-c_id       := gnu
-c_optimize := n
-c_debug    := n
-c_rpath    := n
+c_id               := generic
 c_pp_extra_options := $(CPPFLAGS)
 c_extra_options    := $(CFLAGS)
 c_ld_extra_options := $(LDFLAGS)
diff --git a/xsde/build/c/generic/configuration-dynamic.make b/xsde/build/c/generic/configuration-dynamic.make
new file mode 100644
index 0000000..319a86d
--- /dev/null
+++ b/xsde/build/c/generic/configuration-dynamic.make
@@ -0,0 +1,5 @@
+ifeq ($(filter $(origin CC),undefined default),)
+c_generic := $(CC)
+else
+c_generic := gcc
+endif
diff --git a/xsde/build/c/gnu/configuration-dynamic.make b/xsde/build/c/gnu/configuration-dynamic.make
deleted file mode 100644
index 4062154..0000000
--- a/xsde/build/c/gnu/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-ifneq ($(CC),)
-c_gnu := $(CC)
-else
-c_gnu := gcc
-endif
-
-c_gnu_libraries :=
-c_gnu_optimization_options :=
diff --git a/xsde/build/configuration-dynamic.make b/xsde/build/configuration-dynamic.make
index 32fa3ca..3b0d328 100644
--- a/xsde/build/configuration-dynamic.make
+++ b/xsde/build/configuration-dynamic.make
@@ -21,3 +21,5 @@ xsde_parser_imap_buckets            := 97
 xsde_serializer_smap_buckets        := 53
 xsde_serializer_smap_bucket_buckets := 53
 xsde_serializer_imap_buckets        := 97
+
+xsde_clean_gen := no
\ No newline at end of file
diff --git a/xsde/build/cxx/configuration-dynamic.make b/xsde/build/cxx/configuration-dynamic.make
index 568ab40..83cf860 100644
--- a/xsde/build/cxx/configuration-dynamic.make
+++ b/xsde/build/cxx/configuration-dynamic.make
@@ -1,7 +1,4 @@
-cxx_id       := gnu
-cxx_optimize := n
-cxx_debug    := n
-cxx_rpath    := n
+cxx_id               := generic
 cxx_pp_extra_options := $(CPPFLAGS)
 cxx_extra_options    := $(CXXFLAGS)
 cxx_ld_extra_options := $(LDFLAGS)
diff --git a/xsde/build/cxx/generic/configuration-dynamic.make b/xsde/build/cxx/generic/configuration-dynamic.make
new file mode 100644
index 0000000..f35ea66
--- /dev/null
+++ b/xsde/build/cxx/generic/configuration-dynamic.make
@@ -0,0 +1,16 @@
+ifeq ($(filter $(origin CXX),undefined default),)
+cxx_generic := $(CXX)
+else
+cxx_generic := g++
+endif
+
+r := $(shell $(cxx_generic) $(cxx_extra_options) $(cxx_ld_extra_options) \
+-print-search-dirs 2>&1 | sed -e 's/libraries: =//p' -e d)
+
+ifneq ($r,)
+  ifeq ($(cxx_extra_lib_paths),)
+    cxx_extra_lib_paths := $r
+  else
+    cxx_extra_lib_paths := $(cxx_extra_lib_paths):$r
+  endif
+endif
diff --git a/xsde/build/cxx/gnu/configuration-dynamic.make b/xsde/build/cxx/gnu/configuration-dynamic.make
deleted file mode 100644
index f3fe64d..0000000
--- a/xsde/build/cxx/gnu/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-ifneq ($(CXX),)
-cxx_gnu := $(CXX)
-else
-cxx_gnu := g++
-endif
-
-cxx_gnu_libraries := 
-cxx_gnu_optimization_options :=
diff --git a/xsde/build/import/cli/configuration-dynamic.make b/xsde/build/import/cli/configuration-dynamic.make
new file mode 100644
index 0000000..908d979
--- /dev/null
+++ b/xsde/build/import/cli/configuration-dynamic.make
@@ -0,0 +1,3 @@
+# We ship up-to-date generated files so cli normally won't be invoked.
+#
+cli_installed := y
diff --git a/xsde/build/import/libbackend-elements/configuration-dynamic.make b/xsde/build/import/libbackend-elements/configuration-dynamic.make
deleted file mode 100644
index 8a6f091..0000000
--- a/xsde/build/import/libbackend-elements/configuration-dynamic.make
+++ /dev/null
@@ -1,4 +0,0 @@
-libbackend_elements_installed := n
-src_root := $(abspath $(src_root)/../libbackend-elements)
-scf_root := $(src_root)/build
-out_root := $(src_root)
diff --git a/xsde/build/import/libboost/configuration-dynamic.make b/xsde/build/import/libboost/configuration-dynamic.make
deleted file mode 100644
index ab55882..0000000
--- a/xsde/build/import/libboost/configuration-dynamic.make
+++ /dev/null
@@ -1,8 +0,0 @@
-libboost_installed := y
-libboost_suffix := $(BOOST_LIB_SUFFIX)
-
-ifeq ($(BOOST_LINK_SYSTEM),n)
-libboost_system := n
-else
-libboost_system := y
-endif
diff --git a/xsde/build/import/libcult/configuration-dynamic.make b/xsde/build/import/libcult/configuration-dynamic.make
deleted file mode 100644
index 73c92bb..0000000
--- a/xsde/build/import/libcult/configuration-dynamic.make
+++ /dev/null
@@ -1,4 +0,0 @@
-libcult_installed := n
-src_root := $(abspath $(src_root)/../libcult)
-scf_root := $(src_root)/build
-out_root := $(src_root)
diff --git a/xsde/build/import/libcutl/configuration-dynamic.make b/xsde/build/import/libcutl/configuration-dynamic.make
new file mode 100644
index 0000000..4e4bb83
--- /dev/null
+++ b/xsde/build/import/libcutl/configuration-dynamic.make
@@ -0,0 +1,8 @@
+ifeq ($(EXTERNAL_LIBCUTL),y)
+libcutl_installed := y
+else
+libcutl_installed := n
+src_root := $(abspath $(src_root)/../libcutl)
+scf_root := $(src_root)/build
+out_root := $(src_root)
+endif
diff --git a/xsde/build/ld/configuration-lib-dynamic.make b/xsde/build/ld/configuration-lib-dynamic.make
deleted file mode 100644
index c2c560c..0000000
--- a/xsde/build/ld/configuration-lib-dynamic.make
+++ /dev/null
@@ -1,3 +0,0 @@
-ld_lib_type   := archive
-ld_lib_ar     := ar
-ld_lib_ranlib := ranlib
-- 
cgit v1.1