#!/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 PACKAGE := gromacs include /usr/share/dpatch/dpatch.make 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) CFLAGS = ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g -Wall endif ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 endif COMMON_CONFIG_PARAMS = \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --exec_prefix=\$${prefix} \ --datadir=\$${prefix}/share \ --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info \ --enable-shared ifdef CFLAGS COMMON_CONFIG_PARAMS += CFLAGS="$(CFLAGS)" endif LAM_CONFIG_PARAMS = \ --enable-mpi \ --disable-nice \ --without-x \ LIBSUFFIX_ADD=lam \ MPICC=/usr/bin/mpicc.lam \ CC=/usr/bin/mpicc.lam MPICH_CONFIG_PARAMS = \ --enable-mpi \ --disable-nice \ --without-x \ LIBSUFFIX_ADD=mpich \ MPICC=/usr/bin/mpicc.mpich \ CC=/usr/bin/mpicc.mpich OPENMPI_CONFIG_PARAMS = \ --enable-mpi \ --disable-nice \ --disable-fortran \ --without-x \ LIBSUFFIX_ADD=openmpi \ MPICC=/usr/bin/mpicc.openmpi \ CC=/usr/bin/mpicc.openmpi # optional parallel build ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKE += -j$(NUMJOBS) 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 configure: patch-stamp configure-stamp configure-stamp: patch-stamp dh_testdir # patch 04_autoconf_mpisuffix changes configure.ac, requiring a fresh autotools pass aclocal && \ autoconf && \ automake1.10 # -dp is the place for double-precision builds (mkdir -p build/basic; cd build/basic; ../../configure $(COMMON_CONFIG_PARAMS)) (mkdir -p build/basic-dp; cd build/basic-dp; ../../configure $(COMMON_CONFIG_PARAMS) --enable-double) (mkdir -p build/lam; cd build/lam; ../../configure $(COMMON_CONFIG_PARAMS) $(LAM_CONFIG_PARAMS) --program-suffix=_mpi.lam) (mkdir -p build/lam-dp; cd build/lam-dp; ../../configure $(COMMON_CONFIG_PARAMS) $(LAM_CONFIG_PARAMS) --program-suffix=_mpi_d.lam --enable-double) (mkdir -p build/mpich; cd build/mpich; ../../configure $(COMMON_CONFIG_PARAMS) $(MPICH_CONFIG_PARAMS) --program-suffix=_mpi.mpich) (mkdir -p build/mpich-dp; cd build/mpich-dp; ../../configure $(COMMON_CONFIG_PARAMS) $(MPICH_CONFIG_PARAMS) --program-suffix=_mpi_d.mpich --enable-double) ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) (mkdir -p build/openmpi; cd build/openmpi; ../../configure $(COMMON_CONFIG_PARAMS) $(OPENMPI_CONFIG_PARAMS) --program-suffix=_mpi.openmpi) (mkdir -p build/openmpi-dp; cd build/openmpi-dp; ../../configure $(COMMON_CONFIG_PARAMS) $(OPENMPI_CONFIG_PARAMS) --program-suffix=_mpi_d.openmpi --enable-double) endif touch $@ build: patch-stamp configure-stamp build-basic build-lam build-mpich build-openmpi build-basic: configure-stamp dh_testdir $(MAKE) -C build/basic $(MAKE) -C build/basic-dp touch $@ build-lam: configure-stamp dh_testdir $(MAKE) -C build/lam mdrun $(MAKE) -C build/lam-dp mdrun sed -e 's/#MPIABBR#/lam/g' -e 's/#MPIPROG#/LAM-MPI/g' \ < debian/gromacs-parallel.README.Debian.in \ > debian/gromacs-lam.README.Debian touch $@ build-mpich: configure-stamp dh_testdir # 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.) $(MAKE) -C build/mpich mdrun $(MAKE) -C build/mpich-dp mdrun sed -e 's/#MPIABBR#/mpich/g' -e 's/#MPIPROG#/MPICH/g' \ < debian/gromacs-parallel.README.Debian.in \ > debian/gromacs-mpich.README.Debian touch $@ build-openmpi: configure-stamp dh_testdir ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) $(MAKE) -C build/openmpi mdrun $(MAKE) -C build/openmpi-dp mdrun sed -e 's/#MPIABBR#/openmpi/g' -e 's/#MPIPROG#/OpenMPI/g' \ < debian/gromacs-parallel.README.Debian.in \ > debian/gromacs-openmpi.README.Debian endif touch $@ clean: clean-patched unpatch clean-patched: dh_testdir dh_testroot rm -rf build dh_clean patch-stamp build-basic build-lam build-mpich build-openmpi configure-stamp \ debian/gromacs-lam.README.Debian debian/gromacs-mpich.README.Debian debian/gromacs-openmpi.README.Debian -test -r /usr/share/misc/config.sub && \ cp -f /usr/share/misc/config.sub config.sub -test -r /usr/share/misc/config.guess && \ cp -f /usr/share/misc/config.guess config.guess install: build install-basic install-lam install-mpich install-openmpi dh_testdir dh_testroot dh_clean -pgromacs-doc -pgromacs-dev -k dh_installdirs -pgromacs-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 dh_link -pgromacs-doc usr/share/doc/gromacs-doc/html usr/share/gromacs/html dh_link -pgromacs-doc usr/share/doc/gromacs-doc/html usr/share/doc/gromacs-dev/html # one lintian warning 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 dh_installdirs -pgromacs-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 install-basic: build dh_testdir dh_testroot dh_clean -pgromacs -k dh_installdirs -pgromacs $(MAKE) -C build/basic install DESTDIR=$(CURDIR)/debian/gromacs $(MAKE) -C build/basic-dp install DESTDIR=$(CURDIR)/debian/gromacs # extraneous man page, no longer associated with a binary # (and it needs to be removed lest it conflict with mono-mcs) rm -f $(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 rm -f $(CURDIR)/debian/gromacs/usr/share/man/man1/*_d.1 dh_installman -pgromacs debian/man/luck.1 debian/man/average.1 debian/man/g_nmtraj.1 debian/man/gromacs.7 for manpage in $(CURDIR)/debian/gromacs/usr/share/man/man1/*.1; do \ dh_link -pgromacs usr/share/man/man1/`basename $${manpage}` usr/share/man/man1/`basename $${manpage} .1`_d.1 ; \ done # 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 install-lam: build dh_testdir dh_testroot dh_clean -pgromacs-lam -k dh_installdirs -pgromacs-lam $(MAKE) -C build/lam install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-lam $(MAKE) -C build/lam-dp install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-lam dh_installman -pgromacs-lam debian/man/mdrun_mpi.lam.1 dh_link -pgromacs-lam usr/share/man/man1/mdrun_mpi.lam.1.gz usr/share/man/man1/mdrun_mpi_d.lam.1.gz cp $(CURDIR)/debian/lintian-overrides.gromacs-lam $(CURDIR)/debian/gromacs-lam/usr/share/lintian/overrides/gromacs-lam install-mpich: build dh_testdir dh_testroot dh_clean -pgromacs-mpich -k dh_installdirs -pgromacs-mpich $(MAKE) -C build/mpich install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-mpich $(MAKE) -C build/mpich-dp install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-mpich dh_installman -pgromacs-mpich debian/man/mdrun_mpi.mpich.1 dh_link -pgromacs-mpich usr/share/man/man1/mdrun_mpi.mpich.1.gz usr/share/man/man1/mdrun_mpi_d.mpich.1.gz cp $(CURDIR)/debian/lintian-overrides.gromacs-mpich $(CURDIR)/debian/gromacs-mpich/usr/share/lintian/overrides/gromacs-mpich install-openmpi: build dh_testdir dh_testroot dh_clean -pgromacs-openmpi -k ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) dh_installdirs -pgromacs-openmpi $(MAKE) -C build/openmpi install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-openmpi $(MAKE) -C build/openmpi-dp install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-openmpi dh_installman -pgromacs-openmpi debian/man/mdrun_mpi.openmpi.1 dh_link -pgromacs-openmpi usr/share/man/man1/mdrun_mpi.openmpi.1.gz usr/share/man/man1/mdrun_mpi_d.openmpi.1.gz cp $(CURDIR)/debian/lintian-overrides.gromacs-openmpi $(CURDIR)/debian/gromacs-openmpi/usr/share/lintian/overrides/gromacs-openmpi endif binary-indep: build install dh_testdir dh_testroot # 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 -pgromacs-doc -Xcopyright -XTODO dh_compress -i -X.pdf dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary-arch: build install 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 -pgromacs -L gromacs -l debian/gromacs/usr/lib dh_shlibdeps -pgromacs-lam -L gromacs-lam -l debian/gromacs-lam/usr/lib dh_shlibdeps -pgromacs-mpich -L gromacs-mpich -l debian/gromacs-mpich/usr/lib ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH))) dh_shlibdeps -pgromacs-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: binary binary-arch binary-indep build clean clean-patched install install-basic install-lam install-mpich install-openmpi # 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: