summaryrefslogtreecommitdiffstats
path: root/share/mk/dist/check/_.mk
blob: d0a3b5df9b29cdae156868ed2a591c7ec4434ab3 (plain)
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
# Copyright 2024, Alejandro Colomar <alx@kernel.org>
# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception


ifndef MAKEFILE_DIST_CHECK_INCLUDED
MAKEFILE_DIST_CHECK_INCLUDED := 1


include $(MAKEFILEDIR)/configure/build-depends/coreutils/realpath.mk
include $(MAKEFILEDIR)/configure/directory_variables/build.mk
include $(MAKEFILEDIR)/configure/version.mk


_DISTCHECKDIR      := $(shell $(REALPATH) -m $(builddir)/distcheck)
_DISTCHECKSRCDIR   := $(_DISTCHECKDIR)/$(DISTNAME)
_DISTCHECKBUILDDIR := $(_DISTCHECKDIR)/$(DISTNAME)_builddir
_DISTCHECKDESTDIR  := $(_DISTCHECKDIR)/$(DISTNAME)_destdir
_DISTCHECK_MANDIR  := $(_DISTCHECKBUILDDIR)/man


_MAKE_OPTS = \
	-C $< \
	'builddir=$(_DISTCHECKBUILDDIR)' \
	'DESTDIR=$(_DISTCHECKDESTDIR)'


distcheck-%: $(_DISTCHECKSRCDIR) $(MK) | $$(@D)/
	$(info	$(INFO_)MAKE		$@)
	$(MAKE) $(_MAKE_OPTS) $* \
		'INFO_= $*:	'


.PHONY: distcheck
distcheck: distcheck-diffoscope
distcheck: $(_DISTCHECKSRCDIR) $(MK)
	$(info	$(INFO_)MAKE		lint build install dist)
	$(MAKE) $(_MAKE_OPTS) lint build install dist \
		'INFO_= distcheck:	'
	$(info	$(INFO_)MAKE		check)
	$(MAKE) $(_MAKE_OPTS) check \
		'INFO_= distcheck:	'


endif  # include guard