git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9987 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2013-05-31 15:17:46 +00:00
parent 0e9dc07889
commit a5da3aa1ce
19 changed files with 115 additions and 176 deletions

View File

@ -12,10 +12,9 @@
# decisions on (un)installing individual child files are made by
# the Install.sh script in the child package
# depend function: args = child-package 0/1
# depend function: args = child-package
# checks if child-package is installed, if not just return
# if parent package is being installed, reinstall the child
# if parent package is being uninstalled, uninstall the child, reinstall it
# otherwise update child package according to its dependencies
depend () {
cd $1
@ -31,11 +30,11 @@ depend () {
return
fi
echo " re-installing package $1"
echo " updating package $1"
if (test -e $1/Install.sh) then
cd $1; /bin/sh Install.sh 1; cd ..
cd $1; /bin/sh Install.sh 2; cd ..
else
cd $1; /bin/sh ../Install.sh 1; cd ..
cd $1; /bin/sh ../Install.sh 2; cd ..
fi
}
@ -45,57 +44,69 @@ depend () {
# GPU, OPT, USER-CUDA, USER-MISC, USER-OMP
if (test $1 = "ASPHERE") then
depend GPU $2
depend USER-OMP $2
depend GPU
depend USER-OMP
fi
if (test $1 = "CLASS2") then
depend GPU $2
depend USER-CUDA $2
depend USER-OMP $2
depend GPU
depend USER-CUDA
depend USER-OMP
fi
if (test $1 = "COLLOID") then
depend GPU $2
depend USER-OMP $2
depend GPU
depend USER-OMP
fi
if (test $1 = "DIPOLE") then
depend USER-MISC
depend USER-OMP
fi
if (test $1 = "GRANULAR") then
depend USER-CUDA $2
depend USER-OMP $2
depend USER-CUDA
depend USER-OMP
fi
if (test $1 = "KSPACE") then
depend GPU $2
depend OPT $2
depend USER-CUDA $2
depend USER-OMP $2
depend GPU
depend OPT
depend USER-CUDA
depend USER-OMP
fi
if (test $1 = "MANYBODY") then
depend GPU $2
depend OPT $2
depend USER-CUDA $2
depend USER-MISC $2
depend USER-OMP $2
depend GPU
depend OPT
depend USER-CUDA
depend USER-MISC
depend USER-OMP
fi
if (test $1 = "MOLECULE") then
depend GPU
depend USER-CUDA
depend USER-MISC
depend USER-OMP
fi
if (test $1 = "PERI") then
depend USER-OMP $2
depend USER-OMP
fi
if (test $1 = "RIGID") then
depend USER-OMP $2
depend USER-OMP
fi
if (test $1 = "USER-CG-CMM") then
depend GPU $2
depend USER-CUDA $2
depend USER-OMP $2
depend GPU
depend USER-CUDA
depend USER-OMP
fi
if (test $1 = "USER-MISC") then
depend GPU $2
depend USER-OMP $2
depend GPU
depend USER-OMP
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -19,7 +19,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -22,7 +22,7 @@ if (test $2 = "status") then
for file in *.cpp *.h; do
if (test ! -e ../$file) then
echo " src/$file does not exist"
elif (test "`diff --brief $file ../$file`" != "") then
elif (! cmp -s $file ../$file) then
echo " src/$file and $1/$file are different"
fi
done
@ -36,14 +36,14 @@ if (test $2 = "status") then
elif (test $2 = "update") then
echo "Updating src files from $1 package files"
if (test $installed = 1) then
echo " re-installing package $1"
echo " updating package $1"
if (test -e Install.sh) then
/bin/sh Install.sh 1
/bin/sh Install.sh 2
else
/bin/sh ../Install.sh 1
/bin/sh ../Install.sh 2
fi
cd ..
/bin/sh Depend.sh $1 1
/bin/sh Depend.sh $1
else
echo " $1 package is not installed"
fi
@ -57,7 +57,7 @@ elif (test $2 = "overwrite") then
for file in *.cpp *.h; do
if (test ! -e ../$file) then
continue
elif (test "`diff --brief $file ../$file`" != "") then
elif (! cmp -s $file ../$file) then
echo " overwriting $1/$file"
cp ../$file .
fi
@ -76,7 +76,7 @@ elif (test $2 = "diff") then
for file in *.cpp *.h; do
if (test ! -e ../$file) then
echo " src/$file does not exist"
elif (test "`diff --brief $file ../$file`" != "") then
elif (! cmp -s $file ../$file) then
echo "************************************************"
echo "diff $1/$file src/$file "
echo "************************************************"

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -15,72 +15,22 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test ! -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi
fi
}
# list of files with optional dependencies
# all package files
# only a few files have dependencies
action angle_cosine_shift.cpp
action angle_cosine_shift.h
action angle_cosine_shift_exp.cpp
action angle_cosine_shift_exp.h
action angle_dipole.cpp
action angle_dipole.h
action angle_fourier.cpp
action angle_fourier.h
action angle_fourier_simple.cpp
action angle_fourier_simple.h
action angle_quartic.cpp
action angle_quartic.h
action bond_harmonic_shift.cpp
action bond_harmonic_shift.h
action bond_harmonic_shift_cut.cpp
action bond_harmonic_shift_cut.h
action compute_ackland_atom.cpp
action compute_ackland_atom.h
action compute_temp_rotate.cpp
action compute_temp_rotate.h
action dihedral_cosine_shift_exp.cpp
action dihedral_cosine_shift_exp.h
action dihedral_fourier.cpp
action dihedral_fourier.h
action dihedral_nharmonic.cpp
action dihedral_nharmonic.h
action dihedral_quadratic.cpp
action dihedral_quadratic.h
action dihedral_table.cpp
action dihedral_table.h
action fix_addtorque.cpp
action fix_addtorque.h
action fix_imd.cpp
action fix_imd.h
action fix_smd.cpp
action fix_smd.h
action improper_cossq.cpp
action improper_cossq.h
action improper_fourier.cpp
action improper_fourier.h
action improper_ring.cpp
action improper_ring.h
for file in *.cpp *.h; do
if (test $file = "pair_cdeam.cpp") then
action pair_cdeam.cpp pair_eam_alloy.cpp
elif (test $file = "pair_cdeam.h") then
action pair_cdeam.h pair_eam_alloy.cpp
action pair_coul_diel.cpp
action pair_coul_diel.h
action pair_dipole_sf.cpp
action pair_dipole_sf.h
action pair_edip.cpp
action pair_edip.h
action pair_gauss_cut.cpp
action pair_gauss_cut.h
action pair_lj_sf.cpp
action pair_lj_sf.h
action pair_meam_spline.cpp
action pair_meam_spline.h
action pair_meam_sw_spline.cpp
action pair_meam_sw_spline.h
action pair_tersoff_table.cpp
action pair_tersoff_table.h
else
action $file
fi
done

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi

View File

@ -1,26 +1,50 @@
# Install/unInstall package files in LAMMPS
# mode = 0/1/2 for uninstall/install/update
mode=$1
# arg1 = file, arg2 = file it depends on
action () {
if (test $mode = 0) then
rm -f ../$1
elif (! cmp -s $1 ../$1) then
if (test -z "$2" || test -e ../$2) then
cp $1 ..
if (test $mode = 2) then
echo " updating src/$1"
fi
fi
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi
fi
}
# step 1: process all *_omp.cpp and *_omp.h files.
# do not install child files if parent does not exist
for file in *_omp.cpp *_omp.h ; do
ofile=`echo $file | sed -e 's,\(.*\)_omp\.h,\1.h,' -e 's,\(.*\)_omp\.cpp,\1.cpp,'`
if (test $1 = 1) then
if (test $file = "thr_omp.h") || (test $file = "thr_omp.cpp") then
: # always install those files.
elif (test ! -e ../$ofile) then
continue
fi
cp $file ..
elif (test $1 = 0) then
rm -f ../$file
fi
for file in *_omp.cpp; do
test $file = thr_omp.cpp && continue
dep=${file%_omp.cpp}.cpp
action $file $dep
done
for file in *_omp.h; do
test $file = thr_omp.h && continue
dep=${file%_omp.h}.h
action $file $dep
done
action thr_omp.h
action thr_omp.cpp
action thr_data.h
action thr_data.cpp
# step 2: handle cases and tasks not handled in step 1.
if (test $1 = 1) then
if (test $mode = 1) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package
@ -31,10 +55,7 @@ if (test $1 = 1) then
touch ../accelerator_omp.h
cp thr_data.h ..
cp thr_data.cpp ..
elif (test $1 = 0) then
elif (test $mode = 0) then
if (test -e ../Makefile.package) then
sed -i -e 's/[^ \t]*OMP[^ \t]* //' ../Makefile.package
@ -44,7 +65,4 @@ elif (test $1 = 0) then
touch ../accelerator_omp.h
rm -f ../thr_data.h
rm -f ../thr_data.cpp
fi

View File

@ -1,40 +0,0 @@
# Update package files in LAMMPS
# Copy package file to src if it doesn't exists or is different.
# But only copy the file, if a non-OpenMP version exists and
# remove OpenMP versions that have no matching serial file
# installed, e.g. after a package has been removed.
for file in *_omp.cpp *_omp.h ; do
# these are special cases and handled below
if (test $file = "thr_omp.h") || (test $file = "thr_omp.cpp") then
continue
fi
# derive name of non-OpenMP version
ofile=`echo $file | sed -e 's,\(.*\)_omp\.h,\1.h,' -e 's,\(.*\)_omp\.cpp,\1.cpp,'`
if (test ! -e ../$ofile) then
if (test -e ../$file) then
echo " removing src/$file"
rm -f ../$file
fi
else
if (test ! -e ../$file) then
echo " creating src/$file"
cp $file ..
elif ! cmp -s $file ../$file ; then
echo " updating src/$file"
cp $file ..
fi
fi
done
# special case for files not covered by the automatic script above
for file in thr_data.h thr_data.cpp thr_omp.h thr_omp.cpp; do
if (test ! -e ../$file) then
echo " creating src/$file"
cp $file ..
elif ! cmp -s $file ../$file ; then
echo " updating src/$file"
cp $file ..
fi
done

View File

@ -15,7 +15,7 @@ action () {
echo " updating src/$1"
fi
fi
elif (test ! -z "$2") then
elif (test -n "$2") then
if (test ! -e ../$2) then
rm -f ../$1
fi