1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
|
#!/bin/sh
#check if intstall directory provided
if [ $# -eq 1 ]
then
BASE_DIR=$1
INSTALL_DIR=$1
DOCS_DIR=$INSTALL_DIR
elif [ $# -eq 0 ]
then
INSTALL_DIR="/usr/local"
DOCS_DIR="/usr/local/share/doc/lip.2.0"
else
echo "..."
fi
DEFAULT_DIR="/usr/local"
#run configure script is it exist with install directory as parameter
if [ -f configure ]
then
./configure --prefix=$INSTALL_DIR
# echo "configure goes here"
else
echo "Configure script missing!"
if [ -d $INSTALL_DIR ]
then
echo "directory already exists!"
else
mkdir-p $INSTALL_DIR
fi
fi
#copydocumentation into the directory docs directory
if [ -d ./examples -a -d ./docs ]
then
echo "Installing documentation ..."
# Check to see if apropriate directories exist if not
# create them and copy docs to apropriate dirs.
if [ ! -d $INSTALL_DIR ]
then
mkdir -p $INSTALL_DIR
fi
if [ "$DEFAULT_DIR" != "$INSTALL_DIR" ]
then
if [ -d $INSTALL_DIR/examples -a -d $INSTALL_DIR/DOCS ]
then
echo "..."
else
mkdir -p $INSTALL_DIR/examples
mkdir -p $INSTALL_DIR/docs
fi
#copy docuemnts in to appropriate directories
echo " cp -r ./EXAMPLES $INSTALL_DIR/EXAMPLES "
cp -r ./examples/* $INSTALL_DIR/examples/
echo " cp -r ./DOCS $INSTALL_DIR/DOCS "
cp -r ./docs/* $INSTALL_DIR/docs/
#save documents directory path for later unistall
echo $INSTALL_DIR > docs_dir
else
if [ ! -d $INSTALL_DIR/share ]
then
mkdir -p $INSTALL_DIR/share/
fi
if [ ! -d $INSTALL_DIR/share/doc ]
then
mkdir -p $INSTALL_DIR/share/doc
fi
if [ ! -d $DOCS_DIR ]
then
mkdir -p $DOCS_DIR
mkdir -p $DOCS_DIR/examples
mkdir -p $DOCS_DIR/docs
fi
#copy docuemnts in to appropriate directories
echo " cp -r ./EXAMPLES $DOCS_DIR/EXAMPLES "
cp -r ./examples/* $DOCS_DIR/examples/
echo " cp -r ./DOCS $DOCS_DIR/DOCS "
cp -r ./docs/* $DOCS_DIR/docs
#save documents directory path for later unistall
echo $DOCS_DIR/ > docs_dir
fi
else
echo "documentation not found!"
fi
#run make file target make isntall to compile and install the library
if [ -f Makefile ]
then
make install
# echo "make install goes here"
fi
#Create the make file for the examples
echo '#############################################################################' > $DOCS_DIR/examples/Makefile
echo '# #' >> $DOCS_DIR/examples/Makefile
echo '# CLASS LIBRARY LIP FOR MULTIVARIATE SCATTERED DATA INTERPOLATION #' >> $DOCS_DIR/examples/Makefile
echo '# #' >> $DOCS_DIR/examples/Makefile
echo '# This makefile gives targets that show how to compile and link #' >> $DOCS_DIR/examples/Makefile
echo '# user code to the Lip shared library and statatic library. #' >> $DOCS_DIR/examples/Makefile
echo '# #' >> $DOCS_DIR/examples/Makefile
echo '#############################################################################' >> $DOCS_DIR/examples/Makefile
echo '#' >> $DOCS_DIR/examples/Makefile
echo '# This make file show how to compile and link examples included with this ' >> $DOCS_DIR/examples/Makefile
echo '# distribution of LIP assuming different installations of the library. this' >> $DOCS_DIR/examples/Makefile
echo '# include the following examples for both static and shared linking.' >> $DOCS_DIR/examples/Makefile
echo '#' >> $DOCS_DIR/examples/Makefile
echo '# liblipex: shows how to compile and link library when install' >> $DOCS_DIR/examples/Makefile
echo '# in the library search path used to load libraries' >> $DOCS_DIR/examples/Makefile
echo '#' >> $DOCS_DIR/examples/Makefile
echo '# exampleprocedural: shows how to compile and link by implicitly telling' >> $DOCS_DIR/examples/Makefile
echo '# the linker where to look for the library' >> $DOCS_DIR/examples/Makefile
echo '# shows how to compile and link procedural C conde.' >> $DOCS_DIR/examples/Makefile
echo '#' >> $DOCS_DIR/examples/Makefile
echo '############################################################################' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# location where the library is installed' >> $DOCS_DIR/examples/Makefile
echo MYPATH= $BASE_DIR >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# compiler' >> $DOCS_DIR/examples/Makefile
echo 'CC = g++' >> $DOCS_DIR/examples/Makefile
echo 'GCC = gcc' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# Some options probably not needed: -g (which enables the debugger options).' >> $DOCS_DIR/examples/Makefile
echo 'FLAGS = -g -O -Wno-deprecated' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# Object file fo the example' >> $DOCS_DIR/examples/Makefile
echo 'OBJ1 = liblipex.o' >> $DOCS_DIR/examples/Makefile
echo 'OBJ2 = exampleprocedural.o' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# LIB_PATH used to store the path in which the library files were installed.' >> $DOCS_DIR/examples/Makefile
echo '# The commented out assignment is for when the library is installed into the' >> $DOCS_DIR/examples/Makefile
echo '# users home directory. NOTE: $(HOME) referes to env varialble HOME.' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#directory where the liblip.a is installed' >> $DOCS_DIR/examples/Makefile
echo 'LIB_PATH = $(MYPATH)/lib/' >> $DOCS_DIR/examples/Makefile
echo '#LIB_PATH = /usr/local/lib/' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# INCLUDE_PATH used to store the path in which the *.h files have been' >> $DOCS_DIR/examples/Makefile
echo '# placed. The commented out assignment is for when the *.h files are placed' >> $DOCS_DIR/examples/Makefile
echo '# in the users home directory.' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#directory' >> $DOCS_DIR/examples/Makefile
echo 'INCLUDE_PATH = $(MYPATH)/include' >> $DOCS_DIR/examples/Makefile
echo '#INCLUDE_PATH = /usr/local/include/' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#include directories holdign the header files needed for liblip' >> $DOCS_DIR/examples/Makefile
echo '#INCLUDE= -I$(INCLUDE_PATH)/tnt -I$(INCLUDE_PATH)/glpk -I$(INCLUDE_PATH)' >> $DOCS_DIR/examples/Makefile
echo 'INCLUDE= -I$(INCLUDE_PATH)/tnt -I$(INCLUDE_PATH)' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#location of glpklib.a this is a static library and should be compiled from source.' >> $DOCS_DIR/examples/Makefile
echo 'GLPK_STATIC_PATH=$(HOME)/glpklib/lib/' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo 'all: static_example2 static_example shared_example ' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#################################################################################' >> $DOCS_DIR/examples/Makefile
echo '# linking examplelint. If you have succesfully installed lip library and have' >> $DOCS_DIR/examples/Makefile
echo '# LIB_PATH to /etc/ld.so.conf Or you have added LIB_PATH TO LD_LIBRARY_PATH' >> $DOCS_DIR/examples/Makefile
echo '# then compiling is as eassy as this. ' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# shared_example target links liblipex.o to the liblip shared library. To make' >> $DOCS_DIR/examples/Makefile
echo '# up shared_example executable.' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo 'shared_example: $(OBJ1)' >> $DOCS_DIR/examples/Makefile
echo ' $(CC) -o shared_example $(OBJ1) $(FLAGS) -L$(LIB_PATH) -llip -L$(GLPK_STATIC_PATH) -lglpk -lm' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# static_example target links liblipex.o to the liblip static library. To make' >> $DOCS_DIR/examples/Makefile
echo '# up static_example executable.' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo 'static_example: $(OBJ1)' >> $DOCS_DIR/examples/Makefile
echo ' $(CC) -o static_example -non_shared $(OBJ1) $(FLAGS) -L$(LIB_PATH) -llip -L$(GLPK_STATIC_PATH) -lglpk -lm' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#################################################################################' >> $DOCS_DIR/examples/Makefile
echo '# linking examplelintprocedural' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# static_example target links exampleprocedural.o to the lip static library. To make' >> $DOCS_DIR/examples/Makefile
echo '# up static_example executable.' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo 'static_example2:$(OBJ2)' >> $DOCS_DIR/examples/Makefile
echo ' $(CC) -o static_example2 -static $(OBJ2) $(FLAGS) $(LIB_PATH)liblip.a $(GLPK_STATIC_PATH)libglpk.a -lm' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '#################################################################################' >> $DOCS_DIR/examples/Makefile
echo '# compiling examples to objectfiles.' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo 'liblipex.o: liblipex.cpp' >> $DOCS_DIR/examples/Makefile
echo ' $(CC) -c liblipex.cpp $(FLAGS) $(INCLUDE)' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '# compiling proccedual example using C compiler' >> $DOCS_DIR/examples/Makefile
echo '#' >> $DOCS_DIR/examples/Makefile
echo 'exampleprocedural.o: exampleprocedural.c' >> $DOCS_DIR/examples/Makefile
echo ' $(GCC) -c exampleprocedural.c $(FLAGS) $(INCLUDE)' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo '.PHONY: clean all' >> $DOCS_DIR/examples/Makefile
echo '' >> $DOCS_DIR/examples/Makefile
echo 'clean:' >> $DOCS_DIR/examples/Makefile
echo ' rm -f $(OBJ1) shared_example static_example' >> $DOCS_DIR/examples/Makefile
echo ' rm -f $(OBJ2) static_example2' >> $DOCS_DIR/examples/Makefile
|