git subrepo clone https://github.com/agottem/weld.git weld

subrepo:
  subdir:   "weld"
  merged:   "d0cd07b"
upstream:
  origin:   "https://github.com/agottem/weld.git"
  branch:   "master"
  commit:   "d0cd07b"
git-subrepo:
  version:  "0.3.1"
  origin:   "???"
  commit:   "???"

Change-Id: I109553651e97fd93e00aa555d171ca9d04ce8585
diff --git a/weld/doc/c.def.mk.template b/weld/doc/c.def.mk.template
new file mode 100644
index 0000000..93b7144
--- /dev/null
+++ b/weld/doc/c.def.mk.template
@@ -0,0 +1,95 @@
+# For detailed information on using, building, and modifying Weld, please visit:
+# http://www.agottem.com/weld
+
+# This is a template for a C or C++ component definition.  These component definitions
+# should have the following layout:
+#     ./
+#         def.mk
+#         source/
+#             source1.c
+#             source2.c
+#         include/
+#             header1.h
+#             header2.h
+#         resource/
+#             resource1.blaz
+
+# Specify the name of the component definition.  This name must be unique throughout
+# the source tree
+name := my_name
+
+# Specify the type of component.  May be one of:
+#    lib -- build static library
+#    bin -- build a binary
+# The name of the build produced build artifact will be derived from the specified
+# name of the component
+type := lib
+
+# Specify the language the component source is written in.  May be one of:
+#    c   -- compile as c99
+#    cpp -- compile as c++11
+lang := c
+
+# Optionally specify source files should live in "src/" instead of "source/"
+def_source_subdir := src
+
+# Optionally specify headers live in "inc/" instead of "include/"
+def_include_subdir := include
+
+# Optionally specify resources live in "res/" instead of "resource/"
+def_resource_subdir := res
+
+# Specify a list of  headers to make available to other components.  These headers
+# should exist in the include/ directory of the component.
+#
+# Each specified header will be copied to the build path as
+# <build_path>/include/<name>/file.h.  Other components may include these files by
+# using #include <name/file.h>
+header_list := file.h bar.h blaz.h
+
+# Specify a list of source files to build for this component.  These source
+# files should exist in the source/ directory of the component.
+source_list := file.c bar.c blaz.c fun.c help.c private.c
+
+# Specify a lsit of resource files to copy to bin directory of the build path.
+# These resource files should exist in the resource/ directory of the component.
+resource_list := img/cat.jpg img/another_cat.jpg text/help.txt
+
+
+# Specify a list of preprocessor definitions to set during the compilation.
+definition_list := BUILD_COMPONENT=$(name) ENABLE_THIS_FEATURE
+
+
+# Specify explicit include paths to use during compilation
+include_path_list := /some/other/include
+
+
+# Specify a list of libraries this component should link against.  These libraries
+# should be libraries which are part of the source tree and can be built.  Only
+# the library name should be specified.
+source_lib_list := my_foo_lib my_bar_lib
+
+# Specify a list of external libraries this component should link against.  These
+# libraries should exist outside of the source tree.  Typically system libraries or
+# third party libraries are set here.  The toolchain will select the most
+# appropriate option, which may be a shared or static library
+lib_list := GL glut
+
+# Specify a list of external libraries this component should link against.  These
+# libraries should exist outside of the source tree.  Typically system libraries or
+# third party libraries are set here. A static version of the library must be
+# available for linking
+static_lib_list := ssl
+
+# Specify a list of library paths to use during the compilation of this component
+lib_path_list := /some/other/lib
+
+
+# Specify compiler flags to use for the components compilation
+compiler_flag_list := -Wno-crappy-warnings
+
+# Specify linker flags to use for this components compilation
+link_flag_list := -Wl,foobar
+
+# Specify additional dependencies build artifacts should have
+def_deps := /my/global/dep
diff --git a/weld/doc/command_line.txt b/weld/doc/command_line.txt
new file mode 100644
index 0000000..f0b67e5
--- /dev/null
+++ b/weld/doc/command_line.txt
@@ -0,0 +1,91 @@
+For detailed information on using, building, and modifying Weld, please visit:
+http://www.agottem.com/weld
+
+Weld provides a variety of options when building.  When building, the following variables may be set
+either in your environment or on the command line:
+
+    source_path   -- set to the root of the project
+    build_path    -- set to the directory all build output should be directed to
+    config_file   -- arbitrary file to include with the build which may set additional settings
+    mode          -- set to 'release' or 'debug' to build the desired binary
+    arch          -- set to the desired architecture such as 'i686' or 'amd64'
+    platform      -- set to the desired platform target such as 'unix' or 'win32'
+    c_toolchain   -- set to the toolchain to use for the build such as 'gcc'
+    show_progress -- set to 1 to print the name of each artifact being built
+    debug_weld    -- set to 1 to print out internal weld debugging info
+
+The above variables may be simply set in your weld project's top-level makefile or in a config file
+which is specified by the "config_file" variable.  For instance, you could define the config file
+"example_config.mk" below:
+
+example_config.mk:
+    source_path := /my/projects/fun
+    build_path  := /my/projects/build
+    mode        := debug
+    arch        := i686
+    platform    := linux
+    c_toolchain := gcc
+
+You could then build with the command line:
+    make config_file=example_config.mk
+
+Alternatively you could simply add these options to your project's top-level makefile:
+
+makefile:
+    source_path := /my/projects/fun
+    build_path  := /my/projects/build
+    mode        := debug
+    arch        := i686
+    platform    := linux
+    c_toolchain := gcc
+
+    include $(weld_path)/weld.mk
+
+With the above, you could then simply build with the command line:
+    make
+
+Once your weld project is setup, you can build by specifying the following targets
+
+    # build everything
+    make
+    make build
+
+    # clean everything
+    make clean
+
+    # build just a single component and its dependencies
+    make my_component_name
+
+    # build just a single source file for a component
+    make my_component_name/source.o
+
+    # install just a component's headers
+    make my_component_name_headers
+
+    # clean just a component's headers
+    make clean_my_component_name_headers
+
+    # install just a component's resources
+    make my_component_name_resources
+
+    # clean just a component's resources
+    make clean_my_component_name_resources
+
+    # make just a library
+    make libmy_component_name.a
+
+    # make just a binary
+    make bin/my_component_name
+
+The above make commands may be a bit verbose for your taste as each command is echoed
+to the terminal.  For something a little easier to read, you might prefer:
+    make --quiet show_progress=1
+
+There are quite a few options and possibilities involved here.  For the best experience,
+I recommend doing something like this:
+    alias weld="make -C /my/project/root --quiet show_progress=1""
+
+The above will enable you to, from any directory, do the following:
+    weld my_component
+    weld clean
+    weld
diff --git a/weld/doc/overview.txt b/weld/doc/overview.txt
new file mode 100644
index 0000000..4d4026c
--- /dev/null
+++ b/weld/doc/overview.txt
@@ -0,0 +1,50 @@
+For detailed information on using, building, and modifying Weld, please visit:
+http://www.agottem.com/weld
+
+Weld is a build system for GNU make.  It is an implementation of a non-recursive make system.  Weld
+is intended for C and C++ projects, however, could be easily extended to other languages.  Weld is
+designed to work on Linux or FreeBSD using GCC and Windows using MinGW.
+
+To start using Weld, first create a directory to host all the source for your project.  A typical
+project is expected to be composed of many libraries and binaries with a single top level makefile.
+An example layout may be something like:
+
+    my_project/
+        makefile
+
+        libs/
+            gui/
+                graph/
+                    def.mk
+                    source/...
+                    include/...
+                button/
+                    def.mk
+                    source/...
+                    include/...
+            data/
+                compute/
+                    compute.mk
+                    source/...
+                    include/...
+        bins/
+            my_app/
+                def.mk
+                source/...
+
+The above example lays out a project with a handful of libs and a binary.  To build, simply type
+make at the top-level.  Weld will do a simple find for any files name "def.mk".  Each "def.mk" is
+then included and a complete dependency tree is constructed.  This means make knows how every build
+artifact is related and what order things need to be built in.  If make's "-j" option is used you'll
+perform a build with optimal parallelization.
+
+Additionally, because the full dependency tree is known, incremental builds will only ever build
+precisely what is needed.  If dependencies haven't changed, no time will be wasted needlessly
+rebuilding components.
+
+In addition to Weld generating a complete dependency tree for you, it'll also define useful targets.
+For instance, "make libcompute.a" will build just the compute library and any dependencies.  "make
+my_app" will build just my_app and any dependencies.  "make clean" will clean the project.
+
+For details on specifying def.mk files, see the "c.def.mk.template" or "resource.def.mk.template"
+files.  For insight into the weld command line, see the "command_line.txt" file.
diff --git a/weld/doc/project.makefile.template b/weld/doc/project.makefile.template
new file mode 100644
index 0000000..994121f
--- /dev/null
+++ b/weld/doc/project.makefile.template
@@ -0,0 +1,36 @@
+# For detailed information on using, building, and modifying Weld, please visit:
+# http://www.agottem.com/weld
+
+# There should be just a single makefile for an entire weld project.  A weld
+# project is expected to consist of many libraries, binaries, and resources.
+# This top level makefile should specify defaults for the project and include
+# the weld.mk file.
+
+# Specify sane defaults -- the projects source lives in the same directory
+# as this makefile, the build will be output to the ./build folder, and
+# sane defaults for the rest
+source_path := .
+build_path  := ./build
+arch        := amd64
+mode        ?= debug
+shell_name  := sh
+platform    := unix
+unix_flavor := linux
+c_toolchain := gcc
+
+# GCC toolchain specific options
+
+# Clang and gcc are mostly compatible, so use all the gcc compilation infra but
+# switch the compiler name to clang/clang++
+gcc_opt_use_clang := 1
+
+# Specify additional settings applicable to every component
+global_compiler_flag_list := -Wall
+global_link_flags         := -Wl,foo
+global_definition_list    := MY_PROJECT_NAME
+global_include_path_list  := /third/party/include/path
+global_lib_path           := /third/party/lib/path
+
+
+# Include the "weld.mk" file in the weld build system directory
+include /path/to/weld/install/weld.mk
diff --git a/weld/doc/resource.def.mk.template b/weld/doc/resource.def.mk.template
new file mode 100644
index 0000000..6a8a8e9
--- /dev/null
+++ b/weld/doc/resource.def.mk.template
@@ -0,0 +1,21 @@
+# For detailed information on using, building, and modifying Weld, please visit:
+# http://www.agottem.com/weld
+
+# This is a template for a resource only component definition.  These
+# component definitions should have the following layout:
+#     ./
+#         def.mk
+#         resource/
+#             resource1.blaz
+#             resource2.bar
+
+# Specify the name of the component definition.  This name must be unique throughout
+# the source tree
+name := my_res
+
+# Specify a list of resource files to copy to bin directory of the build path.
+# These resource files should exist in the resource/ directory of the component.
+resource_list := img/cat.jpg img/another_cat.jpg text/help.txt
+
+# Specify additional dependencies each resource build artifact should have
+def_deps := /some/file