19461700 Split source & build subdirectories in X builds
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Sun, 23 Nov 2014 21:46:46 -0800
changeset 1422 e9cadc0026d8
parent 1421 e78901f90784
child 1423 d7b111d2d3d7
19461700 Split source & build subdirectories in X builds
.hgignore
buildit
download-tarballs
open-src/README
open-src/app/accessx/Makefile
open-src/app/accessx/sun-src/Makefile
open-src/app/cmap_alloc/Makefile
open-src/app/cmap_alloc/sun-src/Makefile
open-src/app/cmap_compact/Makefile
open-src/app/cmap_compact/sun-src/Makefile
open-src/app/dispswitch/Makefile
open-src/app/dispswitch/sun-src/Makefile
open-src/app/dsession/Makefile
open-src/app/fbconsole/Makefile
open-src/app/fbconsole/sun-src/Makefile
open-src/app/gfx-utils/Makefile
open-src/app/gfx-utils/sun-src/Makefile
open-src/app/installalias/Makefile
open-src/app/kbd_mode/Makefile
open-src/app/kbd_mode/sun-src/Makefile
open-src/app/mesa-demos/Makefile
open-src/app/mkcookie/Makefile
open-src/app/winsysck/Makefile
open-src/app/winsysck/sun-src/Makefile
open-src/app/xcolor/Makefile
open-src/app/xcolor/sun-src/Makefile
open-src/app/xdm/Makefile
open-src/app/xfontsel/Makefile
open-src/app/xload/Makefile
open-src/app/xlock/Makefile
open-src/app/xlock/sun-src/Makefile
open-src/app/xlswins/Makefile
open-src/app/xlswins/sun-src/Makefile
open-src/app/xmag_multivis/Makefile
open-src/app/xmag_multivis/sun-src/Makefile
open-src/app/xpm/Makefile
open-src/common/Makefile.inc
open-src/common/Makefile.subdirs
open-src/driver/Makefile.inc
open-src/driver/efb/Makefile
open-src/driver/xf86-input-hotkey/Makefile
open-src/driver/xf86-video-intel/Makefile
open-src/driver/xf86-video-openchrome/Makefile
open-src/font/encodings/Makefile
open-src/lib/DPS/Makefile
open-src/lib/DPS/sun-src/Makefile
open-src/lib/Makefile.inc
open-src/lib/freetype/Makefile
open-src/lib/freetype/unix-cc.in.9.patch
open-src/lib/libFS/solaris-abi.patch
open-src/lib/libX11/Makefile
open-src/lib/libX11/lintlib.patch
open-src/lib/libX11/solaris-abi.patch
open-src/lib/libXaw4/Makefile
open-src/lib/libXaw5/Makefile
open-src/lib/libXmu/solaris-abi.patch
open-src/lib/libXt/6671721.patch
open-src/lib/libXtsol/Makefile
open-src/lib/libXtsol/sun-src/Makefile
open-src/lib/libXv/Makefile
open-src/lib/libXv/lintlib.patch
open-src/lib/libdga/Makefile
open-src/lib/libdrm/Makefile
open-src/lib/libglu/Makefile
open-src/lib/libowconfig/Makefile
open-src/lib/libowconfig/sun-src/Makefile
open-src/lib/libpciaccess/Makefile
open-src/lib/libxcb/Makefile
open-src/lib/mesa/Makefile
open-src/util/build-tools/Makefile
open-src/xserver/xorg/IA.patch
open-src/xserver/xorg/Makefile
open-src/xserver/xorg/patch-list
open-src/xserver/xorg/stop-using-il.patch
open-src/xserver/xorg/sun-src/os/solaris/mdb/modules/Makefile
open-src/xserver/xvnc/Makefile
--- a/.hgignore	Wed Nov 12 11:14:21 2014 -0800
+++ b/.hgignore	Sun Nov 23 21:46:46 2014 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -30,6 +30,7 @@
 /build-sparcv9/
 /build-core/
 /build-iso8859-\d*/
+/unpacked-src/
 # Skip downloaded tarballs
 open-src/tarballs
 # Skip checksum verification files for downloaded tarballs
@@ -44,6 +45,9 @@
 ^open-src/data/smf-rbac/x11-server.xml$
 # Skip emacs/patch backup files
 .*\~$
+# Skip xref files
+/cscope\.
+/tags
 # Skip Solaris make state files
 /\.make\.state
 # Skip directories used by gate hooks
--- a/buildit	Wed Nov 12 11:14:21 2014 -0800
+++ b/buildit	Sun Nov 23 21:46:46 2014 -0800
@@ -5,7 +5,7 @@
 #
 ###########################################################################
 #
-# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -125,7 +125,7 @@
 cd open-src
 # Run as two steps to avoid race between cleaning & rebuilding when
 # using parallel make
-${XMAKE} clean
+${XMAKE} clobber
 ${XMAKE} install
 ${XMAKE} check_rtime > ../log/check-rtime 2>&1 &
 cd ..
--- a/download-tarballs	Wed Nov 12 11:14:21 2014 -0800
+++ b/download-tarballs	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 ###########################################################################
 #
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -36,9 +36,9 @@
 
 CLOBBER=0
 WGET='/usr/bin/wget'
-MAKE_FLAGS="-k"
+XMAKE="$(pwd)/open-src/util/build-tools/xmake ${VERBOSE_FLAGS} -k"
 # Make sure Solaris make, not GNU make, is first in the $PATH
-export PATH=/usr/bin:/usr/ccs/bin
+export PATH=/usr/bin:${PATH}
 
 set -- $(getopt cn $*)
 if [[ $? != 0 ]] ; then
@@ -53,17 +53,17 @@
     esac
 done
 
-make setup || fatal_error "make setup failed: cannot continue"
+${XMAKE} setup || fatal_error "make setup failed: cannot continue"
 
 set -v
 
 cd open-src
-if [[ $CLOBBER = 1 ]] ; then
+if [[ $CLOBBER == 1 ]] ; then
     rm -rf tarballs
 fi
 if [[ ! -d tarballs ]] ; then 
     mkdir tarballs
 fi
-make ${MAKE_FLAGS} download
+${XMAKE} download
 cd ../..
 
--- a/open-src/README	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/README	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 
 General Overview:
 -----------------
-This tree builds dozens of open source modules that are each released 
+This tree builds hundreds of open source modules that are each released
 separately and delivered as source in separate tarballs.   These modules
 are organized in subdirectories based on the X.Org module list, though
 modules from other sources are included as appropriate.   For instance,
@@ -12,28 +12,32 @@
 In this tree, the term "module" is used for a specific set of source built
 generally from a single tarball from upstream, such as xterm or fontconfig.
 The directories grouping these together are referred to as "module type"
-directories - app, lib, font, etc.   Each module is thus found in a 
+directories - app, lib, font, etc.   Each module is thus found in a
 subdirectory of the form open-src/<module type>/<module> .   Various flags
 can be set at either the individual module level or for all modules of a
 module type.
 
-For each module, at build time the tarball is unpacked, patches applied for
-post-release bug fixes or customizations, and then the build is run.
+For each module, at build time the tarball is unpacked to a directory named
+"unpacked-src", patches applied for post-release bug fixes or customizations,
+and then the build is run.  Since those subdirectories can be competely
+recreated from the source tarball and patches, rebuilding the tree or running
+"make clobber" simply removes them entirely and recreates them.
 
 To allow building both 32-bit and 64-bit versions in the same build,
-and building both sparc and x86 versions in the same tree, this all 
-happens in subdirectories named build-amd64, build-i386, build-sparc,
-and build-sparcv9 in each modules' directory.   Since those subdirectories
-are competely recreatable from the source tarball and patches, rebuilding the
-tree or running make clean simply removes them entirely and recreates them.
+and building both sparc and x86 versions in the same tree, the objects are
+then built in subdirectories named build-amd64, build-i386, build-sparc,
+and build-sparcv9 in each modules' directory.   "make clean" or "make clobber"
+simply removes these build directories entirely, and lets the next build
+recreate them as needed.
+
 Note that some modules, especially the fonts, use different build-* patterns
-for the variants they build, and thus trying to have both sparc & x86 
+for the variants they build, and thus trying to have both sparc & x86
 platforms building in the same directory at the same time will likely fail
 as they stomp on each other in those directories.  Running one build then
 the other should work.
 
 You should be able to run make commands in any module directory or
-module-type directory, though since most of the intermodule dependencies 
+module-type directory, though since most of the intermodule dependencies
 are not declared, many modules will break unless you've done a full-tree
 build at some point to populate the proto area with the bits needed.
 
@@ -45,21 +49,25 @@
 
 For most of these you can append _32 or _64 to do just the 32-bit or 64-bit
 versions of the targets, while the version listed here repeats for all build
-types set in the BUILD_TYPES variable.    These are defined in the 
+types set in the BUILD_TYPES variable.    These are defined in the
 open-src/common/Makefile.inc file, though open-src/<module type>/Makefile.inc
 may add additional rules needed for modules of that type.
 
 make clean
-	Completely removes build_* directories.
+	Completely removes build-* directories.
+
+make clobber
+	Completely removes build-* & unpacked-src directories.
 
 make source
-	Creates build_* directories by unpacking sources from tarball
+	Creates unpacked-src directories by unpacking sources from tarball
 	and applying patches.
 
 make configure
 	Runs GNU autoconf script or similar configuration steps if
 	needed, including autoreconf or delibtoolize if variables are set.
-	(Runs make source first if needed.)
+	(Runs make source first if needed, and creates build-* directory
+	 if needed.)
 
 make build
 	Compile the software into the binaries that get installed.
@@ -74,13 +82,13 @@
 	equivalent to make build for most modules
 
 make debug
-	same as make all, but with compiler optimization flags changed 
-	to "-g".  (Note that if you haven't done a make clean first, 
-	doesn't force a recompile, so running make debug in a directory 
+	same as make all, but with compiler optimization flags changed
+	to "-g".  (Note that if you haven't done a make clean first,
+	doesn't force a recompile, so running make debug in a directory
 	you already built non-debug may not actually build debug versions.)
 
 make debug-install
-	same as make install, but with compiler optimization flags changed 
+	same as make install, but with compiler optimization flags changed
 	to "-g".  (See warning on make debug about doing a make clean first.)
 
 make download
@@ -98,7 +106,7 @@
 	See "Building from git" section below.
 
 make manifest
-	Run the make install rules with DESTDIR set to a temporary directory, 
+	Run the make install rules with DESTDIR set to a temporary directory,
 	and then generate a pkg manifest in pkg/manifests/$(MODULE_PKGNAME).mf
 	that includes all the installed files.   If a manifest already exists
 	there, this merges changes with the existing manifest so that you can
@@ -120,8 +128,11 @@
 make clean
 	Run make clean in all subdirectories.
 
+make clobber
+	Run make clobber in all subdirectories.
+
 make World
-	Run make clean in all subdirectories, then make all in all subdirs.
+	Run make clobber in all subdirectories, then make all in all subdirs.
 
 make install
 	Run make install in all subdirectories.
@@ -154,12 +165,11 @@
 
 MODULE_VERSION
  - Version of the source to use, used by default in the tarball name and
-   source directory unpacked from it.   Also exported to the package 
+   source directory unpacked from it.   Also exported to the package
    attributes as __version:$(MODULE_NAME)__ for use in package manifests.
-   - Special values:  
+   - Special values:
 	"git" - see "Building from git" below
-        "src" - used when there is no upstream tarball, only local sources
-	"NONE" - used when no build_* directories are created
+	"src" - used when there is no upstream tarball, only local sources
 
 Required for some modules:
 
@@ -183,11 +193,15 @@
    to specify flags to be passed to gpatch.   The flags argument
    is most commonly used to specify -p1 to ignore the a/ & b/ path
    prefixes in git-generated patch files - if no flags are specified,
-   -p0 is passed to treat paths as relative to the top of $(BUILD_DIR).
+   -p0 is passed to treat paths as relative to the top of $(SOURCE_DIR).
 
 ADDITIONAL_SOURCE_DIR
  - Directory containing additional source files to be linked into the
-   build directory by the default_source rule.
+   source directory by the default_source rule.
+
+CLONE_SRC
+ - If set to "yes", causes the build directory creation to make links for
+   all the files in the source directory into each build directory.
 
 SUNTOUCHED_MANPAGES
  - Man pages to add Solaris attributes section and other common Solaris
@@ -209,10 +223,10 @@
 
 MODULE_DESC
  - description of the module to be used in license notices or package metadata
-   It should be short, specific, concise text, identifying the technology 
-   covered by the associated license(s).  It should fit naturally in the 
-   sentence "This package may contain XXX."  For example, "XXX" might be 
-   "the xset command" or "bzip2 compression software."  When appropriate, 
+   It should be short, specific, concise text, identifying the technology
+   covered by the associated license(s).  It should fit naturally in the
+   sentence "This package may contain XXX."  For example, "XXX" might be
+   "the xset command" or "bzip2 compression software."  When appropriate,
    this may begin with "portions of" or another, more specific qualifying
    clause.
 
@@ -238,20 +252,21 @@
    "fixed" to add required -R flags for linking libraries with and remove
    unnecessary Requires.privates lines from.
 
-MODULE_SOURCE_DEPS, MODULE_CONFIGURE_DEPS, 
+MODULE_SOURCE_DEPS, MODULE_CONFIGURE_DEPS,
 MODULE_BUILD_DEPS, MODULE_INSTALL_DEPS
  - Makefile targets/rules that the default_* rules list as dependencies
 
-MODULE_ADD_SOURCE_TARGETS, MODULE_ADD_CONFIGURE_TARGETS, 
+MODULE_ADD_SOURCE_TARGETS, MODULE_ADD_CONFIGURE_TARGETS,
 MODULE_ADD_BUILD_TARGETS, MODULE_ADD_INSTALL_TARGETS
  - Additional targets/rules run by "make source", "make configure", etc.
-   in addition to default_* if *_TARGETS is not overridden.
+   in addition to default_* if *_TARGETS is not overridden.  Run for each
+   build type.
 
 MODULE_CONFIG_OPTS
  - Additional arguments passed to configure script by default_config rule
 
 MODULE_CONFIG_ENV
- - Additional environment variables passed to configure script 
+ - Additional environment variables passed to configure script
    by default_config rule
 
 MODULE_CFLAGS
@@ -263,7 +278,7 @@
    default_config rule.
 
 MODULE_CPPFLAGS
- - C preprocessor flags (-I & -D) passed to configure via CPPFLAGS 
+ - C preprocessor flags (-I & -D) passed to configure via CPPFLAGS
    variable by default_config rule.
 
 MODULE_DEBUG_FLAGS
@@ -290,9 +305,9 @@
    MODTYPE_CONFIG_ENG will still be passed.
 
 AUTORECONF
- - If set to "yes", the default_config rule will run autoreconf before
-   running configure, to regenerate autoconf/automake/libtool created
-   files after patches have been applied to the *.ac/*.am/*.in source files.
+ - If set to "yes", the default_source rule will run autoreconf in the source
+   directory, to regenerate autoconf/automake/libtool created files after
+   patches have been applied to the *.ac/*.am/*.in source files.
 
 DELIBTOOLIZE
  - If set to "yes", the default_config rule will run the script
@@ -324,7 +339,7 @@
 MODULE_X11_LIBCOMPAT_LINKS
  - For binaries previously delivered in /usr/X11/bin or libraries previously
    delivered in /usr/X11/lib (or their /usr/openwin predecessors), set these
-   to the basenames of files to link from each of those directories to 
+   to the basenames of files to link from each of those directories to
    /usr/lib & /usr/bin.   For libraries, be sure to include both the .so and
    the .so.* names, if both are still delivered.
 
@@ -338,7 +353,7 @@
 	SOURCE_URL_SET=yes
 
 MODULE_PKGNAME
- - IPS/pkg(5) package name that this module is shipped in.  Used in 
+ - IPS/pkg(5) package name that this module is shipped in.  Used in
    attributes section of man page, when generating manifests, and for
    delivering license and other metadata from the build to the package.
    Default: $(MODTYPE_PKGHIER)/$(MODULE_NAME), translated to lowercase
@@ -362,12 +377,12 @@
    Default: http://www.x.org/
 
 MODULE_COMPILER
- - Compiler to use, either "suncc" or "gcc".   
-   Default: $(DEFAULT_COMPILER) setting in common/Makefile.init, 
+ - Compiler to use, either "suncc" or "gcc".
+   Default: $(DEFAULT_COMPILER) setting in common/Makefile.init,
    which is set to suncc in the master sources.
 
 MODULE_MAKE
- - make command to use, either "$(MAKE)" or "$(GNUMAKE)".   
+ - make command to use, either "$(MAKE)" or "$(GNUMAKE)".
    Default: "$(MAKE)" (which is assumed to be Solaris make, not GNU).
 
 MODULE_PREFIX
@@ -400,14 +415,14 @@
    Default: $(XORG_RELEASES_URL)/$(SOURCE_TARBALL_DIR)/$(SOURCE_TARBALL_NAME)
 
 GIT_URL
- - URL to check out the current sources via the git code manager if 
+ - URL to check out the current sources via the git code manager if
    MODULE_VERSION is set to "git" - see "Building from git" below
    Default: $(XORG_GIT_URL)/$(SOURCE_TARBALL_DIR)/$(MODULE_NAME).git
 
 BUILD_TYPES
  - What type of output to build for this module - usually the word-size of
    the binaries built (32 and/or 64), but may be set to any string if other
-   distinctions are useful.   For most modules that don't build binaries, 
+   distinctions are useful.   For most modules that don't build binaries,
    (fonts, proto headers, docs, etc.) it's set to 32 for simplicity.
    For each value xx in this list, a build_xx directory will be made and
    the source_xx, configure_xx, build_xx and install_xx rules run.
@@ -417,7 +432,7 @@
  - Makefile targets/rules to run for "make source", "make configure",
    "make build", and "make install"
    Defaults: default_source, default_configure, default_build, default_install
-   The *_TARGETS may be appended to by setting the MODTYPE_ADD_*_TARGETS 
+   The *_TARGETS may be appended to by setting the MODTYPE_ADD_*_TARGETS
    and/or MODULE_ADD_*_TARGETS variables.
 
 AUTOCONF_TARGET
@@ -436,7 +451,7 @@
 
 MODULE_LICENSE
  - Name of the license.   See the "license" attribute in pkg(5) for details.
-   Must be unique for each license aggregated into a package, so if two 
+   Must be unique for each license aggregated into a package, so if two
    upstream modules with different license texts are delivered into the
    same package, they cannot both have the license name "MIT License", which
    is why our default string includes the package name to disambiguate.
@@ -459,7 +474,7 @@
 -------------------------------------------------------------------
 
 Some settings are common to most, if not all of the modules of a given
-type.   For those, these variables can be set in 
+type.   For those, these variables can be set in
 open-src/<module_type>/Makefile.inc - they have the same meanings and uses
 as the MODULE_* versions documented above, and appear in commands before
 the MODULE_* versions - the general pattern is
@@ -468,7 +483,7 @@
 Required for all module types:
 
 MODTYPE
- - Name of the directory for this module type, usually the same as the 
+ - Name of the directory for this module type, usually the same as the
    directory for the module type in X.Org's source trees.
 
 Optional, default is empty:
@@ -513,7 +528,7 @@
 open-src/common/Makefile.init defines $MACH to be either sparc or i386
 for the platform being built.   You can reference this variable in the
 names of other variables to set different values for each platform.
-For instance, to build only 64-bit on SPARC, but both 32-bit and 64-bit 
+For instance, to build only 64-bit on SPARC, but both 32-bit and 64-bit
 on x86/x64, you can do:
 
 	BUILD_TYPES_sparc=64
@@ -588,7 +603,7 @@
   Makefile.inc is included to prevent the default from being set.
 
 LICENSE_CHOICE
-- For modules with MODULE_LICENSE="Oracle", this controls which license 
+- For modules with MODULE_LICENSE="Oracle", this controls which license
   terms are published in the package.  This must be set to "Oracle" for
   builds done for Oracle Solaris.   If not set, it defaults to "open",
   which is the value that all others must use, unless they have obtained
@@ -601,7 +616,7 @@
 
 FDO_GIT_URL & XORG_GIT_URL
 - url for git repositories hosted on freedesktop.org, including
-  X.Org, Mesa, pixman, etc.  - defaults to anonymous git over http, can 
+  X.Org, Mesa, pixman, etc.  - defaults to anonymous git over http, can
   change to use another protocol if needed
 
 =============================================================================
@@ -613,7 +628,7 @@
 
 find-build-errors - looks for a log/buildit-XW file (or another file you
 	specify on the command line) and tries to isolate out just the
-	build errors for easier reading than the raw build logs.   
+	build errors for easier reading than the raw build logs.
 	If you did buildit -p, also shows packaging errors.
 
 xmake - when you change one file in a large module like xserver and just
@@ -631,7 +646,7 @@
 Building from git:
 
 For debugging and development purposes, such as working on the merge of
-a X.org release still in development, you can choose to  to check out a 
+a X.org release still in development, you can choose to  to check out a
 the upstream sources from a the git repository instead of a tarball.
 
 You must *NOT* check in to the master gate a module using this feature,
@@ -669,7 +684,7 @@
 
 =============================================================================
 
-Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
--- a/open-src/app/accessx/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/accessx/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -57,17 +57,19 @@
 SUNTOUCHED_MANPAGES= accessx.1
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Override timestamps embedded in uil output files
 TIME_CONSTANT = 1272503297
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_CONFIG_ENV = PREFIX=$(MODULE_PREFIX) $(CONSTANT_TIME)
-MODULE_BUILD_MAKEFLAGS	= $(CONFIG_ENV)
-MODULE_INSTALL_MAKEFLAGS= $(CONFIG_ENV)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_CONFIG_ENV = $(CONSTANT_TIME)
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = accessx
--- a/open-src/app/accessx/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/accessx/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -29,6 +29,9 @@
 
 OBJS = $(SRCS:.c=.o)
 
+# Files to be translated
+L10N_FILES = accessx.hlp accessx.uid accessx.uil accessxstrings.uil
+
 all:: accessx.uid accessx
 
 accessx.uid: accessx.uil
@@ -38,11 +41,10 @@
 accessx: $(OBJS)
 	$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) -lMrm -lXm -lXt -lX11 -lXext
 
-install: accessx
+install: accessx accessx.uid accessx.1 $(L10N_FILES)
 	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
 	mkdir -p $(DESTDIR)$(PREFIX)/share/X11/locale/C/accessx
 	$(INSTALL) -m 0555 accessx $(DESTDIR)$(PREFIX)/bin
 	$(INSTALL) -m 0444 accessx.1 $(DESTDIR)$(PREFIX)/share/man/man1
-	$(INSTALL) -m 0444 \
-		accessx.hlp accessx.uid accessx.uil accessxstrings.uil \
+	$(INSTALL) -m 0444 $(L10N_FILES) \
 		$(DESTDIR)$(PREFIX)/share/X11/locale/C/accessx/
--- a/open-src/app/cmap_alloc/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/cmap_alloc/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -51,13 +51,15 @@
 SUNTOUCHED_MANPAGES=cmap_alloc.1
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = cmap_alloc
--- a/open-src/app/cmap_alloc/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/cmap_alloc/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,7 @@
 cmap_alloc: $(OBJS)
 	$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) -lX11
 
-install: cmap_alloc
+install: cmap_alloc cmap_alloc.1
 	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
 	$(INSTALL) -m 0555 cmap_alloc $(DESTDIR)$(PREFIX)/bin
 	$(INSTALL) -m 0444 cmap_alloc.1 $(DESTDIR)$(PREFIX)/share/man/man1
--- a/open-src/app/cmap_compact/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/cmap_compact/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -51,13 +51,15 @@
 SUNTOUCHED_MANPAGES= cmap_compact.1
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = cmap_compact
--- a/open-src/app/cmap_compact/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/cmap_compact/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -35,7 +35,7 @@
 cmap_compact: $(OBJS)
 	$(LD) -g -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) -lX11
 
-install: cmap_compact
+install: cmap_compact cmap_compact.1
 	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
 	$(INSTALL) -m 0555 cmap_compact $(DESTDIR)$(PREFIX)/bin
 	$(INSTALL) -m 0444 cmap_compact.1 $(DESTDIR)$(PREFIX)/share/man/man1
--- a/open-src/app/dispswitch/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/dispswitch/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # dispswitch - utility for changing display configuration upon hotkey press
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -54,13 +54,15 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Volatile
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = dispswitch
--- a/open-src/app/dispswitch/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/dispswitch/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -32,7 +32,7 @@
 dispswitch: $(OBJS)
 	$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
 
-install: dispswitch
+install: dispswitch dispswitch.man gnome-dispswitch.desktop
 	mkdir -p $(DESTDIR)$(PREFIX)/bin \
 		 $(DESTDIR)$(PREFIX)/share/man/man1 \
 		 $(DESTDIR)/etc/xdg/autostart
--- a/open-src/app/dsession/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/dsession/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -35,7 +35,7 @@
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
 SOURCE_TARGETS =
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS_SET=yes
 
 # Dates to show in Oracle copyright notice in pkg license file
 # Earliest & latest of the copyrights in the Oracle files in this pkg
@@ -53,12 +53,14 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Volatile
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 include ../Makefile.inc
--- a/open-src/app/fbconsole/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/fbconsole/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # fbconsole - fallback console utility
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -51,18 +51,21 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES = 
 
-# No configure script, so pass usual environment to build/install instead
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = fbconsole
--- a/open-src/app/fbconsole/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/fbconsole/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # fbconsole Makefile
 #
-# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -31,7 +31,7 @@
 fbconsole: $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lX11
 
-install:
+install: fbconsole
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
 	$(INSTALL) -m 755 fbconsole $(DESTDIR)$(PREFIX)/bin/fbconsole
 
--- a/open-src/app/gfx-utils/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/gfx-utils/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # SPARC graphics utilities modules (fbconfig & VTS) Makefile
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -50,6 +50,10 @@
 SOURCE_TARBALL_NAME_SET=yes
 ADDITIONAL_SOURCE_DIR=sun-src
 
+# Since the Makefiles in these subdirs haven't been updated to support VPATH
+# builds, just clone the whole source tree to the build tree for now.
+CLONE_SRC = yes
+
 # Haven't made sure it's 64-bit clean yet, so continue building 32-bit for now
 BUILD_TYPES_SET=yes
 BUILD_TYPES=32
@@ -58,14 +62,13 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to clone sources into build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_CONFIG_ENV	= LIB_LDFLAGS="$(LIB_LDFLAGS)"
-MODULE_BUILD_MAKEFLAGS	= $(CONFIG_ENV)
-MODULE_INSTALL_MAKEFLAGS= $(CONFIG_ENV)
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_CONFIG_ENV = LIB_LDFLAGS="$(LIB_LDFLAGS)"
 
 include ../Makefile.inc
 
--- a/open-src/app/gfx-utils/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/gfx-utils/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 # Makefile for gfx-util sub-modules
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -36,7 +36,7 @@
 # Dependencies needed for parallel make:
 
 PWD:sh=pwd
-TOP=$(PWD)/../../../../..
+TOP=$(PWD)/../../../..
 
 ### Include common definitions
 DIRNAME="app/gfx-utils/build_sparc/"
--- a/open-src/app/installalias/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/installalias/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # installalias - Utility to install X11 font aliases
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -40,19 +40,24 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
+LICENSE_FILE=sun-src/COPYING
+LICENSE_FILE_SET=yes
 
 # Man pages to apply Sun footer to & attributes to list
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY="Consolidation Private"
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Need to link with libXfont in server private directory
 MODULE_LDFLAGS= -L$(PROTODIR)$(X11_SERVERLIBS_DIR)$(ARCHLIBSUBDIR) \
--- a/open-src/app/kbd_mode/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/kbd_mode/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # kbd_mode - utility to change the Solaris kernel key event reporting mode
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -53,13 +53,15 @@
 SUNTOUCHED_MANPAGES= kbd_mode.1
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = kbd_mode
--- a/open-src/app/kbd_mode/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/kbd_mode/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,7 @@
 kbd_mode: $(OBJS)
 	$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS)
 
-install: kbd_mode
+install: kbd_mode kbd_mode.1
 	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
 	$(INSTALL) -m 0555 kbd_mode $(DESTDIR)$(PREFIX)/bin
 	$(INSTALL) -m 0444 kbd_mode.1 $(DESTDIR)$(PREFIX)/share/man/man1
--- a/open-src/app/mesa-demos/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/mesa-demos/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -48,7 +48,7 @@
 SOURCE_URL_SET=yes
 
 # Binaries built in tree
-DEMOS_DIR=$(SOURCE_DIR)/src/xdemos
+DEMOS_DIR=$(BUILD_DIR)/src/xdemos
 GLXGEARS_BIN=$(DEMOS_DIR)/glxgears
 GLXINFO_BIN=$(DEMOS_DIR)/glxinfo
 
--- a/open-src/app/mkcookie/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/mkcookie/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # mkcookie - Utility to create xauth cookies
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -44,7 +44,8 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
 # Haven't made sure it's 64-bit clean yet, so continue building 32-bit for now
 BUILD_TYPES_SET=yes
@@ -54,12 +55,14 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 include ../Makefile.inc
--- a/open-src/app/winsysck/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/winsysck/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -53,11 +53,15 @@
 SUNTOUCHED_MANPAGES=winsysck.man
 MODULE_STABILITY=Obsolete
 
-# No configure script, so pass usual environment to build/install instead
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
-MODULE_BUILD_ENV=$(CONFIG_ENV)
+# Since we don't have a configure script, pass configure flags to make
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 MODULE_INSTALL_MAKEFLAGS = bindir=$(X11_BIN_DIR) mandir=$(X11_MAN_DIR)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
--- a/open-src/app/winsysck/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/winsysck/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,8 +1,8 @@
 ###############################################################################
 #
-# winsysck 1.x Makefile
+# winsysck Makefile
 #
-# Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -30,7 +30,7 @@
 winsysck: $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lX11
 
-install: winsysck
+install: winsysck winsysck.man
 	mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
 	$(INSTALL) -m 755 winsysck $(DESTDIR)$(bindir)/winsysck
 	$(INSTALL) -m 644 winsysck.man \
--- a/open-src/app/xcolor/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xcolor/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -50,11 +50,15 @@
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES = 
 
-# No configure script, so pass usual environment to build/install instead
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
-MODULE_BUILD_ENV=$(CONFIG_ENV)
+# Since we don't have a configure script, pass configure flags to make
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 MODULE_INSTALL_MAKEFLAGS = bindir=$(X11_BIN_DIR) mandir=$(X11_MAN_DIR)
 
 # Allow linker to skip linking to libm if compiler inlined all math functions
--- a/open-src/app/xcolor/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xcolor/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # xcolor Makefile
 #
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -30,7 +30,7 @@
 xcolor: $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lX11 -lm
 
-install: xcolor
+install: xcolor xcolor.1
 	mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
 	$(INSTALL) -m 755 xcolor $(DESTDIR)$(bindir)/xcolor
 	$(INSTALL) -m 444 xcolor.1 $(DESTDIR)$(mandir)/man1/xcolor.1
--- a/open-src/app/xdm/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xdm/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -103,13 +103,14 @@
 XDM_USR_CONFIGDIR=/usr/lib/X11/xdm
 XCF_USR_FILES=$(XDM_CONFIG_FILES:%=$(PROTODIR)/$(XDM_USR_CONFIGDIR)/%)
 XCF_ETC_SRCDIR=$(SOURCE_DIR)/config
-XCF_ETC_SRCFILES=$(XDM_CONFIG_FILES:%=$(XCF_ETC_SRCDIR)/%)
-XCF_USR_SRCDIR=$(SOURCE_DIR)/config/annotated
-XCF_USR_SRCFILES=$(XDM_CONFIG_FILES:%=$(XCF_USR_SRCDIR)/%)
+XCF_ETC_BLDDIR=$(BUILD_DIR)/config
+XCF_ETC_BLDFILES=$(XDM_CONFIG_FILES:%=$(XCF_ETC_BLDDIR)/%)
+XCF_USR_BLDDIR=$(BUILD_DIR)/config/annotated
+XCF_USR_BLDFILES=$(XDM_CONFIG_FILES:%=$(XCF_USR_BLDDIR)/%)
 
 build_xdm_configs: $(XCF_USR_SRCFILES)
 install_xdm_configs: $(XCF_USR_FILES) $(PROTODIR)/$(XDM_USR_CONFIGDIR)/README
-$(XCF_ETC_SRCFILES): default_build
+$(XCF_ETC_BLDFILES): default_build
 
 XCF_HEADER = %1$$s----------------------------------------------------------------------------
 XCF_HEADER += \n%1$$s NOTE: The file provided in $(XDM_USR_CONFIGDIR) is a sample %2$$s
@@ -120,20 +121,25 @@
 XCF_HEADER += \n%1$$s  a file specified via the -config command line option).
 XCF_HEADER += \n%1$$s----------------------------------------------------------------------------\n
 
-$(PROTODIR)/$(XDM_USR_CONFIGDIR) $(XCF_USR_SRCDIR):
+$(PROTODIR)/$(XDM_USR_CONFIGDIR) $(XCF_USR_BLDDIR):
 	mkdir -p $@
 
-$(XCF_USR_FILES): $(PROTODIR)/$(XDM_USR_CONFIGDIR) $(XCF_USR_SRCFILES)
+$(XCF_USR_FILES): $(PROTODIR)/$(XDM_USR_CONFIGDIR) $(XCF_USR_BLDFILES)
 	-rm -f $@
 	mkdir -p $(PROTODIR)/$(XDM_USR_CONFIGDIR)
-	cp -p $(XCF_USR_SRCDIR)/$(@F) $@
+	cp -p $(XCF_USR_BLDDIR)/$(@F) $@
 
-$(XCF_USR_SRCFILES): $(XCF_USR_SRCDIR) $(XCF_ETC_SRCFILES)
+$(XCF_USR_BLDFILES): $(XCF_USR_BLDDIR) $(XCF_ETC_BLDFILES)
 	-rm -f $@
 	FILENAME=$(@F) ; \
-	COMMENT_CHAR=$$(head -n 1 $(XCF_ETC_SRCDIR)/$${FILENAME}) ; \
+	if [[ -f $(XCF_ETC_BLDDIR)/$${FILENAME} ]] ; then \
+	    ORIGFILE="$(XCF_ETC_BLDDIR)/$${FILENAME}" ; \
+	else \
+	    ORIGFILE="$(XCF_ETC_SRCDIR)/$${FILENAME}" ; \
+	fi ; \
+	COMMENT_CHAR=$$(head -n 1 $${ORIGFILE}) ; \
 	printf '$(XCF_HEADER)' $${COMMENT_CHAR} $${FILENAME} > $@ ; \
-	cat $(XCF_ETC_SRCDIR)/$${FILENAME} >> $@
+	cat $${ORIGFILE} >> $@
 
 $(PROTODIR)/$(XDM_USR_CONFIGDIR)/README:$(PROTODIR)/$(XDM_USR_CONFIGDIR)  config-README.txt
 	cp -p config-README.txt $@
--- a/open-src/app/xfontsel/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xfontsel/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # xfontsel - simple X11 font selection/display application
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 
 include ../Makefile.inc
 
-install_po: $(SOURCE_TARGETS)
+install_po: $(SOURCE_TARGETS) $(BUILD_DIR)
 	mkdir -p $(PROTODIR)$(X11_LC_MESSAGES_DIR)
-	(cd $(SOURCE_DIR) ; xgettext -n -d xfontsel *.c)
-	cp -f $(SOURCE_DIR)/xfontsel.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
+	(cd $(SOURCE_DIR) ; xgettext -n -d xfontsel -p ../$(BUILD_DIR) *.c)
+	cp -f $(BUILD_DIR)/xfontsel.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
--- a/open-src/app/xload/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xload/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # xload 1.x Makefile
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -60,5 +60,5 @@
 
 install_po: $(BUILD_TARGETS)
 	mkdir -p $(PROTODIR)$(X11_LC_MESSAGES_DIR)
-	cp -f $(SOURCE_DIR)/xload.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
+	cp -f $(BUILD_DIR)/xload.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
 
--- a/open-src/app/xlock/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xlock/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -50,11 +50,15 @@
 BUILD_TYPES_SET=yes
 BUILD_TYPES=32
 
-# No configure script, so pass usual environment to build/install instead
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
-MODULE_BUILD_ENV=$(CONFIG_ENV)
+# Since we don't have a configure script, pass configure flags to make
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 MODULE_INSTALL_MAKEFLAGS = \
    bindir=$(X11_BIN_DIR) datadir=$(MODULE_PREFIX)/share mandir=$(X11_MAN_DIR)
 
--- a/open-src/app/xlock/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xlock/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # xlock Makefile
 #
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -38,7 +38,7 @@
 
 pyro.o:=DEFINES=-DSTARSIZE=2
 
-install:
+install: xlock xlock.1 XLock.ad
 	$(INSTALL) -m 0555 xlock $(DESTDIR)$(bindir)/xlock
 	$(INSTALL) -m 0444 xlock.1 $(DESTDIR)$(mandir)/man1/xlock.1
 	$(INSTALL) -m 0444 XLock.ad $(DESTDIR)$(datadir)/X11/app-defaults/XLock
--- a/open-src/app/xlswins/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xlswins/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -53,11 +53,15 @@
 # PSARC/1992/173 - Update MIT-based Clients to X11R5 Level
 MODULE_ARC_CASES = PSARC/1992/173
 
-# No configure script, so pass usual environment to build/install instead
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
-MODULE_BUILD_ENV=$(CONFIG_ENV)
+# Since we don't have a configure script, pass configure flags to make
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 MODULE_INSTALL_MAKEFLAGS = bindir=$(X11_BIN_DIR) mandir=$(X11_MAN_DIR)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
--- a/open-src/app/xlswins/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xlswins/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,8 +1,8 @@
 ###############################################################################
 #
-# xlswins 1.x Makefile
+# xlswins Makefile
 #
-# Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -30,7 +30,7 @@
 xlswins: $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -lX11
 
-install: xlswins
+install: xlswins xlswins.1
 	mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
 	$(INSTALL) -m 755 xlswins $(DESTDIR)$(bindir)/xlswins
 	$(INSTALL) -m 644 xlswins.1 \
--- a/open-src/app/xmag_multivis/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xmag_multivis/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -48,14 +48,15 @@
 SUNTOUCHED_MANPAGES=xmag_multivis.man
 MODULE_STABILITY=Committed
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_CONFIG_ENV = PREFIX=$(MODULE_PREFIX) $(CONSTANT_TIME)
-MODULE_BUILD_MAKEFLAGS  = $(CONFIG_ENV)
-MODULE_INSTALL_MAKEFLAGS= $(CONFIG_ENV)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = xmag_multivis
--- a/open-src/app/xmag_multivis/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xmag_multivis/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -34,7 +34,7 @@
 .c.o:
 	$(CC) $(CFLAGS) $(MULTIVIS_CPPFLAGS) $(CPPFLAGS) -c $(OUTPUT_OPTION) $<
 
-install: xmag_multivis
+install: xmag_multivis xmag_multivis.man
 	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
 	$(INSTALL) -m 0555 xmag_multivis $(DESTDIR)$(PREFIX)/bin
 	$(INSTALL) -m 0444 xmag_multivis.man $(DESTDIR)$(PREFIX)/share/man/man1/xmag_multivis.1
--- a/open-src/app/xpm/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/app/xpm/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # Xpm apps Makefile
 #
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -61,8 +61,8 @@
 include ../Makefile.inc
 
 install_xpm_apps: $(BUILD_TARGETS)
-	(cd $(SOURCE_DIR)/cxpm ; $(MAKE) $(MAKEFLAGS) -e DESTDIR=$(PROTODIR) install)
-	(cd $(SOURCE_DIR)/sxpm ; $(MAKE) $(MAKEFLAGS) -e DESTDIR=$(PROTODIR) install)
+	$(DEFAULT_INSTALL_COMMAND:@DIR@=$(BUILD_DIR)/cxpm) install
+	$(DEFAULT_INSTALL_COMMAND:@DIR@=$(BUILD_DIR)/sxpm) install
 	mkdir -p $(PROTODIR)$(X11_LC_MESSAGES_DIR)
-	cp -pf $(SOURCE_DIR)/cxpm/cxpm.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
-	cp -pf $(SOURCE_DIR)/sxpm/sxpm.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
+	cp -pf $(BUILD_DIR)/cxpm/cxpm.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
+	cp -pf $(BUILD_DIR)/sxpm/sxpm.po $(PROTODIR)$(X11_LC_MESSAGES_DIR)
--- a/open-src/common/Makefile.inc	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/common/Makefile.inc	Sun Nov 23 21:46:46 2014 -0800
@@ -89,9 +89,7 @@
 BUILD_DIR_64 = build-$(MACH64)
 BUILD_DIR = $(BUILD_DIR_$(BUILD_TYPE))
 
-SOURCE_DIR = $(BUILD_DIR)/$(SOURCE_DIRNAME)
-SOURCE_DIR_32 = $(BUILD_DIR_32)/$(SOURCE_DIRNAME)
-SOURCE_DIR_64 = $(BUILD_DIR_64)/$(SOURCE_DIRNAME)
+SOURCE_DIR = unpacked-src
 
 # Set default tarball if not set in module makefile
 SOURCE_TARBALL_NAME_DEFAULT	= $(SOURCE_TARBALL_NAME_SET:yes=$(POUND_SIGN))
@@ -154,32 +152,27 @@
 CLEAN_RULES_3 = $(CLEAN_RULES_2:clean_64=)
 CLEAN_RULES =  clean_32 clean_64 $(CLEAN_RULES_3)
 clean: $(CLEAN_RULES)
-.PARALLEL: $(CLEAN_RULES)
+.PARALLEL: $(CLEAN_RULES) clobber
 
 # Remove directories with both styles of naming
 $(CLEAN_RULES):
 	-rm -rf $(BUILD_DIR_$(@:clean_%=%)) $(@:clean_%=build_%) $(@:clean_%=build-%)
 
-# Tell dmake not to remove and create source in parallel
-.NOPARALLEL: clean source
-.NOPARALLEL: clean_$(BUILD_TYPE) source_$(BUILD_TYPE)
+clobber: clean
+	-rm -rf $(SOURCE_DIR)
 
-SOURCE_RULES = $(BUILD_TYPES:%=source_%)
-source: $(SOURCE_RULES)
-.PARALLEL: $(SOURCE_RULES)
+# Tell dmake not to remove and create source in parallel
+.NOPARALLEL: clobber source
 
-source-gen: $(SOURCE_TARGETS)
-
-$(SOURCE_RULES):
-	$(MAKE) $(MAKEFLAGS) BUILD_TYPE="$(@:source_%=%)" source-gen
+# Rules for steps repeated for each build type
 
 CONFIGURE_RULES = $(BUILD_TYPES:%=configure_%)
 configure: $(CONFIGURE_RULES)
 .PARALLEL: $(CONFIGURE_RULES)
 
-configure-gen: source-gen $(CONFIGURE_TARGETS)
+configure-gen: source $(CONFIGURE_TARGETS)
 
-$(CONFIGURE_RULES):
+$(CONFIGURE_RULES): $(SOURCE_TARGETS)
 	$(MAKE) $(MAKEFLAGS) BUILD_TYPE="$(@:configure_%=%)" \
 	 $(BUILD_$(@:configure_%=%)_FLAGS) configure-gen
 
@@ -334,8 +327,7 @@
 git-import:
 	mkdir $(GIT_CLONE_DIR)
 	cd $(GIT_CLONE_DIR) && git init
-	$(MAKE) BUILD_DIR="$(GIT_CLONE_DIR)" SOURCE_DIR="$(GIT_CLONE_DIR)" \
-		ADD_TAR_FLAGS="--strip-components=1" init_source
+	$(MAKE) SOURCE_DIR="$(GIT_CLONE_DIR)" init_source
 	cd $(GIT_CLONE_DIR) && git add . && \
 		git commit -a -m 'Initialized from $(SOURCE_TARBALL_NAME)' \
 		&& git tag '$(MODULE_NAME)-$(MODULE_VERSION)'
@@ -347,8 +339,8 @@
 		(cd $(GIT_CLONE_DIR) ; $(START_CMD_ECHO) ; git am $(PWD)/$$p) ; \
 	    else \
 		rm -f $(GIT_CLONE_DIR)/$(PATCHED_TARGET_FILE) ; \
-		$(MAKE) SOURCE_PATCHES="$$f" BUILD_DIR="$(GIT_CLONE_DIR)" \
-			SOURCE_DIR="$(GIT_CLONE_DIR)" patched_source ; \
+		$(MAKE) SOURCE_PATCHES="$$f" SOURCE_DIR="$(GIT_CLONE_DIR)" \
+			patched_source ; \
 		printf '%s\n\n' "$${p%.patch}" > git.comments ; \
 	    	gawk '/^--- /		{exit} \
 		      /^diff -/		{exit} \
@@ -373,10 +365,8 @@
 init_source: $(SOURCE_INIT_TARGET)
 
 $(SOURCE_INIT_TARGET): $(SOURCE_DEPS)
-	mkdir -p $(BUILD_DIR)
-	@ if [[ "$(SOURCE_TARBALL_NAME)" == "NONE" ]] ; then \
-	  $(START_CMD_ECHO); mkdir -p $(SOURCE_DIR) ; \
-	else \
+	mkdir -p $(SOURCE_DIR)
+	@ if [[ "$(SOURCE_TARBALL_NAME)" != "NONE" ]] ; then \
 	  if [[ "$(MODULE_VERSION)" = "git" ]] ; then \
 	    SOURCE_CMD='gtar --exclude=.git* -cf - $(GIT_CLONE_DIR)' ; \
 	    SOURCE_FILE='-' ; \
@@ -385,8 +375,8 @@
 	  fi ; \
 	  $(START_CMD_ECHO) ; \
 	  $${SOURCE_CMD} | \
-	    gtar --directory="$(BUILD_DIR)" $(ADD_TAR_FLAGS) \
-		 -xf $${SOURCE_FILE} ; \
+	    gtar --directory="$(SOURCE_DIR)" --strip-components=1 \
+		$(ADD_TAR_FLAGS) -xf $${SOURCE_FILE} ; \
 	fi
 	touch $(SOURCE_INIT_TARGET)
 
@@ -402,12 +392,11 @@
 	    (cd $(TOP)/open-src/util/lndir && $(MAKE) $(MAKEFLAGS) install) ; \
 	  fi ; \
 	  $(START_CMD_ECHO) ; \
-	  cd $(SOURCE_DIR) && $(LNDIR) ../../$(ADDITIONAL_SOURCE_DIR) ; \
+	  cd $(SOURCE_DIR) && $(LNDIR) ../$(ADDITIONAL_SOURCE_DIR) ; \
 	fi
 	touch $(SOURCE_ADD_TARGET)
 
-# Step 3: Apply any local patches (may be done in parallel to add_source,
-# but must come after init_source is finished)
+# Step 3: Apply any local patches (must come after add_source is finished)
 #
 # SOURCE_PATCHES is a list in the format: filename[,flags]
 # $${p/*,} is ksh93 syntax to remove the comma and everything before it in $p
@@ -416,7 +405,16 @@
 PATCHED_TARGET=$(SOURCE_DIR)/$(PATCHED_TARGET_FILE)
 patched_source: $(PATCHED_TARGET)
 
-$(PATCHED_TARGET): $(SOURCE_INIT_TARGET)
+# Include Xorg autoconf macros when rebuilding configure scripts
+# and use specific version of automake.
+ACLOCAL_PATH=/usr/bin/aclocal-$(AUTOMAKE_VERSION)
+ACLOCAL_INCLUDES = -I $(PROTODIR)$(X11_ACLOCAL_DIR) \
+	-I /usr/share/aclocal -I /usr/share/aclocal-$(AUTOMAKE_VERSION)
+AUTOMAKE_PATH=/usr/bin/automake-$(AUTOMAKE_VERSION)
+AUTORECONF_ENV= ACLOCAL="$(ACLOCAL_PATH) $(ACLOCAL_INCLUDES)" \
+	AUTOMAKE="$(AUTOMAKE_PATH)"
+
+$(PATCHED_TARGET): $(SOURCE_ADD_TARGET)
 	@ if [[ "$(SOURCE_PATCHES)" != "" ]] ; then \
 	    for p in $(SOURCE_PATCHES) x ; do \
 	        if [[ "$$p" != "x" ]] ; then \
@@ -430,7 +428,11 @@
 		     gpatch -d $(SOURCE_DIR) $${patch_flags} < "$${patch_file}" ) ; \
 		fi ; \
 	    done ; \
-	fi
+	fi ; \
+	if [[ "$(AUTORECONF)" = "yes" || "$(MODULE_VERSION)" = "git" ]] ; then \
+	     ($(START_CMD_ECHO) ; cd $(SOURCE_DIR) && \
+	      $(AUTORECONF_ENV) autoreconf -v --install --force) ; \
+	fi ; \
 	touch $(PATCHED_TARGET)
 
 # Step 4: Apply common Solaris changes to man pages in $(SUNTOUCHED_MANPAGES)
@@ -475,24 +477,25 @@
 UNPACK_TARGETS = $(SOURCE_INIT_TARGET) $(PATCHED_TARGET) \
 	$(SOURCE_ADD_TARGET) $(FIXED_MAN_TARGET) $(FIXED_PC_TARGET)
 
-default_source: $(UNPACK_TARGET)
+source: $(SOURCE_TARGETS)
+default_source: $(SOURCE_TARGETS)
 
 $(UNPACK_TARGET): $(SOURCE_DEPS) $(UNPACK_TARGETS)
 	touch $(UNPACK_TARGET)
 
+# Make sure build directory exists, and if CLONE_SRC=yes, then
+# lndir the sources into it.
+$(BUILD_DIR): $(SOURCE_TARGETS)
+	mkdir -p $@
+	@if [[ "$(CLONE_SRC)" = "yes" ]]; then \
+		$(START_CMD_ECHO) ; \
+		cd $(BUILD_DIR) && $(LNDIR) ../$(SOURCE_DIR) ; \
+	fi
+
 ### Run configure scripts
 
-# Include Xorg autoconf macros when rebuilding configure scripts
-# and use specific version of automake.
-ACLOCAL_PATH=/usr/bin/aclocal-$(AUTOMAKE_VERSION)
-ACLOCAL_INCLUDES = -I $(PROTODIR)$(X11_ACLOCAL_DIR) \
-	-I /usr/share/aclocal -I /usr/share/aclocal-$(AUTOMAKE_VERSION)
-AUTOMAKE_PATH=/usr/bin/automake-$(AUTOMAKE_VERSION)
-AUTORECONF_ENV= ACLOCAL="$(ACLOCAL_PATH) $(ACLOCAL_INCLUDES)" \
-	AUTOMAKE="$(AUTOMAKE_PATH)"
-
 # Dependencies for running configure to make a Makefile
-CONFIGURE_DEPS = $(SOURCE_TARGETS) \
+CONFIGURE_DEPS = $(SOURCE_TARGETS) $(BUILD_DIR) \
 	$(MODTYPE_CONFIGURE_DEPS) $(MODULE_CONFIGURE_DEPS)
 
 # Command line options to GNU autoconf configure script
@@ -511,7 +514,7 @@
 	-L$(PROTODIR)/usr/lib$(ARCHLIBSUBDIR) \
 	-L$(PROTODIR)$(X11_DIR)/lib$(ARCHLIBSUBDIR)
 
-DEFAULT_PKG_CONFIG_PATH=$(TOP)/open-src/common/pc-files/$(BUILD_DIR):$(PROTODIR)$(PKGCONFIG_DIR):$(PROTODIR)$(PKGCONFIG_DIR_SHARE):$(PKGCONFIG_DIR):$(PKGCONFIG_DIR_SHARE)
+DEFAULT_PKG_CONFIG_PATH=$(PROTODIR)$(PKGCONFIG_DIR):$(PROTODIR)$(PKGCONFIG_DIR_SHARE):$(PKGCONFIG_DIR):$(PKGCONFIG_DIR_SHARE)
 
 # Most upstream software is written by developers using bash as /bin/sh, so
 # we run configure scripts with that to minimize problems and work around
@@ -543,17 +546,16 @@
 AUTOCONF_TARGET_DEFAULT = $(AUTOCONF_TARGET_SET:yes=$(POUND_SIGN))
 $(AUTOCONF_TARGET_DEFAULT)	AUTOCONF_TARGET=$(SOURCE_DIR)/Makefile
 
+CONFIG_SCRIPT = ../$(SOURCE_DIR)/configure
+
 $(AUTOCONF_TARGET): $(CONFIGURE_DEPS)
-	cd $(SOURCE_DIR) ; \
-	if [[ "$(AUTORECONF)" = "yes" || "$(MODULE_VERSION)" = "git" ]] ; then \
-	     $(AUTORECONF_ENV) autoreconf -v --install --force ; \
-	fi ; \
-	chmod a+x configure ; \
-	$(CONFIG_ENV) $(CONFIG_SHELL) ./configure $(CONFIG_OPTS) ; \
+	cd $(BUILD_DIR) ; \
+	chmod a+x $(CONFIG_SCRIPT) ; \
+	$(CONFIG_ENV) $(CONFIG_SHELL) $(CONFIG_SCRIPT) $(CONFIG_OPTS) ; \
 	if [[ "$(DELIBTOOLIZE)" = "yes" ]] ; then \
 	    $(PERL) $(TOP)/open-src/common/delibtoolize.pl $(DELIBTOOLIZE_FLAGS) . ; \
 	fi
-	-rm -f $(SOURCE_DIR)/a.out.bc
+	-rm -f $(BUILD_DIR)/a.out.bc
 
 default_configure: $(AUTOCONF_TARGET)
 
@@ -587,7 +589,7 @@
 	$(BUILD_ENV) $(MODULE_MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS)
 
 default_build: $(BUILD_DEPS)
-	$(DEFAULT_BUILD_COMMAND:@DIR@=$(SOURCE_DIR))
+	$(DEFAULT_BUILD_COMMAND:@DIR@=$(BUILD_DIR))
 
 build-in-subdir:
 	$(DEFAULT_BUILD_COMMAND:@DIR@=$(subdir)) $(subdir_cmd)
@@ -608,7 +610,7 @@
 	$(INSTALL_ENV) $(MODULE_MAKE) $(MAKEFLAGS) $(DEFAULT_INSTALL_MAKEFLAGS)
 
 default_install: $(INSTALL_DEPS)
-	$(DEFAULT_INSTALL_COMMAND:@DIR@=$(SOURCE_DIR)) install
+	$(DEFAULT_INSTALL_COMMAND:@DIR@=$(BUILD_DIR)) install
 
 install-in-subdir:
 	$(DEFAULT_INSTALL_COMMAND:@DIR@=$(subdir)) $(subdir_cmd) \
@@ -627,7 +629,7 @@
 
 install_pkgconfig_uninstalled: $(INSTALL_PCU_DEPS)
 	@ if [[ ! -z "$(FIX_PC_FILES)" ]] ; then \
-	    cd $(SOURCE_DIR) ; \
+	    cd $(BUILD_DIR) ; \
 	    for pcin in $(FIX_PC_FILES:.in=) ; do \
 		pc="$${pcin%%+(.pc|.in)}" ; \
 		pcu="$${pc##*/}-uninstalled.pc" ; \
@@ -678,7 +680,7 @@
 
 set-elf-comments: $(BUILD_TARGETS:set-elf-comments=)
 	$(PERL) $(TOP)/open-src/common/set-elf-comments.pl \
