diff --git a/bin/README.md b/bin/README.md
new file mode 100644
index 0000000000..3097da3015
--- /dev/null
+++ b/bin/README.md
@@ -0,0 +1,51 @@
+# Build Utilities
+
+This directory contains utilities used for building OpenLayers applications,
+generating the API docs, and building hosted versions of the library.
+
+## Dependencies
+
+OpenLayers is built using [Closure Compiler][closure]. The [plovr][plovr] build
+tool simplifies building with Closure Compiler and comes with a built-in version
+of the Closure Library and Compiler. Both the Compiler and plovr require Java
+version 1.6 or above. This directory includes a bash/batch script for driving
+plovr. For pulling down plovr and accessing it in a cross-platform way,
+[Ant][ant] is used.
+
+The instructions below assume that you have added the `ol` bash/batch script to
+your path (type `ol` and see usage docs to confirm this is set up).
+
+[closure]: https://developers.google.com/closure/compiler/
+[plovr]: http://plovr.com/
+[ant]: http://ant.apache.org/
+
+## Building an Application
+
+To compile an application together with OpenLayers, you will provide a build
+configuration file for the compiler. See the `demo` folder for example
+configuration files (e.g. `map.json`).
+
+Compile your application with the `build` command:
+
+ ol build path/to/config.json
+
+Substitute the path to your build configuration file above.
+
+## Building the API Docs
+
+From within the root of the OpenLayers directory, use the `doc` command to build
+the API docs:
+
+ ol doc
+
+This will generate documentation in the `jsdoc` directory.
+
+## Building the Hosted Library
+
+To compile the full OpenLayers api, use the `build` command from the root of the
+OpenLayers directory:
+
+ ol build
+
+This will generate an `api.js` script in the same directory. (This is equivalent to `ol build path/to/ol/api.json`.)
+
diff --git a/bin/build.xml b/bin/build.xml
index 5cf52b6b16..5c51c4a784 100644
--- a/bin/build.xml
+++ b/bin/build.xml
@@ -8,15 +8,15 @@
-
+
Available commands:
serve - Run the library server
- api - Builds the optimized file with public api
- doc - Build the reference docs
+ build - Builds a minified version of the library or an application
+ doc - Generate the reference docs
@@ -36,10 +36,22 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/bin/ol b/bin/ol
index e764baa5e3..67da0eea80 100755
--- a/bin/ol
+++ b/bin/ol
@@ -36,4 +36,9 @@ else
fi
-ant -e -f "$OL_HOME/bin/build.xml" -Dol.home="$OL_HOME" $1
+ANT_ARGS=""
+if [ $# -gt 1 ]; then
+ ANT_ARGS=-Dbuild.json="$2"
+fi
+
+ant -e -f "$OL_HOME/bin/build.xml" -Dbasedir=. -Dol.home="$OL_HOME" $1 $ANT_ARGS
diff --git a/bin/ol.cmd b/bin/ol.cmd
index 6d8eba6e2e..3b38c12aea 100644
--- a/bin/ol.cmd
+++ b/bin/ol.cmd
@@ -15,4 +15,7 @@ popd
set COMMAND="%~1"
if "%~1" == "" set COMMAND="usage"
-ant -e -f %OL_HOME%\bin\build.xml -Dol.home=%OL_HOME% -Dbasedir=. %COMMAND%
+set ANT_ARGS=
+if "%~2" == "" set ANT_ARGS="-Dbuild.json=%~2"
+
+ant -e -f %OL_HOME%\bin\build.xml -Dol.home=%OL_HOME% -Dbasedir=. %COMMAND% %ANT_ARGS%