File: rules

package info (click to toggle)
cp2k 2025.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 372,052 kB
  • sloc: fortran: 963,262; ansic: 64,495; f90: 21,676; python: 14,419; sh: 11,382; xml: 2,173; makefile: 953; pascal: 845; perl: 492; cpp: 345; lisp: 297; csh: 16
file content (84 lines) | stat: -rwxr-xr-x 2,888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/make -f
# -*- makefile -*-

-include /usr/share/mpi-default-dev/debian_defaults

include /usr/share/dpkg/architecture.mk

ifeq ($(DEB_BUILD_ARCH), i386)
    export FFTW3_ALIGN=-D__FFTW3_UNALIGNED
else
    export FFTW3_ALIGN=
endif

export LIB_SCALAPACK=-lscalapack-$(ARCH_DEFAULT_MPI_IMPL)
export LIB_BLACS=$(LIB_SCALAPACK)
export LIB_MPI=$(shell pkg-config mpi-fort --libs)
export LIB_ELPA=-lelpa
export INC_ELPA=-I/usr/include/elpa/modules/ -I/usr/include/elpa/elpa/
export DEF_ELPA=-D__ELPA=202111
export OMPI_MCA_orte_rsh_agent=/bin/false
export CP2K_DATA_DIR=$(CURDIR)/data

# Upstream makefile contains lots of @ which make it impossible to debug
export MAKEFLAGS += --trace

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  export MAKEFLAGS += -j$(NUMJOBS)
endif

# As the cross-referencing takes a lot time and memory, only include that on
# amd64. Drop -W from $SPHINXOPTS elsewhere to surpress missing reference
# warnings.
ifeq ($(DEB_BUILD_ARCH), amd64)
  SPHINX_BUILD = ./generate_input_reference.py ./cp2k_input.xml && make html SPHINXOPTS="-W -n --keep-going --jobs $(NUMJOBS)"
else
  SPHINX_BUILD = make html SPHINXOPTS="-n --keep-going --jobs $(NUMJOBS)"
endif

# Increase test timeout on riscv64
ifeq ($(DEB_BUILD_ARCH), riscv64)
  TEST_TIMEOUT = 1200
else
  TEST_TIMEOUT = 400
endif

PLATFORM=Linux
ARCH=`uname -m`
FORT_C_NAME=gfortran
VERSION=psmp
PYTHON=python3

#cmake -DCP2K_ENABLE_REGTESTS=YES -DCP2K_USE_LIBINT2=YES -DCP2K_USE_LIBXC=YES -DCP2K_USE_SPGLIB=YES -DCP2K_USE_ELPA=YES -DCP2K_ENABLE_ELPA_OPENMP_SUPPORT=NO -DCP2K_ELPA_LINK_LIBRARIES=-lelpa -DCP2K_ELPA_INCLUDE_DIRS=/usr/include/elpa -DCP2K_SCALAPACK_LINK_LIBRARIES=-lscalapack-openmpi ..

%:
	dh $@ 

override_dh_auto_clean:
	cd arch && ln -fs $(PLATFORM)-generic-$(FORT_C_NAME).$(VERSION)		   \
		$(PLATFORM)-$(ARCH)-$(FORT_C_NAME).$(VERSION)
	+$(MAKE) ARCH=$(PLATFORM)-$(ARCH)-$(FORT_C_NAME)		   \
		VERSION=$(VERSION) distclean
	cd docs && rm -rf CP2K_INPUT _build && rm -f cp2k_input.xml CP2K_INPUT.md
	rm -f arch/$(PLATFORM)-$(ARCH)-$(FORT_C_NAME).*
	rm -rf LAST* TEST*
	dh_auto_clean

override_dh_auto_build:
	cd arch && ln -fs $(PLATFORM)-generic-$(FORT_C_NAME).$(VERSION)		    \
		$(PLATFORM)-$(ARCH)-$(FORT_C_NAME).$(VERSION)
	+$(MAKE) ARCH=$(PLATFORM)-$(ARCH)-$(FORT_C_NAME) 		    \
		VERSION=$(VERSION) PYTHON=$(PYTHON) all
	# The doc build needs the built executable for the input reference, so
	# cannot be done in a build-indep section
	cd docs && \
		$(CURDIR)/exe/*/cp2k.$(VERSION) --xml && \
		$(SPHINX_BUILD)

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	./tests/do_regtest.py --maxtasks $(NUMJOBS) --mpiranks 1 --workbasedir .     \
		--smoketest --skip_unittests --timeout $(TEST_TIMEOUT)               \
		exe/$(PLATFORM)-$(ARCH)-$(FORT_C_NAME) $(VERSION)
endif