-	 $(ELF_COMMENTS_FLAGS) $(SOURCE_DIR)
+	 $(ELF_COMMENTS_FLAGS) $(BUILD_DIR)
 
 MANIFEST_DEST=$(PWD)/tmp-proto-$(MACH)
 MANIFEST_TMP=$(PWD)/tmp.p5m
@@ -757,20 +759,22 @@
 regen-patches:
 	CUR_LIST=""
 	rm -rf tmp-regen
-	$(MAKE) SOURCE_PATCHES="$(CUR_LIST)" BUILD_DIR=tmp-regen patched_source
+	$(MAKE) SOURCE_PATCHES="$(CUR_LIST)" SOURCE_DIR=tmp-regen \
+	    AUTORECONF="no" patched_source
 	mkdir -p new
 	for f in $(SOURCE_PATCHES) ; do \
 	    p=$${f%,*} ; \
 	    print '=================' $$p ; \
 	    rm -rf prev ; \
 	    mv tmp-regen prev ; \
-	    $(MAKE) SOURCE_PATCHES="$${CUR_LIST} $$f" BUILD_DIR=tmp-regen patched_source ; \
+	    $(MAKE) SOURCE_PATCHES="$${CUR_LIST} $$f" SOURCE_DIR=tmp-regen \
+		AUTORECONF="no" patched_source ; \
 	    find tmp-regen -name '*.orig' -exec rm {} \+ ; \
 	    gawk '/^--- /	{exit} \
 		  /^diff -/	{exit} \
 			 	{print}' $$p > new/$$p ; \
 	    LC_COLLATE=C git diff --no-color ./prev ./tmp-regen \
-		| sed -e 's% a/\./prev/$(SOURCE_DIRNAME)/% a/%' -e 's% b/\./tmp-regen/$(SOURCE_DIRNAME)/% b/%' \
+		| sed -e 's% a/\./prev/% a/%' -e 's% b/\./tmp-regen/% b/%' \
 		| grep -v '^Common subdirectories:' \
 		| grep -v '^Only in ' \
 		>> new/$$p ; \
--- a/open-src/common/Makefile.subdirs	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/common/Makefile.subdirs	Sun Nov 23 21:46:46 2014 -0800
@@ -1,7 +1,7 @@
 # -*- Makefile -*- rules commonly shared among X consolidation open source dirs
 # Makefile.subdirs has rules for recursively iterating through module subdirs
 #
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -36,7 +36,7 @@
 .DEFAULT:
 	$(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
 
-World: clean all
+World: clobber all
 
 clean: clean-subdirs clean-obsolete-subdirs
 
@@ -60,7 +60,7 @@
 		    	$(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
 		    else ; \
 		    	print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
-			($(START_CMD_ECHO) ; cd $$i && rm -rf build* .checksum* ) ; \
+			($(START_CMD_ECHO) ; cd $$i && rm -rf unpacked-src build* .checksum* ) ; \
 			($(START_CMD_ECHO) ; rmdir $$i ) ; \
 		    fi ; \
 		fi ; \
--- a/open-src/driver/Makefile.inc	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/driver/Makefile.inc	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules common to all X.Org drivers
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -72,13 +72,6 @@
 
 MODTYPE_CFLAGS=$(PROG_CFLAGS)
 
-ASM_IL_DIR = $(PROTODIR)$(XORG_SDK_INCLUDES_DIR)
-MODTYPE_CFLAGS_suncc_i386_32 = $(ASM_IL_DIR)/solaris-ia32.il
-MODTYPE_CFLAGS_suncc_i386_64 = $(ASM_IL_DIR)/solaris-amd64.il
-MODTYPE_CFLAGS_suncc_sparc_32 = $(ASM_IL_DIR)/solaris-sparcv8plus.il
-MODTYPE_CFLAGS_suncc_sparc_64 = $(ASM_IL_DIR)/solaris-sparcv8plus.il
-MODTYPE_CFLAGS += $(MODTYPE_CFLAGS_$(MODULE_COMPILER)_$(MACH)_$(BUILD_TYPE))
-
 # Replaces @symbol_visibilty@ in xorg-server.pc, since that fails when
 # some drivers are compiled with a different compiler than the server
 MODTYPE_CFLAGS_suncc_common = -xldscope=hidden
--- a/open-src/driver/efb/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/driver/efb/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # efb driver for Sun XVR-100 & XVR-300 boards (based on ATI Radeon)
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -92,7 +92,7 @@
         -M $(XF86_VIDEO_ATI_SRC)/mapfile-msp3430_drv-external \
         -M $(XF86_VIDEO_ATI_SRC)/mapfile-tda9885_drv-external \
         -M $(XF86_VIDEO_ATI_SRC)/mapfile-uda1380_drv-external \
-	-M drv.mapfile
+	-M ../../$(SOURCE_DIR)/src/drv.mapfile
 
 include ../Makefile.inc
 
@@ -102,6 +102,6 @@
 $(PATCHED_TARGET): $(CLEAN_LINEFEED_TARGET)
 
 $(CLEAN_LINEFEED_TARGET): $(SOURCE_INIT_TARGET)
-	find $(BUILD_DIR) -type f -name '*.[ch]' | \
+	find $(SOURCE_DIR) -type f -name '*.[ch]' | \
 		xargs $(PERL) -i -p -e 's{\r\n}{\n}g'
 	touch $(CLEAN_LINEFEED_TARGET)
--- a/open-src/driver/xf86-input-hotkey/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/driver/xf86-input-hotkey/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -33,21 +33,25 @@
 # Earliest & latest of the copyrights in the Oracle files in this pkg
 ORACLE_COPYRIGHT_YEARS = 2009, 2010
 
-# Version number (used in path names)
+# No upstream sources for these files, since they're Solaris-specific
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 MODULE_STABILITY=Volatile
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX) \
-	MODULEDIR=/lib$(X11_SERVERMODS_SUBDIR)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_MAKEFLAGS += MODULEDIR=/lib$(X11_SERVERMODS_SUBDIR)
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 include ../Makefile.inc
 
--- a/open-src/driver/xf86-video-intel/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/driver/xf86-video-intel/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # xf86-video-intel Makefile
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -54,8 +54,8 @@
 BUILD_TARGETS_32 = build_legacy_xvmc
 BUILD_TARGETS += $(BUILD_TARGETS_$(BUILD_TYPE))
 BUILD_TARGETS_SET=yes
-subdir_32 = $(SOURCE_DIR)/src/xvmc
-subdir_64 = $(SOURCE_DIR)
+subdir_32 = $(BUILD_DIR)/src/xvmc
+subdir_64 = $(BUILD_DIR)
 subdir = $(subdir_$(BUILD_TYPE))
 install_subdir_cmd = install
 INSTALL_TARGETS = install-in-subdir $(MODTYPE_ADD_INSTALL_TARGETS)
@@ -108,7 +108,7 @@
 build-in-subdir: $(BUILD_DEPS)
 install-in-subdir: $(INSTALL_DEPS)
 
-LEGACY_XVMC_SUBDIR = $(SOURCE_DIR)/src/legacy/i810/xvmc
+LEGACY_XVMC_SUBDIR = $(BUILD_DIR)/src/legacy/i810/xvmc
 
 build_legacy_xvmc: $(BUILD_DEPS)
 	$(DEFAULT_BUILD_COMMAND:@DIR@=$(LEGACY_XVMC_SUBDIR)) $(subdir_cmd)
--- a/open-src/driver/xf86-video-openchrome/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/driver/xf86-video-openchrome/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -80,6 +80,6 @@
 $(PATCHED_TARGET): $(CLEAN_LINEFEED_TARGET)
 
 $(CLEAN_LINEFEED_TARGET): $(SOURCE_INIT_TARGET)
-	find $(BUILD_DIR) -type f -name '*.[ch]' | \
+	find $(SOURCE_DIR) -type f -name '*.[ch]' | \
 		xargs $(PERL) -i -p -e 's{\r\n}{\n}g'
 	touch $(CLEAN_LINEFEED_TARGET)
--- a/open-src/font/encodings/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/font/encodings/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -43,6 +43,10 @@
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES=	
 
+# Clone sources into build dir, since mkfontdir can't build encodings in
+# other directories very well.
+CLONE_SRC = yes
+
 # Extra configure flags
 MODULE_CONFIG_OPTS=--disable-gzip-small-encodings \
 	--disable-gzip-large-encodings
--- a/open-src/lib/DPS/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/DPS/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # DPS Makefile
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -42,6 +42,10 @@
 SOURCE_TARBALL_NAME_SET=yes
 ADDITIONAL_SOURCE_DIR=sun-src
 
+# Since the Makefiles in these subdirs haven't been updated to support VPATH
+# builds, just clone the whole source tree to the build tree for now.
+CLONE_SRC = yes
+
 # Library name (used for specfiles/mapfiles)
 LIBNAME=dps
 
@@ -49,8 +53,8 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Obsolete
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to clone sources into build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
--- a/open-src/lib/DPS/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/DPS/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 # Makefile for DPS sub-modules
 #
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -42,7 +42,7 @@
 OS_SUBDIRS_i386 = $(OS_SUBDIRS_common)
 
 PWD:sh=pwd
-TOP=$(PWD)/../../../../..
+TOP=$(PWD)/../../../..
 
 ### Include common definitions
 DIRNAME="lib/DPS/build_32/"
--- a/open-src/lib/Makefile.inc	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/Makefile.inc	Sun Nov 23 21:46:46 2014 -0800
@@ -77,7 +77,9 @@
 MODTYPE_INSTALL_MAKEFLAGS = \
 	libdir=$(MODULE_PREFIX)/lib$(MODULE_ADD_LIB_SUBDIR)$(ARCHLIBSUBDIR)
 
-# Need to fix libtool interference with our linker flags
-DELIBTOOLIZE=yes
+# Need to fix libtool interference with our linker flags, unless module overrides
+DELIBTOOLIZE_1 =	$(DELIBTOOLIZE:no=$(POUND_SIGN))
+DELIBTOOLIZE_2 =	$(DELIBTOOLIZE_1:yes=$(POUND_SIGN))
+$(DELIBTOOLIZE_2)	DELIBTOOLIZE=yes
 
 include $(TOP)/open-src/common/Makefile.inc
--- a/open-src/lib/freetype/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/freetype/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -89,40 +89,28 @@
 # Additional command line options to GNU autoconf configure script
 MODULE_CONFIG_OPTS= \
 	--enable-biarch-config \
-	--libdir='$(MODULE_PREFIX)/lib$(ARCHLIBSUBDIR)' \
 	--with-zlib \
 	--with-pic
 
 # pkg-config files that need to have -R added
 FIX_PC_FILES=builds/unix/freetype2.in
+install_pkgconfig_uninstalled:= FIX_PC_FILES=freetype2.in
 
 # Need to use GNU Make to build
 MODULE_MAKE=$(GNUMAKE)
 MODULE_MAKE_SET=yes
 
-# Don't run normal configure/install rules - freetype is different
-CONFIGURE_TARGETS=$(SOURCE_DIR)/config.mk
-CONFIGURE_TARGETS_SET=yes
-INSTALL_TARGETS=install_freetype install_freetype_docs
-INSTALL_TARGETS_SET=yes
+# Environment variables to pass to configure & build steps
+MODULE_CONFIG_ENV = GNUMAKE=$(GNUMAKE)
+MODULE_BUILD_ENV = $(MODULE_CONFIG_ENV)
 
-# Environment variables to pass to configure & build steps
-MODULE_ENV = \
-    SHELL="/bin/bash" \
-    MAKESHELL="/bin/bash" \
-    CPP="$(CC) -E $(LIB_CFLAGS)" \
-    CXXCPP="$(CXX) -E $(CXXFLAGS)" \
-    MAKEFLAGS= \
-    MAKE=$(GNUMAKE) GNUMAKE=$(GNUMAKE) CFG="$(CONFIG_OPTS)"
+MODULE_ADD_INSTALL_TARGETS = install_freetype_docs install_freetype_links
 
 # Don't use -I paths to proto area, since freetype doesn't depend on
 # anything there, but can break if it finds old freetype headers during
 # an incremental rebuild.
 USE_DEFAULT_CONFIG_CPPFLAGS=no
 
-MODULE_CONFIG_ENV = $(MODULE_ENV)
-MODULE_BUILD_ENV = $(CONFIG_ENV)
-
 MODULE_INSTALL_MAKEFLAGS=bindir=$(MODULE_PREFIX)/bin$(ARCHLIBSUBDIR)
 
 # Don't touch apinames when running set-elf-comments or it will trigger
@@ -134,35 +122,23 @@
 
 ### Rules specific to this directory:
 
-# Run configure script (Freetype helpfully does this the first time you call
-# gmake - this isn't normal for autoconf programs)
-$(SOURCE_DIR)/config.mk: $(UNPACK_TARGET)
-	(cd $(SOURCE_DIR) ; \
-	chmod a+x builds/unix/configure builds/unix/mkinstalldirs builds/unix/install-sh ; \
-	$(CONFIG_ENV) $(GNUMAKE) )
+FT_libdir=$(MODULE_PREFIX)/lib$(ARCHLIBSUBDIR)
+
+install_freetype_links: $(PROTODIR)$(FT_libdir)/libfreetype.so
 
-FT_bindir=$(MODULE_PREFIX)/bin$(ARCHLIBSUBDIR)
-FT_libdir=$(MODULE_PREFIX)/lib$(ARCHLIBSUBDIR)
-FT_docdir=$(MODULE_PREFIX)/share/doc/$(MODULE_NAME)
+$(PROTODIR)$(FT_libdir)/libfreetype.so: default_install
+	mkdir -p $(@D)
+	-rm -f $@
+	ln -s libfreetype.so.6 $@
 
-# Have to override default_install since the -e causes our BUILD_DIR to
-# clash with the one in freetype's Makefiles
-install_freetype: $(BUILD_TARGETS)
-	mkdir -p $(PROTODIR)$(FT_bindir)
-	( cd $(SOURCE_DIR) ; \
-	  $(GNUMAKE) DESTDIR=$(PROTODIR) prefix=$(MODULE_PREFIX) libdir=$(FT_libdir) bindir=$(FT_bindir) install )
-	( cd $(PROTODIR)$(FT_libdir) ; \
-	  rm -f libfreetype.so ; ln -s libfreetype.so.6 libfreetype.so )
-
+install_freetype_docs: $(PROTODIR)$(MODULE_DOC_DIR)/index.html
 
-install_freetype_docs: $(PROTODIR)$(FT_docdir)/index.html
-
-$(PROTODIR)$(FT_docdir)/index.html: $(BUILD_TARGETS)
-	-rm -rf $(PROTODIR)$(FT_docdir)
-	mkdir -p $(PROTODIR)$(FT_docdir)
-	( cd $(SOURCE_DIR) ; \
-	    cp -fp docs/reference/*.html $(PROTODIR)$(FT_docdir)/ )
-	cp -fp $(SOURCE_DIR)/docs/formats.txt $(PROTODIR)$(FT_docdir)/
-	cp -fp $(SOURCE_DIR)/docs/VERSION.DLL $(PROTODIR)$(FT_docdir)/
-	ln -sf ft2-toc.html $(PROTODIR)$(FT_docdir)/index.html
-
+$(PROTODIR)$(MODULE_DOC_DIR)/index.html: $(BUILD_TARGETS)
+	-rm -rf $(PROTODIR)$(MODULE_DOC_DIR)
+	mkdir -p $(PROTODIR)$(MODULE_DOC_DIR)
+	$(INSTALL_SCRIPT) -m 0444 \
+		$(SOURCE_DIR)/docs/reference/*.html \
+		$(SOURCE_DIR)/docs/formats.txt \
+		$(SOURCE_DIR)/docs/VERSION.DLL \
+		$(PROTODIR)$(MODULE_DOC_DIR)/
+	ln -sf ft2-toc.html $(PROTODIR)$(MODULE_DOC_DIR)/index.html
--- a/open-src/lib/freetype/unix-cc.in.9.patch	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/freetype/unix-cc.in.9.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -20,7 +20,8 @@
 # DEALINGS IN THE SOFTWARE.
 
 Call compiler directly to build & link, avoiding libtool, so we can pass
-the compiler & linker flags we want.
+the compiler & linker flags we want, since delibtoolize.pl doesn't work
+with freetype's unique Makefile/*.mk structure.
 
 diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
 index b84bc5d..d6c19bc 100644
@@ -68,6 +69,6 @@
 -                          # -export-symbols $(EXPORTS_LIST)
 +LINK_LIBRARY = $(CCraw) -G @CFLAGS@ -o $@ $(OBJECTS_LIST) \
 +                          -R $(libdir) -h $(@F) -mc \
-+                          $(LDFLAGS)
++                          $(LDFLAGS) -z defs
  
  # EOF
--- a/open-src/lib/libFS/solaris-abi.patch	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libFS/solaris-abi.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -32,7 +32,7 @@
  libFS_la_LIBADD = $(FS_LIBS)
  
 -libFS_la_LDFLAGS = -export-symbols-regex '^FS.*' -version-number 6:0:0 -no-undefined
-+libFS_la_LDFLAGS = -M $(top_srcdir)/../../mapfile-vers -version-number 5 -no-undefined
++libFS_la_LDFLAGS = -M $(top_srcdir)/../mapfile-vers -version-number 5 -no-undefined
  
  libFSincludedir = $(includedir)/X11/fonts
  libFSinclude_HEADERS = \
--- a/open-src/lib/libX11/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libX11/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -37,6 +37,7 @@
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES = \
 	man-tbl-markup.patch,-p1 \
+	lintlib.patch,-p1 \
 	1234757.patch,-p1 \
 	4010755.patch,-p1 \
 	4614834.patch,-p1 \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libX11/lintlib.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -0,0 +1,26 @@
+From d9f569572bd14db31921471e7b877523b5cf1e4c Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 26 Jul 2014 12:17:47 -0700
+Subject: [PATCH:libX11] Fix source paths for out-of-tree lintlib builds
+
+Signed-off-by: Alan Coopersmith <[email protected]>
+---
+ src/Makefile.am |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index d46b493..ceb8366 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -398,7 +398,7 @@ lintlibdir = $(libdir)
+ 
+ lintlib_DATA = $(LINTLIB)
+ 
+-lintlib_src = $(libX11_la_SOURCES) xcms/*.c xkb/*.c
++lintlib_src = $(libX11_la_SOURCES) $(srcdir)/xcms/*.c $(srcdir)/xkb/*.c
+ 
+ CLEANFILES += $(lintlib_DATA)
+ 
+-- 
+1.7.9.2
+
--- a/open-src/lib/libX11/solaris-abi.patch	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libX11/solaris-abi.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -44,8 +44,8 @@
 -libX11_la_LDFLAGS = -version-number 6:3:0 -no-undefined
 +libX11_la_LDFLAGS = -version-number 4 -no-undefined \
 +	$(ADD_libX11_LDFLAGS) \
-+	-M $(top_srcdir)/../../mapfile-vers \
-+	-M $(top_srcdir)/../../mapfile-order \
++	-M $(top_srcdir)/../mapfile-vers \
++	-M $(top_srcdir)/../mapfile-order \
 +	-N libXext.so.0
  
  libX11_la_LIBADD = \
--- a/open-src/lib/libXaw4/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXaw4/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # Xaw4 Makefile
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -44,7 +44,8 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
 # Library name (used for specfiles/mapfiles)
 LIBNAME=Xaw4
@@ -57,15 +58,16 @@
 # PSARC/1992/173 - Update MIT-based Clients to X11R5 Level
 MODULE_ARC_CASES = PSARC/1992/173
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-
-MODULE_CFLAGS += -I.
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_CPPFLAGS += -I $(REL_SOURCE_DIR)
 MODULE_CPPFLAGS += -DSYSV
 
 # Link with version mapfile
--- a/open-src/lib/libXaw5/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXaw5/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # Xaw5 Makefile
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -38,7 +38,8 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
 # Library name (used for specfiles/mapfiles)
 LIBNAME=Xaw5
@@ -51,15 +52,16 @@
 # PSARC/1992/173 - Update MIT-based Clients to X11R5 Level
 MODULE_ARC_CASES = PSARC/1992/173
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-
-MODULE_CFLAGS += -I. -DHAS_ISW_FUNCS -DHAS_WCTYPE_H -DOLDXAW
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_CPPFLAGS   = -I $(REL_SOURCE_DIR) -DHAS_ISW_FUNCS -DHAS_WCTYPE_H -DOLDXAW
 
 # Link with version mapfile
 MODULE_LDFLAGS = -R/usr/lib$(ARCHLIBSUBDIR) -M $(PWD)/mapfile-vers
--- a/open-src/lib/libXmu/solaris-abi.patch	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXmu/solaris-abi.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -30,8 +30,8 @@
  
 -libXmu_la_LDFLAGS = -version-number 6:2:0 -no-undefined
 -libXmuu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
-+libXmu_la_LDFLAGS = -version-number 4:0:0 -no-undefined -M ../../../mapfile-Xmu
-+libXmuu_la_LDFLAGS = -version-number 1:0:0 -no-undefined -M ../../../mapfile-Xmuu
++libXmu_la_LDFLAGS = -version-number 4:0:0 -no-undefined -M ../../mapfile-Xmu
++libXmuu_la_LDFLAGS = -version-number 1:0:0 -no-undefined -M ../../mapfile-Xmuu
  
 -libXmu_la_LIBADD = $(XMU_LIBS)
 -libXmuu_la_LIBADD = $(XMUU_LIBS)
--- a/open-src/lib/libXt/6671721.patch	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXt/6671721.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -697,7 +697,7 @@
  
 -libXt_la_LDFLAGS = -version-number 6:0:0 -no-undefined
 +libXt_la_LDFLAGS = -version-number 4:0:0 -no-undefined \
-+	-M $(top_srcdir)/../../mapfile-vers -lc
++	-M $(top_srcdir)/../mapfile-vers -lc
  
  #
  # The util directory contains a program that builds some of the sources.
--- a/open-src/lib/libXtsol/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXtsol/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # libXtsol - client library for TSOL extension for Solaris Trusted Extensions 
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -63,13 +63,15 @@
 # LSARC/2004/109 - Trusted Solaris X Server Extension
 MODULE_ARC_CASES = LSARC/2004/109
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
-MODULE_INSTALL_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+# and pass path to $(SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../$(SOURCE_DIR)
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
 
 # Compatibility links from /usr/X11/lib to /usr/lib
 MODULE_X11_LIBCOMPAT_LINKS = libXtsol.so libXtsol.so.1
@@ -81,4 +83,4 @@
 $(SOURCE_DIR)/auditwrite.c + $(SOURCE_DIR)/auditwrite.h:
 	mkdir -p $(SOURCE_DIR)
 	(cd $(SOURCE_DIR) ; \
-	 ln -s ../../../../xserver/xorg/sun-src/tsol/auditwrite.[ch] . )
+	 ln -s ../../../xserver/xorg/sun-src/tsol/auditwrite.[ch] . )
--- a/open-src/lib/libXtsol/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXtsol/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -37,7 +37,7 @@
 .c.o:
 	$(CC) -Kpic $(XLIB_CFLAGS) $(CFLAGS) $(CPPFLAGS) -c $<
 
-install: libXtsol.so.1
+install: libXtsol.so.1 $(HEADERSPublic)
 	mkdir -p $(DESTDIR)$(HEADERSPublic_dir)
 	$(INSTALL) -m 0444 $(HEADERSPublic) $(DESTDIR)$(HEADERSPublic_dir)
 	mkdir -p $(DESTDIR)$(libdir)
--- a/open-src/lib/libXv/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libXv/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # libXv - Xlib-based client library for XVideo extension protocol
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -37,7 +37,10 @@
 TARBALL_SHA256= 55fe92f8686ce8612e2c1bfaf58c057715534419da700bda8d517b1d97914525
 
 # Patches to apply to source after unpacking, in order
-SOURCE_PATCHES =
+SOURCE_PATCHES = lintlib.patch,-p1
+
+# Regenerate Makefile.in's from Makefile.am's after applying lintlib.patch
+AUTORECONF=yes
 
 # Library name
 LIBNAME=Xv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libXv/lintlib.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -0,0 +1,26 @@
+From d3a0dc85b67cacec893aeab5f5706e1eb3f1ce16 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Sat, 26 Jul 2014 14:07:26 -0700
+Subject: [PATCH:libXv] Fix typo in dependencies for lint library
+
+Signed-off-by: Alan Coopersmith <[email protected]>
+---
+ src/Makefile.am |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 0948474..06e9ffd 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -23,7 +23,7 @@ lintlibdir = $(libdir)
+ 
+ lintlib_DATA = $(LINTLIB)
+ 
+-$(LINTLIB): $(libXau_la_SOURCES)
++$(LINTLIB): $(libXv_la_SOURCES)
+ 	$(LINT) -y -oXv -x $(ALL_LINT_FLAGS) $(libXv_la_SOURCES)
+ 
+ CLEANFILES = $(LINTLIB)
+-- 
+1.7.9.2
+
--- a/open-src/lib/libdga/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libdga/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # libdga Makefile (for Xsun SUN_DGA extension)
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -39,7 +39,8 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
 # We build 64-bit only on sparc since Xsun/DGA was already obsolete
 # before amd64 was added
@@ -55,14 +56,16 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Obsolete
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX) \
-	X11_INCLUDES_DIR=$(X11_INCLUDES_DIR)
-MODULE_INSTALL_MAKEFLAGS=$(MODULE_BUILD_MAKEFLAGS)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_BUILD_ENV += X11_INCLUDES_DIR=$(X11_INCLUDES_DIR)
 
 # Compatibility links from /usr/X11/lib to /usr/lib
 MODULE_X11_LIBCOMPAT_LINKS = libdga.so.1
--- a/open-src/lib/libdrm/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libdrm/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -121,6 +121,6 @@
 MANDIR = $(PROTODIR)$(X11_MAN_DIR)
 install_fixed_manpages: default_install
 	$(PERL) $(TOP)/open-src/common/suntouch-manpages.pl \
-		$(SUNTOUCH_MAN_FLAGS) $(SOURCE_DIR)/man/*.{3,7}
-	ginstall -m 0444 $(SOURCE_DIR)/man/*.3 $(MANDIR)/man3
-	ginstall -m 0444 $(SOURCE_DIR)/man/*.7 $(MANDIR)/man7
+		$(SUNTOUCH_MAN_FLAGS) $(BUILD_DIR)/man/*.{3,7}
+	ginstall -m 0444 $(BUILD_DIR)/man/*.3 $(MANDIR)/man3
+	ginstall -m 0444 $(BUILD_DIR)/man/*.7 $(MANDIR)/man7
--- a/open-src/lib/libglu/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libglu/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -48,24 +48,21 @@
 TARBALL_MD5  = be9249132ff49275461cf92039083030
 TARBALL_SHA1 = c2814bbaf1e60e28a75ec80f4646047c0da742bd
 
-# Source tarball
-SOURCE_TARBALL_NAME=glu-$(MODULE_VERSION).tar.bz2
-SOURCE_TARBALL_NAME_SET=yes
-
 # Download site for source
 SOURCE_URL=ftp://ftp.freedesktop.org/pub/mesa/glu/$(SOURCE_TARBALL_NAME)
 SOURCE_URL_SET=yes
 GIT_URL=$(FDO_GIT_URL)/mesa/glu
 GIT_URL_SET=yes
 
-# Directory created by unpacking source
-SOURCE_DIRNAME=glu-$(MODULE_VERSION)
-SOURCE_DIRNAME_SET=yes
-SOURCE_DIR = $(BUILD_DIR)/$(SOURCE_DIRNAME)
-
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES=glu-exports.patch
 
+# Regenerate Makefile.in's from Makefile.am's after applying glu-exports.patch
+AUTORECONF=yes
+
+# delibtoolize does not get along with glu-exports.patch
+DELIBTOOLIZE = no
+
 # Build mesa with this define (CR 7032292)
 MODULE_CFLAGS = -D__EXTENSIONS__
 
--- a/open-src/lib/libowconfig/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libowconfig/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # libowconfig - library for reading & writing Xsun OWconfig files
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -42,7 +42,8 @@
 MODULE_VERSION=src
 SOURCE_TARBALL_NAME=NONE
 SOURCE_TARBALL_NAME_SET=yes
-ADDITIONAL_SOURCE_DIR=sun-src
+SOURCE_TARGETS =
+SOURCE_TARGETS_SET=yes
 
 # Library name (used for specfiles/mapfiles)
 LIBNAME=owconfig
@@ -51,14 +52,16 @@
 SUNTOUCHED_MANPAGES= # None
 MODULE_STABILITY=Obsolete
 
-# No configure script to run
-CONFIGURE_TARGETS=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS = $(BUILD_DIR)
 CONFIGURE_TARGETS_SET=yes
 
 # Since we don't have a configure script, pass configure flags to make
-MODULE_BUILD_MAKEFLAGS=$(CONFIG_ENV) PREFIX=$(MODULE_PREFIX) \
-	X11_INCLUDES_DIR=$(X11_INCLUDES_DIR)
-MODULE_INSTALL_MAKEFLAGS=$(MODULE_BUILD_MAKEFLAGS)
+# and pass path to $(REL_SOURCE_DIR) for makefiles & source files
+REL_SOURCE_DIR = ../sun-src
+MODULE_MAKEFLAGS  = VPATH=$(REL_SOURCE_DIR) -f $(REL_SOURCE_DIR)/Makefile
+MODULE_BUILD_ENV  = $(CONFIG_ENV) PREFIX=$(MODULE_PREFIX)
+MODULE_BUILD_ENV += X11_INCLUDES_DIR=$(X11_INCLUDES_DIR)
 
 # Compatibility links from /usr/X11/lib to /usr/lib
 MODULE_X11_LIBCOMPAT_LINKS = libowconfig.so libowconfig.so.0
--- a/open-src/lib/libowconfig/sun-src/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libowconfig/sun-src/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -2,7 +2,7 @@
 #
 # libowconfig Makefile
 #
-# Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -55,7 +55,7 @@
 
 INCDIR = $(X11_INCLUDES_DIR)/X11
 
-install: libowconfig.so.0
+install: libowconfig.so.0 Sunowconfig.h
 	mkdir -p $(DESTDIR)$(libdir) $(DESTDIR)$(INCDIR)
 	$(INSTALL) libowconfig.so.0 $(DESTDIR)$(libdir)/libowconfig.so.0
 	@rm -f $(DESTDIR)$(libdir)/libowconfig.so
--- a/open-src/lib/libpciaccess/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libpciaccess/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -95,9 +95,9 @@
 	mkdir -p $(PROTODIR)$(MODULE_PREFIX)/bin \
 		 $(PROTODIR)/etc/security/exec_attr.d/ \
 		 $(PROTODIR)$(MODULE_PREFIX)/share/man/man1
-	$(INSTALL_SCRIPT) -m 755 $(SOURCE_DIR)/scanpci/scanpci \
+	$(INSTALL_SCRIPT) -m 755 $(BUILD_DIR)/scanpci/scanpci \
 		$(PROTODIR)$(MODULE_PREFIX)/bin/scanpci
-	$(INSTALL_SCRIPT) -m 444 $(SOURCE_DIR)/man/scanpci.1 \
+	$(INSTALL_SCRIPT) -m 444 $(BUILD_DIR)/man/scanpci.1 \
 		$(PROTODIR)$(MODULE_PREFIX)/share/man/man1/scanpci.1
 	$(INSTALL_SCRIPT) -m 444 exec_attr \
 		$(PROTODIR)/etc/security/exec_attr.d/scanpci
--- a/open-src/lib/libxcb/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/libxcb/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -110,10 +110,10 @@
 # Need to apply suntouch changes to man pages generated during build
 install_solaris_exts: $(INSTALL_DEPS)
 	$(PERL) $(TOP)/open-src/common/suntouch-manpages.pl \
-		$(SUNTOUCH_MAN_FLAGS) $(SOURCE_DIR)/src/man/*.3xcb
+		$(SUNTOUCH_MAN_FLAGS) $(BUILD_DIR)/src/man/*.3xcb
 	mkdir -p $(MANDIR)
 	ginstall -m 0444 $(SOURCE_DIR)/src/man/xcb-examples.3 \
 		$(MANDIR)/xcb-examples.3xcb
 	ginstall -m 0444 $(SOURCE_DIR)/src/man/xcb-requests.3 \
 		$(MANDIR)/xcb-requests.3xcb
-	ginstall -m 0444 $(SOURCE_DIR)/src/man/*.3xcb $(MANDIR)/
+	ginstall -m 0444 $(BUILD_DIR)/src/man/*.3xcb $(MANDIR)/
--- a/open-src/lib/mesa/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/lib/mesa/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -63,7 +63,6 @@
 # Directory created by unpacking source
 SOURCE_DIRNAME=Mesa-$(MODULE_VERSION)
 SOURCE_DIRNAME_SET=yes
-SOURCE_DIR = $(BUILD_DIR)/$(SOURCE_DIRNAME)
 
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES= \
@@ -78,6 +77,12 @@
 MODULE_ADD_CONFIGURE_TARGETS=set_pc_dir
 MODULE_INSTALL_DEPS=set_pc_dir
 
+# Regenerate configure after patching configure.ac in mesa9-port.patch
+AUTORECONF=yes
+
+# delibtoolize does not get along with Mesa 9.0.3
+DELIBTOOLIZE = no
+
 DRI_DRIVER_LIST_sparc=
 DRI_DRIVER_LIST_i386=i915 i965 radeon r200
 DRI_DRIVER_LIST= $(DRI_DRIVER_LIST_$(MACH)) swrast
--- a/open-src/util/build-tools/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/util/build-tools/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,9 @@
 MODULE_VERSION 		= src
 SOURCE_TARBALL_NAME	= NONE
 SOURCE_TARBALL_NAME_SET	= yes
-ACTUAL_SOURCE_DIR	= ../../sun-src
+SOURCE_TARGETS 		=
+SOURCE_TARGETS_SET	= yes
+ACTUAL_SOURCE_DIR	= ../sun-src
 
 # Package metadata
 MODULE_DESC = custom tools used for building Solaris X11 consolidation
@@ -37,8 +39,8 @@
 # Earliest & latest of the copyrights in the Oracle files in this pkg
 ORACLE_COPYRIGHT_YEARS = 2008, 2012
 
-# No configure script to run
-CONFIGURE_TARGETS	=
+# No configure script to run, but need to make build dirs
+CONFIGURE_TARGETS	= $(BUILD_DIR)
 CONFIGURE_TARGETS_SET	= yes
 
 # Build both 32-bit & 64-bit versions
@@ -48,7 +50,7 @@
 # Since we don't have a configure script, pass configure flags to make
 MODULE_CONFIG_ENV	= MACH="$(MACH$(BUILD_TYPE))" DESTDIR="$(TOOLS_DIR)"
 MODULE_CONFIG_ENV      += srcdir="$(ACTUAL_SOURCE_DIR)"
-MODULE_BUILD_MAKEFLAGS	= $(CONFIG_ENV) -f "$(ACTUAL_SOURCE_DIR)/Makefile"
-MODULE_INSTALL_MAKEFLAGS= $(MODULE_BUILD_MAKEFLAGS)
+MODULE_MAKEFLAGS	= $(CONFIG_ENV) -f "$(ACTUAL_SOURCE_DIR)/Makefile"
+MODULE_MAKEFLAGS       += VPATH="$(ACTUAL_SOURCE_DIR)"
 
 include ../Makefile.inc
--- a/open-src/xserver/xorg/IA.patch	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/xserver/xorg/IA.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -76,7 +76,7 @@
 +
 +# Sun IA extension module additions
 +extsmodule_LTLIBRARIES += libia.la
-+libia_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/IA
++libia_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/IA
 +libia_la_LDFLAGS = -avoid-version
 +libia_la_LIBADD = $(top_builddir)/IA/libIA.la
 +libia_la_SOURCES = iamodule.c
--- a/open-src/xserver/xorg/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/xserver/xorg/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -45,7 +45,8 @@
 
 # Used in rules shared between Xorg & Xvnc builds in Makefile.inc
 # to allow for different source layouts
-XORG_BUILD_DIR=$(SOURCE_DIR)
+XORG_SOURCE_DIR=$(SOURCE_DIR)
+XORG_BUILD_DIR=$(BUILD_DIR)
 
 # ARC cases that covered this module
 # PSARC/2004/187 Xorg Server for Solaris
@@ -119,7 +120,7 @@
 SUNTOUCH_MAN_FLAGS_dmxtodmx = $(SUNTOUCH_MAN_FLAGS_Xdmx)
 
 # Binary built in tree
-XORGSERVER_BIN=$(SOURCE_DIR)/hw/xfree86/Xorg
+XORGSERVER_BIN=$(BUILD_DIR)/hw/xfree86/Xorg
 
 BUILD_TARGETS=$(XORGSERVER_BIN) build_mdb set-elf-comments \
 	$(BUILD_DIR)/mapfile-Xorg-externs
@@ -208,7 +209,7 @@
 
 actually_clear_build_date: $(AUTOCONF_TARGET)
 	printf '#undef BUILD_DATE\n#undef BUILD_TIME\n' > \
-		$(SOURCE_DIR)/hw/xfree86/common/xf86Build.h
+		$(BUILD_DIR)/hw/xfree86/common/xf86Build.h
 
 $(XORGSERVER_BIN): default_build
 
@@ -217,7 +218,7 @@
 install_extras: default_install
 	-rm -f $(SDK_INCLUDES_DIR)/xorg-server.h
 	sed -e 's%#define XF86DRI 1%/* #define XF86DRI 1 */%' \
-	    $(SOURCE_DIR)/include/xorg-server.h > $(SDK_INCLUDES_DIR)/xorg-server.h
+	    $(BUILD_DIR)/include/xorg-server.h > $(SDK_INCLUDES_DIR)/xorg-server.h
 	cp -pf $(SOURCE_DIR)/mi/mioverlay.h \
 	       $(SOURCE_DIR)/hw/xfree86/os-support/bus/xf86Sbus.h \
 	       $(SOURCE_DIR)/hw/xfree86/dri/*.h $(SDK_INCLUDES_DIR)/
@@ -238,7 +239,7 @@
 install_pc_common: default_install install_pkgconfig_uninstalled 
 	-rm -f $(PROTODIR)$(PKGCONFIG_DIR)/xorg-server.pc
 	mkdir -p $(PROTODIR)$(PKGCONFIG_DIR)
-	cp -pf $(SOURCE_DIR)/xorg-server.pc \
+	cp -pf $(BUILD_DIR)/xorg-server.pc \
 		$(PROTODIR)$(PKGCONFIG_DIR)/xorg-server.pc
 	-rm -f $(PROTODIR)$(PKGCONFIG_DIR_32)/xorg-server.pc \
 		$(PROTODIR)$(PKGCONFIG_DIR_32)/xorg-server-uninstalled.pc
@@ -336,7 +337,9 @@
 ## mdb module rules
 # Build & install mdb modules & scripts that aren't integrated to
 # normal build process.
-MDB_SOURCE_DIR=$(XORG_BUILD_DIR)/os/solaris/mdb
+MDB_SOURCE_DIR = $(XORG_SOURCE_DIR)/os/solaris/mdb
+MDB_BUILD_DIR  =  $(XORG_BUILD_DIR)/os/solaris/mdb
+MDB_REL_SOURCE_DIR = ../../../../$(MDB_SOURCE_DIR)
 MDB_MODULE_DIR=/usr/lib/mdb/proc/$(ARCHLIBSUBDIR)
 MDB_SCRIPT_DIR=/usr/demo/Xserver/mdb
 MDB_SCRIPTS=list_Xserver_clients \
@@ -344,8 +347,8 @@
 	list_Xserver_servergrab_client
 MDB_MODULE_NAMES=Xephyr Xorg Xvfb Xvnc Xdmx
 
-BUILT_MDB_MODULE=$(MDB_SOURCE_DIR)/modules/Xserver.so
-BUILT_MDB_SCRIPTS=$(MDB_SCRIPTS:%=$(MDB_SOURCE_DIR)/scripts/%)
+BUILT_MDB_MODULE=$(MDB_BUILD_DIR)/modules/Xserver.so
+BUILT_MDB_SCRIPTS=$(MDB_SCRIPTS:%=$(MDB_BUILD_DIR)/scripts/%)
 
 INSTALLED_MDB_LINKS=$(MDB_MODULE_NAMES:%=$(PROTODIR)$(MDB_MODULE_DIR)/%.so)
 INSTALLED_MDB_MODULE=$(PROTODIR)$(MDB_MODULE_DIR)/Xserver.so
@@ -358,13 +361,19 @@
 MDB_BUILD_ENV=$(CONFIG_ENV) $(BUILD_ENV)
 MDB_BUILD_ENV += CFLAGS="$(LIB_CFLAGS)" LDFLAGS="$(LIB_LDFLAGS)"
 MDB_BUILD_ENV += ARCHLIBSUBDIR="$(ARCHLIBSUBDIR)"
+MDB_BUILD_ENV += top_builddir="$(PWD)/$(BUILD_DIR)"
+MDB_BUILD_ENV += top_srcdir="$(PWD)/$(SOURCE_DIR)"
 
 build_mdb: $(BUILT_MDB_MODULE)
 
 $(BUILT_MDB_SCRIPTS): $(SOURCE_TARGETS)
 
-$(BUILT_MDB_MODULE): $(CONFIGURE_TARGETS)
-	(cd $(MDB_SOURCE_DIR) ; \
+$(MDB_BUILD_DIR): $(SOURCE_TARGETS) $(BUILD_DIR) $(LNDIR)
+	mkdir -p $(MDB_BUILD_DIR)
+	cd $(MDB_BUILD_DIR) && $(LNDIR) $(MDB_REL_SOURCE_DIR)
+
+$(BUILT_MDB_MODULE): $(CONFIGURE_TARGETS) $(MDB_BUILD_DIR)
+	(cd $(MDB_BUILD_DIR) && \
          $(MDB_BUILD_ENV) $(MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS))
 
 $(PROTODIR)$(MDB_MODULE_DIR) $(PROTODIR)$(MDB_SCRIPT_DIR):
--- a/open-src/xserver/xorg/patch-list	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/xserver/xorg/patch-list	Sun Nov 23 21:46:46 2014 -0800
@@ -1,3 +1,4 @@
+stop-using-il.patch,-p1
 osaudit.patch,-p1
 sun-paths.patch,-p1
 sun-extramodes.patch,-p1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/stop-using-il.patch	Sun Nov 23 21:46:46 2014 -0800
@@ -0,0 +1,101 @@
+[Backported to xorg-server-1.14.5 from 1.15.0]
+
+From 0ba7fc8472f1227fd1cd51bd58048f164b8ea1ab Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Tue, 12 Nov 2013 14:46:04 -0800
+Subject: [PATCH] Stop including inline assembly .il file for Solaris Studio
+ builds
+
+Since all the inb/outb/etc. use in the X server itself (except for
+xf86SlowBcopy) has been replaced by calls to libpciaccess, we no
+longer need to pass inline assembly files to replace the gcc inline
+assembly from hw/xfree86/common/compiler.h when building Xorg itself.
+
+The .il files are still generated and installed in the SDK for the
+benefit of drivers who may use them.
+
+Binary diff of before and after showed that xf86SlowBcopy was the
+only function changed across the Xorg binary and all modules built
+in the Xserver build, it just calls the outb() function now instead
+of having the outb instructions inlined, making it a slightly slower
+bcopy.
+
+Signed-off-by: Alan Coopersmith <[email protected]>
+Reviewed-by: Keith Packard <[email protected]>
+Signed-off-by: Keith Packard <[email protected]>
+---
+ configure.ac           |    9 ---------
+ exa/Makefile.am        |    4 ----
+ hw/xfree86/Makefile.am |   11 -----------
+ 3 files changed, 24 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b06fb14..419fb85 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1740,9 +1740,6 @@ if test "x$XORG" = xyes; then
+ 		if test "${OS_MINOR}" -lt 8 ; then
+ 			AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
+ 		fi
+-		if test "x$SUNCC" = "xyes"; then
+-			solaris_asm_inline="yes"
+-		fi
+ 		AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
+ 			
+ 		case $host_cpu in
+@@ -1763,11 +1760,6 @@ if test "x$XORG" = xyes; then
+ 			[email protected].]) ;;
+ 		esac
+ 		AC_SUBST([SOLARIS_INOUT_ARCH])
+-		if test x$solaris_asm_inline = xyes ; then
+-			SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
+-			XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
+-		fi
+-		AC_SUBST([SOLARIS_ASM_CFLAGS])
+ 		;;
+ 	  gnu*)
+ 		XORG_OS_SUBDIR="hurd"
+@@ -1872,7 +1864,6 @@ AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
+ AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
+ AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
+ AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
+-AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
+ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
+ AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
+ AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
+diff --git a/exa/Makefile.am b/exa/Makefile.am
+index 8b759cd..81affe2 100644
+--- a/exa/Makefile.am
++++ b/exa/Makefile.am
+@@ -1,9 +1,5 @@
+ noinst_LTLIBRARIES = libexa.la
+ 
+-# Override these since EXA doesn't need them and the needed files aren't
+-# built (in hw/xfree86/os-support/solaris) until after EXA is built
+-SOLARIS_ASM_CFLAGS=""
+-
+ if XORG
+ sdk_HEADERS = exa.h
+ endif
+diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
+index c3899b5..0fdb1f3 100644
+--- a/hw/xfree86/Makefile.am
++++ b/hw/xfree86/Makefile.am
+@@ -73,17 +73,6 @@ BUILT_SOURCES = xorg.conf.example
+ DISTCLEANFILES = xorg.conf.example
+ EXTRA_DIST = xorgconf.cpp
+ 
+-if SOLARIS_ASM_INLINE
+-# Needs to be built before any files are compiled when using Sun compilers
+-# so in*/out* inline definitions are properly processed.
+-
+-BUILT_SOURCES += os-support/solaris/solaris-@[email protected]
+-
+-os-support/solaris/solaris-@[email protected]:
+-	cd os-support/solaris ; \
+-	 $(MAKE) $(AM_MAKEFLAGS) solaris-@[email protected]
+-endif
+-
+ # do not use $(mkdir_p) if you want automake 1.7 to work
+ install-data-local:
+ 	mkdir -p $(DESTDIR)$(logdir)
--- a/open-src/xserver/xorg/sun-src/os/solaris/mdb/modules/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/xserver/xorg/sun-src/os/solaris/mdb/modules/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -25,7 +25,8 @@
 MDB_MODULE_DIR=/usr/lib/mdb/proc/$(ARCHLIBSUBDIR)
 
 CFLAGS += -K pic -g
-CPPFLAGS += -I ../../../../include -I ../../../.. -I ../../../../Xext
+CPPFLAGS += -I $(top_srcdir)/include -I $(top_srcdir) -I $(top_srcdir)/Xext
+CPPFLAGS += -I $(top_builddir)/include
 LDFLAGS = -Wl,-z,parent=/usr/bin/$(ARCHLIBSUBDIR)/mdb -Wl,-z,text -M mapfile
 
 HEADERS = Xserver_mdb.h
--- a/open-src/xserver/xvnc/Makefile	Wed Nov 12 11:14:21 2014 -0800
+++ b/open-src/xserver/xvnc/Makefile	Sun Nov 23 21:46:46 2014 -0800
@@ -53,11 +53,12 @@
 
 # Xorg server source tarball to use sources from
 XORG_TARBALL=$(TARBALLDIR)/xorg-server-$(XORGSERVER_VERS).tar.bz2
-XORG_SOURCE_DIR=$(BUILD_DIR)/xorg-server-$(XORGSERVER_VERS)
-XORG_BUILD_DIR=$(SOURCE_DIR)/unix/xserver
+XORG_SOURCE_DIR = $(SOURCE_DIR)/unix/xserver
+XORG_BUILD_DIR  = $(BUILD_DIR)/unix/xserver
 
 # Java VNCviewer applet for connecting from a web browser
-JAVA_SOURCE_DIR = $(SOURCE_DIR)/java/src/com/tigervnc/vncviewer
+JAVA_SOURCE_DIR = $(SOURCE_DIR)/java/src/com/tigervnc
+JAVA_BUILD_DIR  = $(BUILD_DIR)/java/src/com/tigervnc
 
 # Download site for source
 SOURCE_URL=$(SF_DOWNLOADS_URL)/tigervnc/tigervnc/1.1.0/$(SOURCE_TARBALL_NAME)
@@ -83,6 +84,9 @@
 # Need to regenerate autoconf/automake files after patching
 AUTORECONF=yes
 
+# TigerVNC 1.1 doesn't fully support out-of-tree builds, so clone the source
+CLONE_SRC = yes
+
 # Disable parfait build with 1.3 - 17759056
 USE_PARFAIT=no
 
@@ -152,8 +156,8 @@
 # Merge in additional sources from Xorg tarball & sun-src directory
 # This step has to be done before default_source, so that patches applied
 # in that step work correctly.
-$(NO_RECURSE)XORG_SOURCE_INIT_TARGET = $(XORG_BUILD_DIR)/$(SOURCE_INIT_TARGET_FILE)
-$(NO_RECURSE)XORG_PATCHED_TARGET = $(XORG_BUILD_DIR)/$(PATCHED_TARGET_FILE)
+$(NO_RECURSE)XORG_SOURCE_INIT_TARGET = $(XORG_SOURCE_DIR)/$(SOURCE_INIT_TARGET_FILE)
+$(NO_RECURSE)XORG_PATCHED_TARGET = $(XORG_SOURCE_DIR)/$(PATCHED_TARGET_FILE)
 Xvnc_source_init: $(XORG_PATCHED_TARGET)
 
 $(XORG_TARBALL):
@@ -166,10 +170,9 @@
 		BUILD_TYPE="$(BUILD_TYPE)" \
 		SOURCE_TARBALL="$(XORG_TARBALL)" \
 		SOURCE_DEPS="$(XORG_TARBALL)" \
-		SOURCE_DIR="$(XORG_BUILD_DIR)" \
-		BUILD_DIR="$(XORG_BUILD_DIR)" \
-		ADD_TAR_FLAGS="--strip-components=1"
-	(cd $(XORG_BUILD_DIR) && $(LNDIR) ../../../../../xorg/sun-src)
+		SOURCE_DIR="$(XORG_SOURCE_DIR)" \
+		BUILD_DIR="$(XORG_BUILD_DIR)"
+	(cd $(XORG_SOURCE_DIR) && $(LNDIR) ../../../../xorg/sun-src)
 	touch $(XORG_SOURCE_INIT_TARGET)
 
 $(XORG_PATCHED_TARGET): $(XORG_SOURCE_INIT_TARGET)
@@ -177,9 +180,10 @@
 		NO_RECURSE="$(POUND_SIGN)" \
 		BUILD_TYPE="$(BUILD_TYPE)" \
 		SOURCE_PATCHES="$(XORG_SOURCE_PATCHES:%=../xorg/%)" \
-		SOURCE_DIR="$(XORG_BUILD_DIR)" \
+		SOURCE_DIR="$(XORG_SOURCE_DIR)" \
+		BUILD_DIR="$(XORG_BUILD_DIR)" \
 		XORG_BUILD_DIR="$(XORG_BUILD_DIR)"
-	(cd $(SOURCE_DIR) && $(LNDIR) ../../sun-src)
+	(cd $(SOURCE_DIR) && $(LNDIR) ../sun-src)
 	touch $(XORG_PATCHED_TARGET)
 
 # Command line options to GNU autoconf configure script for Xvnc
@@ -211,7 +215,7 @@
 MODULE_MAKEFLAGS = PROTODIR=$(PROTODIR)
 
 # Run configure script for Xvnc
-$(XORG_BUILD_DIR)/Makefile: $(SOURCE_TARGETS)
+$(XORG_BUILD_DIR)/Makefile: $(SOURCE_TARGETS) $(BUILD_DIR)
 	(cd $(XORG_BUILD_DIR) &&  \
 		$(AUTORECONF_ENV) autoreconf --install --force && \
 		$(CONFIG_ENV) $(CONFIG_SHELL) ./configure $(XVNC_CONFIG_OPTS) )
@@ -219,10 +223,8 @@
 Xvnc_build: $(CONFIGURE_TARGETS)
 	$(PERL) -i -p -e 's{/usr/bin/env perl}{$(PERL)}' \
 		$(SOURCE_DIR)/unix/vncserver
-	(cd $(SOURCE_DIR) ; \
-	 $(BUILD_ENV) $(MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS))
-	(cd $(XORG_BUILD_DIR) ; \
-	 $(BUILD_ENV) $(MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS))
+	$(DEFAULT_BUILD_COMMAND:@DIR@=$(BUILD_DIR))
+	$(DEFAULT_BUILD_COMMAND:@DIR@=$(XORG_BUILD_DIR))
 
 Xvnc_install_server: $(BUILD_TARGETS)
 	(cd $(XORG_BUILD_DIR)/hw/vnc \
@@ -232,11 +234,11 @@
 
 Xvnc_install_programs: $(BUILD_TARGETS)
 	mkdir -p $(PROTODIR)/usr/bin/$(ARCHBINSUBDIR)
-	$(INSTALL_SCRIPT) -m 0755 $(SOURCE_DIR)/unix/vncserver \
-		$(SOURCE_DIR)/unix/vncpasswd/vncpasswd \
-		$(SOURCE_DIR)/unix/vncconfig/vncconfig \
-		$(SOURCE_DIR)/unix/vncviewer/vncviewer \
-		$(SOURCE_DIR)/unix/x0vncserver/x0vncserver \
+	$(INSTALL_SCRIPT) -m 0755 $(BUILD_DIR)/unix/vncserver \
+		$(BUILD_DIR)/unix/vncpasswd/vncpasswd \
+		$(BUILD_DIR)/unix/vncconfig/vncconfig \
+		$(BUILD_DIR)/unix/vncviewer/vncviewer \
+		$(BUILD_DIR)/unix/x0vncserver/x0vncserver \
 		$(PROTODIR)/usr/bin/$(ARCHBINSUBDIR)
 
 Xvnc_install_data: $(SOURCE_TARGETS)
@@ -258,24 +260,21 @@
 
 # Java VNCviewer applet for connecting from a web browser
 JAVA_INSTALL_DIR = $(PROTODIR)/usr/share/vnc/classes
-JAVA_JAR_FILE = $(JAVA_SOURCE_DIR)/VncViewer.jar
+JAVA_JAR_FILE = $(JAVA_BUILD_DIR)/vncviewer/VncViewer.jar
 
 java_build: $(JAVA_JAR_FILE)
 
-$(JAVA_JAR_FILE): $(SOURCE_TARGETS)
-	(cd $(JAVA_SOURCE_DIR)/../decoder ; \
-	 $(BUILD_ENV) $(MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS))
-	(cd $(JAVA_SOURCE_DIR) ; \
-	 $(BUILD_ENV) $(MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS))
+$(JAVA_JAR_FILE): $(SOURCE_TARGETS) $(BUILD_DIR)
+	$(DEFAULT_BUILD_COMMAND:@DIR@=$(JAVA_BUILD_DIR)/decoder)
+	$(DEFAULT_BUILD_COMMAND:@DIR@=$(JAVA_BUILD_DIR)/vncviewer)
 
 java_install: $(JAVA_JAR_FILE)
 	-rm -rf $(JAVA_INSTALL_DIR)
 	mkdir -p $(JAVA_INSTALL_DIR)
-	(cd $(JAVA_SOURCE_DIR) ; \
-	 $(BUILD_ENV) $(MAKE) $(MAKEFLAGS) $(DEFAULT_BUILD_MAKEFLAGS) \
-		install INSTALL_DIR=$(JAVA_INSTALL_DIR))
-	$(INSTALL_SCRIPT) -m 0444 $(JAVA_SOURCE_DIR)/README \
-		$(JAVA_SOURCE_DIR)/LICENCE.TXT \
+	$(DEFAULT_INSTALL_COMMAND:@DIR@=$(JAVA_BUILD_DIR)/vncviewer) \
+ 		install INSTALL_DIR=$(JAVA_INSTALL_DIR)
+	$(INSTALL_SCRIPT) -m 0444 $(JAVA_SOURCE_DIR)/vncviewer/README \
+		$(JAVA_SOURCE_DIR)/vncviewer/LICENCE.TXT \
 		$(JAVA_INSTALL_DIR)
 	chmod a+x $(JAVA_INSTALL_DIR)/VncViewer.jar
 	rm -f $(JAVA_INSTALL_DIR)/*.class