broke build into three parts - config, build, and install
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Jul 2005 15:07:15 +0000 (15:07 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Jul 2005 15:07:15 +0000 (15:07 +0000)
'make' does config and build
'make install' does install

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1077 dcc99617-32d9-48b4-a31d-7c20da2025e4

Makefile
config.sh
install.sh

index 0447919..f0f31e4 100644 (file)
--- a/Makefile
+++ b/Makefile
 # GNU General Public License for more details.
 # --------------------------------------------------------------------
 
-all:   config install
+all: config build
 
 config:
        ./config.sh
 
+build:
+       ./install.sh build
+
 install:
-       ./install.sh
+       ./install.sh install
 
 clean:
        ./install.sh clean
index a6fab55..971c5cb 100755 (executable)
--- a/config.sh
+++ b/config.sh
@@ -26,6 +26,16 @@ DEFAULT_CONFIG_FILE="install.conf.default";
 
 function buildConfig {
 
+       if [ -f "$CONFIG_FILE" ]; then
+               echo "";
+               echo "Using existing config file \"$CONFIG_FILE\""; 
+               echo "To generate a new config, remove \"$CONFIG_FILE\"";
+               echo "";
+               sleep 3;        
+               exit 0;
+       fi
+
+
        if [ -f "$DEFAULT_CONFIG_FILE" ]; then
                source "$DEFAULT_CONFIG_FILE";
        fi;
index 3513170..af63220 100755 (executable)
@@ -74,26 +74,47 @@ function verifyInstallPaths {
 # --------------------------------------------------------------------
 function mkInstallDirs {
 
-       mkdir -p "$PREFIX";
-       if [ "$?" != "0" ]; then
-               fail "Error creating $PREFIX";
-       fi
+       if installing; then
 
-       mkdir -p "$TMP";
-       if [ "$?" != "0" ]; then
-               fail "Error creating $TMP";
-       fi
+               mkdir -p "$PREFIX";
+               if [ "$?" != "0" ]; then
+                       fail "Error creating $PREFIX";
+               fi
+
+               if [ ! -w "$PREFIX" ]; then
+                       fail "We don't have write access to $PREFIX";
+               fi
 
-       if [ ! -w "$PREFIX" ]; then
-               fail "We don't have write access to $PREFIX";
        fi
 
-       if [ ! -w "$TMP" ]; then
-               fail "We don't have write access to $TMP";
+       if building; then
+
+               mkdir -p "$TMP";
+               if [ "$?" != "0" ]; then
+                       fail "Error creating $TMP";
+               fi
+
+               if [ ! -w "$TMP" ]; then
+                       fail "We don't have write access to $TMP";
+               fi
        fi
 
+       
+
+}
+
+function installing {
+       if [ -z "$INSTALLING" ]; then return 1; fi;
+       return 0;
+}
+
+function building {
+       if [ -z "$BUILDING" ]; then return 1; fi;
+       return 0;
 }
 
+
+
 # --------------------------------------------------------------------
 # Loads the config file.  If it can't fine CONFIG_FILE, it attempts to
 # use DEFAULT_CONFIG_FILE.  If it can't find that, it fails.
@@ -101,6 +122,7 @@ function mkInstallDirs {
 function loadConfig {
        if [ ! -f "$CONFIG_FILE" ]; then
                if [ -f "$DEFAULT_CONFIG_FILE" ]; then
+                       echo "+ + + Copying $DEFAULT_CONFIG_FILE to $CONFIG_FILE and using its settings...";
                        cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE";
                else
                        fail "config file \"$CONFIG_FILE\" cannot be found";
@@ -134,7 +156,10 @@ function runInstall {
                        
                case "$target" in
                        
-                       "jserver" | "router" | "gateway" | "srfsh" ) $MAKE -C "$OPENSRF_DIR" "$target" "$target-install";;
+                       "jserver" | "router" | "gateway" | "srfsh" ) 
+                               if building; then $MAKE -C "$OPENSRF_DIR" "$target"; fi;
+                               if installing; then $MAKE -C "$OPENSRF_DIR" "$target-install"; fi;
+                               ;;
 
                        *) fail "Unknown target: $target";;
 
@@ -161,24 +186,35 @@ function checkParams {
                case "$arg" in
 
                        "clean") 
-                               make -C OpenSRF/src clean
-                               make -C Open-ILS/src clean
-                               make -C Evergreen/src clean;;
+                               cleanMe;;
 
                        "force")
                                FORCE="1";;
 
+                       "build")
+                               BUILDING="1";;
+
+                       "install")
+                               INSTALLING="1";;
+
                        *) fail "Unknown command line argument: $arg";;
                esac
        done
 
-       echo "LAST $lastArg";
        if [ "$lastArg" = "clean" ]; then exit 0; fi;
 }
 
-# if user passes in the word 'clean' as the first shell arg, clean all
+
+function cleanMe {
+       loadConfig;
+       make -C "$OPENSRF_DIR" clean;
+       make -C "$OPENILS_DIR"  clean;
+       make -C "$EVERGREEN_DIR" clean;
+}
+
 checkParams "$@";
 
+if installing; then echo "Installing..."; fi;
 
 # Kick it off...
 runInstall;