change purge target in Makefile, also fixed one issue with Make.py
This commit is contained in:
70
src/Make.py
70
src/Make.py
@ -26,7 +26,8 @@ libclasses = ("atc","awpmd","colvars","cuda","gpu","h5md",
|
||||
buildclasses = ("intel","kokkos")
|
||||
makeclasses = ("cc","flags","mpi","fft","jpg","png")
|
||||
|
||||
setargs = ("gzip","#gzip","ffmpeg","#ffmpeg","smallbig","bigbig","smallsmall","exceptions","#exceptions")
|
||||
setargs = ("gzip","#gzip","ffmpeg","#ffmpeg","smallbig","bigbig",
|
||||
"smallsmall","exceptions","#exceptions")
|
||||
actionargs = ("lib-all","file","clean","exe")
|
||||
|
||||
gpubuildflag = 0
|
||||
@ -85,7 +86,8 @@ def switch2str(switches,switch_order):
|
||||
def compile_check(compiler,ccflags,warn):
|
||||
open("tmpauto.cpp",'w').write("int main(int, char **) {}\n")
|
||||
tmp = "%s %s -c tmpauto.cpp" % (compiler,ccflags)
|
||||
try: txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
|
||||
try: txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,
|
||||
shell=True).decode()
|
||||
except subprocess.CalledProcessError as e: txt = e.output
|
||||
flag = 1
|
||||
if txt or not os.path.isfile("tmpauto.o"):
|
||||
@ -105,7 +107,8 @@ def compile_check(compiler,ccflags,warn):
|
||||
def link_check(linker,linkflags,libs,warn):
|
||||
open("tmpauto.cpp",'w').write("int main(int, char **) {}\n")
|
||||
tmp = "%s %s -o tmpauto tmpauto.cpp %s" % (linker,linkflags,libs)
|
||||
try: txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
|
||||
try: txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,
|
||||
shell=True).decode()
|
||||
except subprocess.CalledProcessError as e: txt = e.output
|
||||
flag = 1
|
||||
if txt or not os.path.isfile("tmpauto"):
|
||||
@ -532,7 +535,8 @@ class Actions(object):
|
||||
|
||||
if caller == "file" or "file" not in self.alist:
|
||||
# make certain that 'MAKE/MINE' folder exists.
|
||||
subprocess.check_output("mkdir -p %s/MAKE/MINE" % dir.src,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("mkdir -p %s/MAKE/MINE" % dir.src,
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
make.write("%s/MAKE/MINE/Makefile.auto" % dir.src,1)
|
||||
print("Created src/MAKE/MINE/Makefile.auto")
|
||||
|
||||
@ -859,9 +863,12 @@ class Packages(object):
|
||||
if self.plist: print("Installing packages ...")
|
||||
for one in self.plist:
|
||||
if one == "orig": continue
|
||||
subprocess.check_output("cd %s; make %s" % (dir.src,one),stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make %s" % (dir.src,one),
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
if self.plist and verbose:
|
||||
txt = subprocess.check_output("cd %s; make ps" % dir.src,stderr=subprocess.STDOUT,shell=True).decode()
|
||||
txt = subprocess.check_output("cd %s; make ps" % dir.src,
|
||||
stderr=subprocess.STDOUT,
|
||||
shell=True).decode()
|
||||
print("Package status after installation:")
|
||||
print(txt)
|
||||
|
||||
@ -871,12 +878,16 @@ class Packages(object):
|
||||
def uninstall(self):
|
||||
if not self.plist or self.plist[-1] != "orig": return
|
||||
print("Restoring packages to original state ...")
|
||||
subprocess.check_output("cd %s; make no-all" % dir.src,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make no-all" % dir.src,
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
for one in self.all:
|
||||
if self.original[one]:
|
||||
subprocess.check_output("cd %s; make yes-%s" % (dir.src,one),stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make yes-%s" % (dir.src,one),
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
if verbose:
|
||||
txt = subprocess.check_output("cd %s; make ps" % dir.src,stderr=subprocess.STDOUT,shell=True).decode()
|
||||
txt = subprocess.check_output("cd %s; make ps" % dir.src,
|
||||
stderr=subprocess.STDOUT,
|
||||
shell=True).decode()
|
||||
print("Restored package status:")
|
||||
print(txt)
|
||||
|
||||
@ -970,7 +981,8 @@ class Settings(object):
|
||||
def help(self):
|
||||
return """
|
||||
-s set1 set2 ...
|
||||
possible settings = gzip #gzip ffmpeg #ffmpeg smallbig bigbig smallsmall exceptions #exceptions
|
||||
possible settings = gzip #gzip ffmpeg #ffmpeg
|
||||
smallbig bigbig smallsmall exceptions #exceptions
|
||||
alter LAMMPS ifdef settings in Makefile.auto
|
||||
only happens if new Makefile.auto is created by use of "file" action
|
||||
gzip and #gzip turn on/off LAMMPS_GZIP setting
|
||||
@ -1059,7 +1071,8 @@ class ATC(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" %
|
||||
libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
|
||||
else: txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1110,7 +1123,8 @@ class AWPMD(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" %
|
||||
libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
|
||||
else: txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1161,7 +1175,8 @@ class COLVARS(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" %
|
||||
libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
|
||||
else: txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1213,7 +1228,8 @@ class CUDA(object):
|
||||
|
||||
def build(self):
|
||||
libdir = dir.lib + "/cuda"
|
||||
subprocess.check_output("cd %s; make clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make clean" % libdir,
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
if self.mode == "double": n = 2
|
||||
elif self.mode == "mixed": n = 3
|
||||
elif self.mode == "single": n = 1
|
||||
@ -1308,7 +1324,8 @@ class GPU(object):
|
||||
make = "make"
|
||||
if "shannon" == platform.node(): make = "srun make"
|
||||
|
||||
subprocess.check_output("cd %s; %s -f Makefile.auto clean" % (libdir,make),stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; %s -f Makefile.auto clean" %
|
||||
(libdir,make),stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; %s -j %d -f Makefile.auto" % (libdir,make,jmake.n)
|
||||
else: txt = "cd %s; %s -f Makefile.auto" % (libdir,make)
|
||||
|
||||
@ -1359,7 +1376,8 @@ class H5MD(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make clean" % libdir,
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
txt = "cd %s; make" % libdir
|
||||
|
||||
# if verbose, print output as build proceeds, else only print if fails
|
||||
@ -1409,7 +1427,8 @@ class MEAM(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" %
|
||||
libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
# do not use -j for MEAM build, parallel build does not work
|
||||
txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1460,7 +1479,8 @@ class POEMS(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,
|
||||
stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
|
||||
else: txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1506,9 +1526,10 @@ class PYTHON(object):
|
||||
libdir = dir.lib + "/python"
|
||||
if self.lammpsflag:
|
||||
subprocess.check_output("cd %s; cp Makefile.lammps.%s Makefile.lammps" %
|
||||
(libdir,self.lammps))
|
||||
(libdir,self.lammps))
|
||||
if not os.path.isfile("%s/Makefile.lammps.%s" % (libdir,self.lammps)):
|
||||
error("Unsuccessful creation of lib/python/Makefile.lammps.%s file" % self.lammps)
|
||||
error("Unsuccessful creation of lib/python/Makefile.lammps.%s file" %
|
||||
self.lammps)
|
||||
else: print("Created lib/python/Makefile.lammps file")
|
||||
|
||||
# QMMM lib
|
||||
@ -1546,7 +1567,8 @@ class QMMM(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" % libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
subprocess.check_output("cd %s; make -f Makefile.auto clean" %
|
||||
libdir,stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
|
||||
else: txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1597,7 +1619,8 @@ class REAX(object):
|
||||
make.setvar("EXTRAMAKE","Makefile.lammps.%s" % self.lammps)
|
||||
make.write("%s/Makefile.auto" % libdir)
|
||||
|
||||
commands.getoutput("cd %s; make -f Makefile.auto clean" % libdir)
|
||||
cmd = "cd %s; make -f Makefile.auto clean" % libdir
|
||||
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
|
||||
if jmake: txt = "cd %s; make -j %d -f Makefile.auto" % (libdir,jmake.n)
|
||||
else: txt = "cd %s; make -f Makefile.auto" % libdir
|
||||
|
||||
@ -1643,7 +1666,8 @@ class VORONOI(object):
|
||||
if not self.install: return
|
||||
libdir = dir.lib + "/voronoi"
|
||||
cmd = "cd %s; python install.py %s" % (libdir,self.install)
|
||||
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True).decode()
|
||||
txt = subprocess.check_output(cmd,stderr=subprocess.STDOUT,
|
||||
shell=True).decode()
|
||||
if verbose: print(txt)
|
||||
print("Created lib/voronoi library")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user