Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
build-aux/Makefile.in | 9 +++
.../Makefile.nonreentrant | 0
build-aux/meson.build | 30 +++++++++
build-aux/syntax-check.mk | 62 +++++++++----------
meson.build | 2 +
5 files changed, 72 insertions(+), 31 deletions(-)
create mode 100644 build-aux/Makefile.in
rename Makefile.nonreentrant => build-aux/Makefile.nonreentrant (100%)
create mode 100644 build-aux/meson.build
diff --git a/build-aux/Makefile.in b/build-aux/Makefile.in
new file mode 100644
index 00000000000..601f1ad7a19
--- /dev/null
+++ b/build-aux/Makefile.in
@@ -0,0 +1,9 @@
+# define variables
+
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+FLAKE8 = @flake8_path@
+RUNUTF8 = @runutf8@
+
+# include syntax-check.mk file
+include $(top_srcdir)/build-aux/syntax-check.mk
diff --git a/Makefile.nonreentrant b/build-aux/Makefile.nonreentrant
similarity index 100%
rename from Makefile.nonreentrant
rename to build-aux/Makefile.nonreentrant
diff --git a/build-aux/meson.build b/build-aux/meson.build
new file mode 100644
index 00000000000..de916793cad
--- /dev/null
+++ b/build-aux/meson.build
@@ -0,0 +1,30 @@
+syntax_check_conf = configuration_data()
+syntax_check_conf.set('top_srcdir', meson.source_root())
+syntax_check_conf.set('top_builddir', meson.build_root())
+
+flake8_path = ''
+if flake8_prog.found()
+ flake8_path = flake8_prog.path()
+endif
+syntax_check_conf.set('flake8_path', flake8_path)
+syntax_check_conf.set('runutf8', ' '.join(runutf8))
+
+configure_file(
+ input: 'Makefile.in',
+ output: '@BASENAME@',
+ configuration: syntax_check_conf,
+)
+
+make_prog = find_program('make')
+
+# There is no way how to pass value to -j using run_target so let's use
+# it without any value to run all tests in parallel.
+run_target(
+ 'syntax-check',
+ command: [
+ make_prog, '-C', meson.current_build_dir(), '-j',
'syntax-check',
+ ],
+ depends: [
+ potfiles_dep,
+ ],
+)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 3d7b644f01f..1fe2da4e637 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -21,7 +21,7 @@
# This is reported not to work with make-3.79.1
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
-ME := $(_build-aux)/syntax-check.mk
+ME := build-aux/syntax-check.mk
# These variables ought to be defined through the configure.ac section
# of the module description. But some packages import this file directly,
@@ -42,29 +42,29 @@ _equal = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
GIT = git
VC = $(GIT)
-VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir)
+VC_LIST = $(top_srcdir)/build-aux/vc-list-files -C $(top_srcdir)
# You can override this variable in syntax-check.mk to set your own regexp
# matching files to ignore.
VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
# This is to preprocess robustly the output of $(VC_LIST), so that even
-# when $(srcdir) is a pathological name like "....", the leading sed command
+# when $(top_srcdir) is a pathological name like "....", the leading sed
command
# removes only the intended prefix.
-_dot_escaped_srcdir = $(subst .,\.,$(srcdir))
-_dot_escaped_builddir = $(subst .,\.,$(builddir))
+_dot_escaped_srcdir = $(subst .,\.,$(top_srcdir))
+_dot_escaped_builddir = $(subst .,\.,$(top_builddir))
-# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only
-# when $(srcdir) is not ".".
-ifeq ($(srcdir),.)
+# Post-process $(VC_LIST) output, prepending $(top_srcdir)/, but only
+# when $(top_srcdir) is not ".".
+ifeq ($(top_srcdir),.)
_prepend_srcdir_prefix =
else
- _prepend_srcdir_prefix = | $(SED) 's|^|$(srcdir)/|'
+ _prepend_srcdir_prefix = | $(SED) 's|^|$(top_srcdir)/|'
endif
# In order to be able to consistently filter "."-relative names,
-# (i.e., with no $(srcdir) prefix), this definition is careful to
-# remove any $(srcdir) prefix, and to restore what it removes.
+# (i.e., with no $(top_srcdir) prefix), this definition is careful to
+# remove any $(top_srcdir) prefix, and to restore what it removes.
_sc_excl = \
$(or $(exclude_file_name_regexp--$@),^$$)
VC_LIST_EXCEPT = \
@@ -84,11 +84,11 @@ export LC_ALL = C
## Sanity checks. ##
## --------------- ##
-_cfg_mk := $(wildcard $(srcdir)/$(_build-aux)/syntax-check.mk)
+_cfg_mk := $(wildcard $(top_srcdir)/build-aux/syntax-check.mk)
# Collect the names of rules starting with 'sc_'.
syntax-check-rules := $(sort $(shell $(SED) -n \
- 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(srcdir)/$(ME) $(_cfg_mk)))
+ 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(top_srcdir)/$(ME) $(_cfg_mk)))
.PHONY: $(syntax-check-rules)
ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0)
@@ -333,11 +333,11 @@ sc_flags_debug:
# than d). The existence of long long, and of documentation about
# flags, makes the regex in the third test slightly harder.
sc_flags_usage:
- @test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \
- $(srcdir)/include/libvirt/virterror.h \
- $(srcdir)/include/libvirt/libvirt-qemu.h \
- $(srcdir)/include/libvirt/libvirt-lxc.h \
- $(srcdir)/include/libvirt/libvirt-admin.h \
+ @test "$$(cat $(top_srcdir)/include/libvirt/libvirt-domain.h \
+ $(top_srcdir)/include/libvirt/virterror.h \
+ $(top_srcdir)/include/libvirt/libvirt-qemu.h \
+ $(top_srcdir)/include/libvirt/libvirt-lxc.h \
+ $(top_srcdir)/include/libvirt/libvirt-admin.h \
| $(GREP) -c '\(long\|unsigned\) flags')" != 4 && \
{ echo '$(ME): new API should use "unsigned int flags"' 1>&2;
\
exit 1; } || :
@@ -496,7 +496,7 @@ sc_prohibit_PATH_MAX:
halt='dynamically allocate paths, do not use PATH_MAX' \
$(_sc_search_regexp)
-include $(srcdir)/Makefile.nonreentrant
+include $(top_srcdir)/build-aux/Makefile.nonreentrant
sc_prohibit_nonreentrant:
@prohibit="\\<(${NON_REENTRANT_RE}) *\\(" \
halt="use re-entrant functions (usually ending with _r)" \
@@ -833,7 +833,7 @@ sc_prohibit_gettext_markup:
# Our code is divided into modular subdirectories for a reason, and
# lower-level code must not include higher-level headers.
-cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.))
+cross_dirs=$(patsubst $(top_srcdir)/src/%.,%,$(wildcard $(top_srcdir)/src/*/.))
cross_dirs_re=($(subst / ,/|,$(cross_dirs)))
mid_dirs=access|admin|conf|cpu|locking|logging|rpc|security
sc_prohibit_cross_inclusion:
@@ -1177,7 +1177,7 @@ sc_prohibit_dirent_d_type:
# grep-E-style regexp selecting the files to check. For in_vc_files,
# the regexp is used to select matching files from the list of all
# version-controlled files; for in_files, it's from the names printed
-# by "find $(srcdir)". When neither is specified, use all files that
+# by "find $(top_srcdir)". When neither is specified, use all files that
# are under version control.
#
# containing | non_containing
@@ -1249,7 +1249,7 @@ define _sc_search_regexp
\
: Filter by file name; \
if test -n "$$in_files"; then \
- files=$$(find $(srcdir) | $(GREP) -E "$$in_files" \
+ files=$$(find $(top_srcdir) | $(GREP) -E "$$in_files" \
| $(GREP) -Ev '$(_sc_excl)'); \
else \
files=$$($(VC_LIST_EXCEPT)); \
@@ -1293,7 +1293,7 @@ sc_avoid_if_before_free:
@$(VC_LIST_EXCEPT) \
| $(GREP) -v useless-if-before-free \
| xargs \
- $(srcdir)/$(_build-aux)/useless-if-before-free \
+ $(top_srcdir)/build-aux/useless-if-before-free \
$(useless_free_options) \
&& { printf '$(ME): found useless "if"' \
' before "free" above\n' 1>&2; \
@@ -1781,9 +1781,6 @@ sc_const_long_option:
halt='add "const" to the above declarations' \
$(_sc_search_regexp)
-gen_source_files:
- $(MAKE) -C src generated-sources
-
fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
apply the above patch\n'
@@ -1805,26 +1802,26 @@ perl_translatable_files_list_ = \
# Verify that all source files using _() (more specifically, files that
# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
-po_file ?= $(srcdir)/po/POTFILES.in
+po_file ?= $(top_srcdir)/po/POTFILES.in
# List of additional files that we want to pick up in our POTFILES.in
# This is all generated files for RPC code.
generated_files = \
- $(builddir)/src/*.[ch] \
- $(builddir)/src/*/*.[ch]
+ $(top_builddir)/src/*.[ch] \
+ $(top_builddir)/src/*/*.[ch]
_gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$)
# sc_po_check can fail if generated files are not built first
-sc_po_check: gen_source_files
+sc_po_check:
@if test -f $(po_file); then \
$(GREP) -E -v '^(#|$$)' $(po_file) \
| $(GREP) -v '^src/false\.c$$' | sort > $@-1; \
{ $(VC_LIST_EXCEPT); echo $(generated_files); } \
| xargs perl $(perl_translatable_files_list_) \
| xargs $(GREP) -E -l '$(_gl_translatable_string_re)' \
- | $(SED) 's|^$(_dot_escaped_srcdir)/|@SRCDIR@|' \
| $(SED) 's|^$(_dot_escaped_builddir)/|@BUILDDIR@|' \
+ | $(SED) 's|^$(_dot_escaped_srcdir)/|@SRCDIR@|' \
| sort -u > $@-2; \
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
|| { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \
@@ -2074,3 +2071,6 @@ exclude_file_name_regexp--sc_prohibit_backslash_alignment = \
exclude_file_name_regexp--sc_prohibit_select = \
^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c$$
+
+exclude_file_name_regexp--sc_prohibit_config_h_in_headers = \
+ ^config\.h$$
diff --git a/meson.build b/meson.build
index d14223829e2..587e05a02da 100644
--- a/meson.build
+++ b/meson.build
@@ -2213,6 +2213,8 @@ subdir('po')
subdir('docs')
+subdir('build-aux')
+
# install pkgconfig files
pkgconfig_files = [
--
2.26.2