#!/usr/bin/make -f # -*- makefile -*- #export DH_VERBOSE=1 DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ifneq (,$(filter checkall,$(DEB_BUILD_OPTIONS))) export RUN_ALL_TESTS ="yes" endif include /usr/share/mpi-default-dev/debian_defaults ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) else NUMJOBS = 1 endif # generic debian package builds don't use chip-specific optimisations # e.g. don't use i786 instructions in the i386 build export USE_HWOPT=n ifeq ($(DEB_HOST_ARCH_BITS),64) export NWCHEM_TARGET=LINUX64 export USE_64TO32="yes" else export NWCHEM_TARGET=LINUX endif export BLAS_SIZE=4 export BLAS_LIB="-lblas" export LAPACK_LIB="-llapack" export USE_SCALAPACK="yes" export SCALAPACK_SIZE=4 export NWCHEM_MODULES="pnnl" export NWCHEM_LONG_PATHS="y" export PYTHONVERSION=$(shell py3versions -dv) export PYTHONHOME=$(shell python3-config --prefix) export LARGE_FILES=TRUE export FC=gfortran export USE_MPI="y" export USE_MPIF="y" export USE_MPIF4="y" export MPI_LIB=/usr/lib LIBMPI_MPICH="$(shell for w in `mpifort.mpich -show`; do if [ "x$${w%$${w#??}}" = "x-L" -o "x$${w%$${w#??}}" = "x-l" ]; then echo -n "$$w "; fi; done)" LIBMPI_OPENMPI="$(shell pkg-config ompi-fort --libs)" ifneq (,$(filter ccsdtq,$(DEB_BUILD_OPTIONS))) export CCSDTQ="yes" endif ifneq (,$(filter ccsdtlr,$(DEB_BUILD_OPTIONS))) export CCSDTLR="yes" endif export MRCC_METHODS=y export IPCCSD=y export EACCSD=y export HAS_BLAS="yes" export BLASOPT=-lblas -llapack export ARMCI_NETWORK=SOCKETS export USE_ARUR="yes" %: dh $@ --with python3 execute_before_dh_auto_configure: rm -rf $(CURDIR)/pristine-src $(CURDIR)/build-mpich $(CURDIR)/build-openmpi tmpdir=`mktemp -d`; \ cp -ra $(CURDIR)/* $${tmpdir}; \ cp debian/dftd3/dftd3.tgz $${tmpdir}/src/nwpw/nwpwlib/nwpwxc; \ mv $$tmpdir $(CURDIR)/pristine-src cp -ra pristine-src build-mpich cp -ra pristine-src build-openmpi override_dh_auto_build-arch: set -e; \ for mpi_flavor in mpich openmpi; do \ if [ "x$${mpi_flavor}" = "xmpich" ]; then \ export LIBMPI=$"$(LIBMPI_MPICH)$"; \ export LDFLAGS="$${LDFLAGS} -pthread"; \ else \ export LIBMPI=$"$(LIBMPI_OPENMPI)$"; \ fi; \ echo "building nwchem against $${mpi_flavor}"; \ echo "using LIBMPI=$${LIBMPI}"; \ export NWCHEM_TOP=$(CURDIR)/build-$${mpi_flavor}; \ export MPICC=mpicc.$${mpi_flavor}; \ export MPICXX=mpicxx.$${mpi_flavor}; \ export MPIF77=mpif77.$${mpi_flavor}; \ export MPIFC=mpifort.$${mpi_flavor}; \ export MPIF90=mpif90.$${mpi_flavor}; \ export MPI_INCLUDE=/usr/include/$(DEB_HOST_MULTIARCH)/$${mpi_flavor}; \ export MPIRUN_PATH=/usr/bin/mpirun.$${mpi_flavor}; \ export SCALAPACK=-lscalapack-$${mpi_flavor}; \ export BLACS=-lscalapack-$${mpi_flavor}; \ export EXTERNAL_GA_PATH=/usr/lib/$(DEB_HOST_MULTIARCH)/ga/$${mpi_flavor}; \ export GA_INCLUDE_PATH=/usr; \ export LIBDIR=$${NWCHEM_TOP}/lib/$(NWCHEM_TARGET); \ mkdir -p $${NWCHEM_TOP}/bin/$${NWCHEM_TARGET}; \ (cd $${NWCHEM_TOP}/src && NWCHEM_TOP=$${NWCHEM_TOP} make -j $(NUMJOBS) nwchem_config); \ if [ "x$(DEB_HOST_ARCH_BITS)" = "x64" ]; then \ (cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS) 64_to_32) ; \ find $${NWCHEM_TOP}/src -name include_stamp | xargs rm -f; \ find $${NWCHEM_TOP}/src -name dependencies | xargs rm -f; \ fi; \ (cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS)); \ (cd $${NWCHEM_TOP}/src/util && make -j $(NUMJOBS)); \ (cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS) link); \ if [ "x$(DEB_HOST_ARCH_BITS)" = "x64" ]; then \ (cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS) 32_to_64); \ fi; \ cp $${NWCHEM_TOP}/bin/$(NWCHEM_TARGET)/nwchem $${NWCHEM_TOP}/bin/$(NWCHEM_TARGET)/nwchem.$${mpi_flavor}; \ done override_dh_auto_clean: rm -rf $(CURDIR)/pristine-src $(CURDIR)/build-mpich $(CURDIR)/build-openmpi dh_testdir -(cd $(CURDIR)/src && make -j $(NUMJOBS) realclean) -(cd $(CURDIR)/doc && make -j $(NUMJOBS) realclean) rm -rf $(CURDIR)/bin $(CURDIR)/lib $(CURDIR)/src/tools/lib rm -rf $(CURDIR)/QA/scratchdir $(CURDIR)/QA/testoutputs rm -f src/util/util_version.F src/stubs.F src/util/util_module_avail.F src/util/util_nwchem_version.F find $(CURDIR) -name "*.stamp" | xargs rm -f dh_auto_clean rm -f src/config/NWCHEM_CONFIG src/config/nwchem_config.h override_dh_auto_test: dh_testdir -for mpi_flavor in mpich openmpi; do \ export NWCHEM_TOP=$(CURDIR)/build-$${mpi_flavor}; \ export NWCHEM_BASIS_LIBRARY=$${NWCHEM_TOP}/src/basis/libraries/; \ export NWCHEM_NWPW_LIBRARY=$${NWCHEM_TOP}/src/nwpw/libraryps/; \ export RUNTESTS=$${NWCHEM_TOP}/QA/runtests.mpi.unix; \ export NWCHEM_EXECUTABLE=$${NWCHEM_TOP}/bin/$(NWCHEM_TARGET)/nwchem}; \ (cd $(CURDIR)/build-$${mpi_flavor}/QA && if [ "$(RUN_ALL_TESTS)" = "yes" ]; then \ ../debian/testsuite all; else ../debian/testsuite; fi); \ done execute_after_dh_link: dh_link -pnwchem usr/bin/nwchem.$(ARCH_DEFAULT_MPI_IMPL) usr/bin/nwchem override_dh_gencontrol: dh_gencontrol -- -Vnwchem:Depends="nwchem-$(ARCH_DEFAULT_MPI_IMPL) | nwchem-mpich | nwchem-openmpi"