59 lines
1.2 KiB
Bash
Executable File
59 lines
1.2 KiB
Bash
Executable File
# Install/unInstall package files in LAMMPS
|
|
# mode = 0/1/2 for uninstall/install/update
|
|
|
|
mode=$1
|
|
|
|
# enforce using portable C locale
|
|
LC_ALL=C
|
|
export LC_ALL
|
|
|
|
# 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
|
|
}
|
|
|
|
# force rebuild of files with LMP_MPIIO switch
|
|
# also read/write restart so their dependence on changed mpiio.h is rebuilt
|
|
|
|
touch ../mpiio.h
|
|
touch ../read_restart.cpp
|
|
touch ../write_restart.cpp
|
|
|
|
# all package files with no dependencies
|
|
|
|
for file in *.cpp *.h; do
|
|
test -f ${file} && action $file
|
|
done
|
|
|
|
# edit 2 Makefile.package to include/exclude LMP_MPIIO setting
|
|
|
|
if (test $1 = 1) then
|
|
|
|
if (test -e ../Makefile.package) then
|
|
sed -i -e 's/[^ \t]*MPIIO[^ \t]* //' ../Makefile.package
|
|
sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_MPIIO |' ../Makefile.package
|
|
|
|
fi
|
|
|
|
elif (test $1 = 0) then
|
|
|
|
if (test -e ../Makefile.package) then
|
|
sed -i -e 's/[^ \t]*MPIIO[^ \t]* //' ../Makefile.package
|
|
fi
|
|
|
|
fi
|