Updates the build script and creates new maven executions for building, testing and cleaning the code.

git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-cpp/trunk@781532 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/activemq-cpp/build.sh b/activemq-cpp/build.sh
index 2a24789..ebc5a92 100755
--- a/activemq-cpp/build.sh
+++ b/activemq-cpp/build.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
 # ------------------------------------------------------------------------
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -16,63 +16,83 @@
 # limitations under the License.
 # ------------------------------------------------------------------------
 
-# default settings
-runautogen=true
-runconfigure=true
-maketarget=all
-
 # load the user supplied build configuration file if present.
 if [ -f "./build.conf" ] ; then
   . ./build.conf
 fi
 
-# No Configure script means we have to run autogen, which in turn means
-# we need to run a new Configure on the project.
-if [ -x "./configure" ] ; then
-
-    # even if we have a configure script, if the template has been updated we should
-    # run it again to account for the changes, which also means we need to run a autogen
-    # to create the actual script and associated autoconf artifacts.
-    if [ "./configure.ac" -ot "./configure" ] ; then
-        echo "No need to run autogen.sh or configure"
-        runautgen=false
-        runconfigure=false
-    else
-        echo "We need to run autogen.sh and configure"
-        runautgen=true
-        runconfigure=true
-    fi
-
+# load user activemq-cpp build configuration
+if [ -f "$HOME/.activemqcpprc" ] ; then
+  . "$HOME/.activemqcpprc"
 fi
 
-run_Configure {
-    autogen.sh
-    pushd build
+# This is where we run all the build steps, configure, make, etc.
+if [ -n builddir ] ; then
+   builddir="./build"
+fi
+
+check_Configure() {
+
+    # No Configure script means we have to run autogen, which in turn means
+    # we need to run a new Configure on the project.
+    if [ -x "./configure" ] ; then
+
+        # even if we have a configure script, if the template has been updated we should
+        # run it again to account for the changes, which also means we need to run a autogen
+        # to create the actual script and associated autoconf artifacts.
+        if [ "./configure.ac" -ot "./configure" ] && [ -d $builddir ] ; then
+            runconfigure=false
+        else
+            runconfigure=true
+        fi
+
+    fi
+
+    if [ "true" = $runconfigure ] ; then
+        run_Configure
+    fi
+
+}
+
+run_Configure() {
+    ./autogen.sh
+
+    if ! [ -d $builddir ] ; then
+        mkdir -p $builddir
+    fi
+
+    pushd $builddir
     ../configure
+    popd
     exit
 }
 
 run_Clean() {
-    pushd build
-    make clean
+    rm -rf $builddir
     exit
 }
 
 run_Make() {
-    pushd build
+    check_Configure
+    pushd $builddir
     make
+    popd
     exit
 }
 
 run_Check() {
-    pushd build
+    check_Configure
+    pushd $builddir
     make check
+    popd
     exit
 }
 
 run_Doxygen() {
-    pushd build
+    check_Configure
+    pushd $builddir
     make doxygen-run
+    popd
     exit
 }
 
@@ -80,10 +100,10 @@
 configure)
     run_Configure
     ;;
-all)
+compile)
     run_Make
     ;;
-check)
+test)
     run_Check
     ;;
 clean)
@@ -93,7 +113,7 @@
     run_Doxygen
     ;;
 *)
-    echo "Usage: $0 {clean}"
+    echo "Usage: $0 {configure,compile,clean,test,doxygen}"
     exit 1
 esac
 
diff --git a/activemq-cpp/pom.xml b/activemq-cpp/pom.xml
index b15451f..7fad02b 100644
--- a/activemq-cpp/pom.xml
+++ b/activemq-cpp/pom.xml
@@ -198,7 +198,7 @@
       </plugin>
     </plugins>
   </build>
-  <!--
+
   <profiles>
     <profile>
       <id>Unix Make</id>
@@ -215,18 +215,57 @@
             <version>1.1</version>
             <executions>
               <execution>
+                <id>Configure</id>
+                <phase>generate-resources</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <arguments>
+                    <argument>configure</argument>
+                  </arguments>
+                </configuration>
+              </execution>
+              <execution>
+                <id>Compile</id>
                 <phase>compile</phase>
                 <goals>
                   <goal>exec</goal>
                 </goals>
+                <configuration>
+                  <arguments>
+                    <argument>compile</argument>
+                  </arguments>
+                </configuration>
+              </execution>
+              <execution>
+                <id>Test</id>
+                <phase>test</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <arguments>
+                    <argument>test</argument>
+                  </arguments>
+                </configuration>
+              </execution>
+              <execution>
+                <id>Clean</id>
+                <phase>test</phase>
+                <goals>
+                  <goal>exec</goal>
+                </goals>
+                <configuration>
+                  <arguments>
+                    <argument>clean</argument>
+                  </arguments>
+                </configuration>
               </execution>
             </executions>
             <configuration>
-              <executable>make</executable>
-              <workingDirectory>${basedir}/build</workingDirectory>
-              <arguments>
-                <argument>check</argument>
-              </arguments>
+              <executable>build.sh</executable>
+              <workingDirectory>${basedir}</workingDirectory>
             </configuration>
           </plugin>
         </plugins>
@@ -265,5 +304,5 @@
       </build>
     </profile>
   </profiles>
-  -->
+
 </project>