#!/usr/bin/make -f # # build script for GROMACS # # Including "parallel" in DEB_BUILD_OPTIONS will increase the make concurrency # to 4, which should speed builds on multi-core or multi-CPU systems. # # export DH_VERBOSE=1 # debhelper compatibility version set to 5 in debian/compat DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) # OpenMPI is only supported on a subset of architectures at this time. # This list should remain synced with the Build-Depends and the Architecture # line of gromacs-openmpi in debian/control. OPENMPI_ARCH = alpha amd64 i386 ia64 powerpc kfreebsd-i386 kfreebsd-amd64 hurd-i386 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) COMMON_CONFIG_PARAMS = --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --exec_prefix=/usr --datadir=\$${prefix}/share --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-shared ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 endif # optional parallel build ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS))) MAKE += -j4 endif # gfortran transition: configure script looks for f77/g77 binaries, not f95/g95/gfortran # FORTRAN inner loops are used on Alpha only ifneq (,$(findstring alpha,$(DEB_HOST_GNU_TYPE))) export F77=/usr/bin/gfortran endif build-basic: patch-stamp # #################################################################### # the core gromacs package and standard (single-precision FP) binaries # #################################################################### dh_testdir [ ! -f Makefile ] || $(MAKE) clean ./configure $(COMMON_CONFIG_PARAMS) $(MAKE) $(MAKE) install prefix=$(CURDIR)/debian/gromacs/usr exec_prefix=$(CURDIR)/debian/gromacs/usr # extraneous man page, no longer associated with a binary # (and it needs to be removed lest it conflict with mono-mcs) rm $(CURDIR)/debian/gromacs/usr/share/man/man1/disco.1 # rename ffscan to avoid a namespace conflict with fortools package mv $(CURDIR)/debian/gromacs/usr/bin/ffscan $(CURDIR)/debian/gromacs/usr/bin/g_ffscan sed -e 's/ffscan/g_ffscan/g' $(CURDIR)/debian/gromacs/usr/share/man/man1/ffscan.1 > $(CURDIR)/debian/gromacs/usr/share/man/man1/g_ffscan.1 && \ rm $(CURDIR)/debian/gromacs/usr/share/man/man1/ffscan.1 # ################################# # compile double-precision binaries # ################################# ./configure $(COMMON_CONFIG_PARAMS) --enable-double $(MAKE) $(MAKE) install prefix=$(CURDIR)/debian/gromacs/usr exec_prefix=$(CURDIR)/debian/gromacs/usr rm $(CURDIR)/debian/gromacs/usr/share/man/man1/*_d.1 for manpage in $(CURDIR)/debian/gromacs/usr/share/man/man1/*.1; \ do ln -sf `basename $${manpage}` $(CURDIR)/debian/gromacs/usr/share/man/man1/`basename $${manpage} .1`_d.1 ;\ done # documentation is moved out of the way later, in the build-doc target dh_installdirs -pgromacs # three lintian warnings are overridden: # - package-name-doesnt-match-sonames: the libraries are private to # GROMACS, and it's unlikely that any new package will start using # them; therefore, separate lib packages would just be bloat. # This is also overridden for the -lam, -mpich, -openmpi packages. # - binary-without-manpage: manpages are in the gromacs-doc package # instead. This is also overridden for linda. # - shlib-with-executable-stack: it's a side effect of the ASM inner # loops (i386/amd64 only) cp $(CURDIR)/debian/lintian-overrides.gromacs $(CURDIR)/debian/gromacs/usr/share/lintian/overrides/gromacs cp $(CURDIR)/debian/linda-overrides.gromacs $(CURDIR)/debian/gromacs/usr/share/linda/overrides/gromacs # #################################################### # the following section is for the gromacs-doc package # #################################################### dh_installdirs -pgromacs-doc ln -sf gromacs debian/gromacs-doc/usr/share/doc/gromacs-doc mv $(CURDIR)/debian/gromacs/usr/share/man $(CURDIR)/debian/gromacs-doc/usr/share/man # some of the default installation directories for documentation and # example shell scripts are not FHS-friendly; move them appropriately mv $(CURDIR)/debian/gromacs/usr/bin/GMXRC* $(CURDIR)/debian/gromacs/usr/bin/completion* $(CURDIR)/debian/gromacs-doc/usr/share/gromacs/shell-specific chmod 644 $(CURDIR)/debian/gromacs-doc/usr/share/gromacs/shell-specific/* mv $(CURDIR)/debian/gromacs/usr/share/gromacs/tutor $(CURDIR)/debian/gromacs-doc/usr/share/gromacs/tutor mv $(CURDIR)/debian/gromacs/usr/share/gromacs/html $(CURDIR)/debian/gromacs-doc/usr/share/doc/gromacs/html uudecode -o $(CURDIR)/debian/gromacs-doc/usr/share/doc/gromacs/manual.pdf < $(CURDIR)/debian/man/manual.pdf.uue # one lintian warnings is overridden: # - csh-considered-harmful: from a pair of tutorial scripts, not essential for routine package operation cp $(CURDIR)/debian/lintian-overrides.gromacs-doc $(CURDIR)/debian/gromacs-doc/usr/share/lintian/overrides/gromacs-doc touch build-basic build-dev: build-basic build-lam build-mpich build-openmpi patch-stamp dh_testdir dh_installdirs -pgromacs-dev ln -sf gromacs debian/gromacs-dev/usr/share/doc/gromacs-dev mv $(CURDIR)/debian/gromacs/usr/include $(CURDIR)/debian/gromacs-dev/usr/include # catch normal libraries plus all applicable MPI variants mv $(CURDIR)/debian/gromacs/usr/lib/*.so $(CURDIR)/debian/gromacs/usr/lib/*.a $(CURDIR)/debian/gromacs/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib mv $(CURDIR)/debian/gromacs-lam/usr/lib/*.so $(CURDIR)/debian/gromacs-lam/usr/lib/*.a $(CURDIR)/debian/gromacs-lam/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib mv $(CURDIR)/debian/gromacs-mpich/usr/lib/*.so $(CURDIR)/debian/gromacs-mpich/usr/lib/*.a $(CURDIR)/debian/gromacs-mpich/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) mv $(CURDIR)/debian/gromacs-openmpi/usr/lib/*.so $(CURDIR)/debian/gromacs-openmpi/usr/lib/*.a $(CURDIR)/debian/gromacs-openmpi/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib endif mv $(CURDIR)/debian/gromacs/usr/share/gromacs/template $(CURDIR)/debian/gromacs-dev/usr/share/gromacs/template touch build-dev build-lam: patch-stamp # ############################################## # LAM-MPI enabled build (mdrun & libraries only) # ############################################## dh_testdir [ ! -f Makefile ] || $(MAKE) clean ./configure $(COMMON_CONFIG_PARAMS) --enable-mpi --disable-nice --without-x --program-suffix=_mpi.lam --enable-mpi-libsuffix=lam MPICC=mpicc.lam $(MAKE) mdrun MPICC=/usr/bin/mpicc.lam CC=/usr/bin/mpicc.lam dh_installdirs -pgromacs-lam $(MAKE) install-mdrun prefix=$(CURDIR)/debian/gromacs-lam/usr exec_prefix=$(CURDIR)/debian/gromacs-lam/usr gzip -c9 debian/man/mdrun_mpi.lam.1 > $(CURDIR)/debian/gromacs-lam/usr/share/man/man1/mdrun_mpi.lam.1.gz sed -e 's/#MPIABBR#/lam/g' < debian/gromacs-parallel.README.Debian.in | sed -e 's/#MPIPROG#/LAM-MPI/g' > debian/gromacs-lam.README.Debian cp $(CURDIR)/debian/lintian-overrides.gromacs-lam $(CURDIR)/debian/gromacs-lam/usr/share/lintian/overrides/gromacs-lam # ################################# # LAM-MPI build in double precision # ################################# ./configure $(COMMON_CONFIG_PARAMS) --enable-mpi --disable-nice --without-x --program-suffix=_mpi_d.lam --enable-mpi-libsuffix=lam MPICC=mpicc.lam --enable-double $(MAKE) mdrun MPICC=/usr/bin/mpicc.lam CC=/usr/bin/mpicc.lam $(MAKE) install-mdrun prefix=$(CURDIR)/debian/gromacs-lam/usr exec_prefix=$(CURDIR)/debian/gromacs-lam/usr ln -sf mdrun_mpi.lam.1.gz $(CURDIR)/debian/gromacs-lam/usr/share/man/man1/mdrun_mpi_d.lam.1.gz touch build-lam build-mpich: patch-stamp # ############################################ # MPICH enabled build (mdrun & libraries only) # ############################################ dh_testdir [ ! -f Makefile ] || $(MAKE) clean # NOTE: As a result of the patch in Debian bug#164359, MPICH's mpicc # will compile .s files, and therefore configure will work correctly # without bizarre workarounds. If, for whatever reason, you aren't # using the Debian MPICH packages, you may need to append the # following to the ./configure line: # MPICC=gcc LIBS=-lmpich CPPFLAGS=-I/usr/lib/mpich/include LDFLAGS=-L/usr/lib/mpich/lib/shared # (Thanks to Junichi Uekawa for help resolving the bug.) # ./configure $(COMMON_CONFIG_PARAMS) --enable-mpi --disable-nice --without-x --program-suffix=_mpi.mpich --enable-mpi-libsuffix=mpich MPICC=mpicc.mpich $(MAKE) mdrun MPICC=/usr/bin/mpicc.mpich CC=/usr/bin/mpicc.mpich LIBSUFFIX=_mpi_mpich dh_installdirs -pgromacs-mpich $(MAKE) install-mdrun prefix=$(CURDIR)/debian/gromacs-mpich/usr exec_prefix=$(CURDIR)/debian/gromacs-mpich/usr gzip -c9 debian/man/mdrun_mpi.mpich.1 > $(CURDIR)/debian/gromacs-mpich/usr/share/man/man1/mdrun_mpi.mpich.1.gz sed -e 's/#MPIABBR#/mpich/g' < debian/gromacs-parallel.README.Debian.in | sed -e 's/#MPIPROG#/MPICH/g' > debian/gromacs-mpich.README.Debian cp $(CURDIR)/debian/lintian-overrides.gromacs-mpich $(CURDIR)/debian/gromacs-mpich/usr/share/lintian/overrides/gromacs-mpich # ############################### # MPICH build in double precision # ############################### ./configure $(COMMON_CONFIG_PARAMS) --enable-mpi --disable-nice --without-x --program-suffix=_mpi_d.mpich --enable-mpi-libsuffix=mpich MPICC=mpicc.mpich --enable-double $(MAKE) mdrun MPICC=/usr/bin/mpicc.mpich CC=/usr/bin/mpicc.mpich LIBSUFFIX=_mpi_mpich $(MAKE) install-mdrun prefix=$(CURDIR)/debian/gromacs-mpich/usr exec_prefix=$(CURDIR)/debian/gromacs-mpich/usr ln -sf mdrun_mpi.mpich.1.gz $(CURDIR)/debian/gromacs-mpich/usr/share/man/man1/mdrun_mpi_d.mpich.1.gz touch build-mpich build-openmpi: patch-stamp # Wrap this entire section in a test against OpenMPI's supported # platforms. ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) # ############################################## # OpenMPI enabled build (mdrun & libraries only) # ############################################## dh_testdir [ ! -f Makefile ] || $(MAKE) clean ./configure $(COMMON_CONFIG_PARAMS) --enable-mpi --disable-nice --without-x --disable-fortran --program-suffix=_mpi.openmpi --enable-mpi-libsuffix=openmpi MPICC=mpicc.openmpi $(MAKE) mdrun MPICC=/usr/bin/mpicc.openmpi CC=/usr/bin/mpicc.openmpi dh_installdirs -pgromacs-openmpi $(MAKE) install-mdrun prefix=$(CURDIR)/debian/gromacs-openmpi/usr exec_prefix=$(CURDIR)/debian/gromacs-openmpi/usr gzip -c9 debian/man/mdrun_mpi.openmpi.1 > $(CURDIR)/debian/gromacs-openmpi/usr/share/man/man1/mdrun_mpi.openmpi.1.gz sed -e 's/#MPIABBR#/openmpi/g' < debian/gromacs-parallel.README.Debian.in | sed -e 's/#MPIPROG#/OpenMPI/g' > debian/gromacs-openmpi.README.Debian cp $(CURDIR)/debian/lintian-overrides.gromacs-openmpi $(CURDIR)/debian/gromacs-openmpi/usr/share/lintian/overrides/gromacs-openmpi # ################################# # OpenMPI build in double precision # ################################# ./configure $(COMMON_CONFIG_PARAMS) --enable-mpi --disable-nice --without-x --disable-fortran --program-suffix=_mpi_d.openmpi --enable-mpi-libsuffix=openmpi MPICC=mpicc.openmpi --enable-double $(MAKE) mdrun MPICC=/usr/bin/mpicc.openmpi CC=/usr/bin/mpicc.openmpi $(MAKE) install-mdrun prefix=$(CURDIR)/debian/gromacs-openmpi/usr exec_prefix=$(CURDIR)/debian/gromacs-openmpi/usr ln -sf mdrun_mpi.openmpi.1.gz $(CURDIR)/debian/gromacs-openmpi/usr/share/man/man1/mdrun_mpi_d.openmpi.1.gz endif touch build-openmpi # Various and sundry Debian patches are managed by dpatch(1). patch: patch-stamp patch-stamp: dpatch apply-all dpatch status-all touch patch-stamp build: patch build-stamp build-stamp: build-basic build-dev build-mpich build-lam build-openmpi touch build-stamp clean: clean-patched unpatch clean-patched: dh_testdir dh_testroot rm -f build-basic build-dev build-mpich build-lam build-openmpi build-stamp rm -f debian/gromacs-lam.README.Debian debian/gromacs-mpich.README.Debian debian/gromacs-openmpi.README.Debian [ ! -f Makefile ] || $(MAKE) clean [ ! -f Makefile ] || $(MAKE) distclean dh_clean unpatch: dpatch deapply-all rm -rf patch-stamp debian/patched binary-indep: build-basic dh_testdir dh_testroot dh_installman debian/man/luck.1 debian/man/gromacs.7 debian/man/average.1 debian/man/g_nmtraj.1 -p gromacs-doc # install doc-base file from gromacs-doc and generate postinst/postrm, # but don't install a duplicate copyright file. all other files are # moved into place in the build-basic target. dh_installdocs -p gromacs-doc -X copyright dh_compress -i -X.pdf dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary-arch: build dh_testdir -s dh_testroot -s dh_installchangelogs -s dh_installdocs -s dh_strip -A dh_link -s dh_compress -s -X.pdf dh_fixperms -s dh_installdeb -s dh_makeshlibs -s dh_shlibdeps -p gromacs -L gromacs -l debian/gromacs/usr/lib dh_shlibdeps -p gromacs-lam -L gromacs-lam -l debian/gromacs-lam/usr/lib dh_shlibdeps -p gromacs-mpich -L gromacs-mpich -l debian/gromacs-mpich/usr/lib ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) dh_shlibdeps -p gromacs-openmpi -L gromacs-openmpi -l debian/gromacs-openmpi/usr/lib endif dh_gencontrol -s dh_installdeb -s dh_md5sums -s dh_builddeb -s binary: binary-indep binary-arch .PHONY: patch clean clean-patched unpatch binary-indep binary-arch binary build # Because multiple versions of the same programs are created using the same source tree, # the various build-* targets can't be compiled simultaneously. # Passing down -j# to child make processes remains unaffected. .NOTPARALLEL: