+++ /dev/null
-# SPDX-License-Identifier: LGPL-2.1-or-later
-man/*
-# These contain external headers that we don't want to check.
-src/basic/include/*
-# clang-tidy can't parse BPF source files.
-src/core/bpf/*
-src/network/bpf/*
-src/nsresourced/bpf/*
-# The glib headers contain cyclic dependencies and clang-tidy
-# can't distinguish between our code and glib headers so we
-# exclude this test.
-src/libsystemd/sd-bus/test-bus-marshal.c
- name: Configure meson
run: mkosi sandbox -- env CC=clang CXX=clang++ meson setup build
- # Make sure all generated source files are actually generated by doing a full build.
- - name: Build systemd
- run: mkosi sandbox -- ninja -C build
-
- name: Run clang-tidy
run: mkosi sandbox -- ninja -C build clang-tidy
```sh
$ mkosi sandbox -- env CC=clang CXX=clang++ meson setup build
```
+
+Additionally, the `gensources` target can be used to make sure all generated
+sources are generated to avoid clangd complaining that these source files don't
+exist.
+
+```sh
+$ mkosi sandbox -- ninja -C build gensources
+```
endif
endif
+vmlinux_h_dependency = []
if use_provided_vmlinux_h
if not fs.exists(provided_vmlinux_h_path)
error('Path to provided vmlinux.h does not exist.')
endif
- vmlinux_h_dependency = []
bpf_o_unstripped_cmd += ['-I' + fs.parent(provided_vmlinux_h_path)]
message('Using provided @0@'.format(provided_vmlinux_h_path))
elif use_generated_vmlinux_h
executables = []
executables_by_name = {}
fuzzer_exes = []
+generated_sources = [version_h, vmlinux_h_dependency]
# binaries that have --help and are intended for use by humans,
# usually, but not always, installed in /bin.
#####################################################################
+alias_target('gensources', generated_sources)
+
+run_clang_tidy = find_program('run-clang-tidy', required : false)
+if run_clang_tidy.found()
+ run_target(
+ 'clang-tidy',
+ command : [
+ run_clang_tidy,
+ '-use-color',
+ '-quiet',
+ '-p', meson.project_build_root(),
+ # There seems to be a bug in clang-tidy where by even with --quiet some
+ # messages from clang's own diagnostics engine leak through:
+ # X warnings generated.
+ # Until this is fixed upstream, we use -fno-caret-diagnostics to suppress these.
+ '-extra-arg=-fno-caret-diagnostics',
+ ],
+ depends : generated_sources
+ )
+endif
+
check_api_docs_sh = find_program('tools/check-api-docs.sh')
run_target(
'check-api-docs',
generated_gperf_headers += [target1, target2]
endforeach
+generated_sources += generated_gperf_headers
basic_sources += generated_gperf_headers
############################################################
'@INPUT@'],
capture : true)
+generated_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
basic_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
libbasic_static = static_library(
capture : true,
build_by_default : want_tests != 'false')
else
- test_hwids_section_c = ''
+ test_hwids_section_c = []
endif
+generated_sources += test_hwids_section_c
+
executables += [
efi_test_template + {
'sources' : files('test-bcd.c'),
output : 'restrict-fs.skel.h',
command : skel_h_cmd,
capture : true)
+
+generated_sources += restrict_fs_skel_h
output : 'restrict-ifaces.skel.h',
command : skel_h_cmd,
capture : true)
+
+generated_sources += restrict_ifaces_skel_h
output : 'socket-bind.skel.h',
command : skel_h_cmd,
capture : true)
+
+generated_sources += socket_bind_skel_h
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true)
+generated_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c]
+
libcore_name = 'systemd-core-@0@'.format(shared_lib_tag)
libcore_static = static_library(
output : 'homed-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += [homed_gperf_c]
systemd_homed_sources += [homed_gperf_c]
homectl_sources = files(
'journald-wall.c',
)
-sources += custom_target(
+journald_gperf_c = custom_target(
'journald-gperf.c',
input : 'journald-gperf.gperf',
output : 'journald-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += journald_gperf_c
+sources += journald_gperf_c
+
libjournal_core = static_library(
'journal-core',
sources,
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true)
-sd_journal_sources += [audit_type_to_name]
+generated_sources += audit_type_to_name
+sd_journal_sources += audit_type_to_name
############################################################
#include <math.h>
#include <stdlib.h>
+/* We make an exception here to our usual "include system headers first" rule because we need one of these
+ * macros to disable a warning triggered by the glib headers. */
+#include "macro-fundamental.h"
+
#if HAVE_GLIB
-#include <gio/gio.h>
+DISABLE_WARNING_FORMAT_NONLITERAL
+#include <gio/gio.h> /* NOLINT */
+REENABLE_WARNING
#endif
#if HAVE_DBUS
output : 'logind-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += logind_gperf_c
+
liblogind_core_sources = files(
'logind-action.c',
'logind-brightness.c',
output : 'sysctl-monitor.skel.h',
command : skel_h_cmd,
capture : true)
+
+generated_sources += sysctl_monitor_skel_h
sources += sysctl_monitor_skel_h
endif
-sources += custom_target(
+networkd_gperf_c = custom_target(
'networkd-gperf.c',
input : 'networkd-gperf.gperf',
output : 'networkd-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
-sources += custom_target(
+networkd_network_gperf_c = custom_target(
'networkd-network-gperf.c',
input : networkd_network_gperf_gperf,
output : 'networkd-network-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
-sources += custom_target(
+netdev_gperf_c = custom_target(
'netdev-gperf.c',
input : networkd_netdev_gperf_gperf,
output : 'netdev-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += [networkd_gperf_c, networkd_network_gperf_c, netdev_gperf_c]
+sources += [networkd_gperf_c, networkd_network_gperf_c, netdev_gperf_c]
+
if get_option('link-networkd-shared')
networkd_link_with = [libshared]
else
output : 'nspawn-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
-libnspawn_core_sources += [nspawn_gperf_c]
+generated_sources += nspawn_gperf_c
+libnspawn_core_sources += nspawn_gperf_c
libnspawn_core = static_library(
'nspawn-core',
output : 'userns-restrict.skel.h',
command : skel_h_cmd,
capture : true)
+
+generated_sources += userns_restrict_skel_h
command : [generate_dns_type_gperf, 'dns_type', 'DNS_TYPE_', '@INPUT@'],
capture : true)
-basic_dns_sources += custom_target(
+dns_type_from_name_h = custom_target(
'dns_type-from-name.h',
input : gperf_file,
output : 'dns_type-from-name.h',
'@INPUT@'],
capture : true)
-basic_dns_sources += custom_target(
+dns_type_to_name_h = custom_target(
'dns_type-to-name.h',
input : ['dns_type-to-name.awk', dns_type_list_txt],
output : 'dns_type-to-name.h',
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true)
+generated_sources += [dns_type_from_name_h, dns_type_to_name_h]
+basic_dns_sources += [dns_type_from_name_h, dns_type_to_name_h]
+
libsystemd_resolve_core = static_library(
'systemd-resolve-core',
basic_dns_sources,
dependencies : userspace,
build_by_default : false)
-systemd_resolved_sources += custom_target(
+resolved_gperf_c = custom_target(
'resolved_gperf.c',
input : 'resolved-gperf.gperf',
output : 'resolved-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
-systemd_resolved_sources += custom_target(
+resolved_dnssd_gperf_c = custom_target(
'resolved_dnssd_gperf.c',
input : 'resolved-dnssd-gperf.gperf',
output : 'resolved-dnssd-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += [resolved_gperf_c, resolved_dnssd_gperf_c]
+systemd_resolved_sources += [resolved_gperf_c, resolved_dnssd_gperf_c]
+
systemd_resolved_dependencies = [threads, libm, libopenssl]
if conf.get('ENABLE_DNS_OVER_TLS') == 1
systemd_resolved_sources += files(
'@INPUT@'],
capture : true)
+generated_sources += syscall_list_h
+
if conf.get('HAVE_ACL') == 1
shared_sources += files('devnode-acl.c')
endif
capture : true)
shared_generated_gperf_headers = [target1, target2]
+generated_sources += shared_generated_gperf_headers
shared_sources += shared_generated_gperf_headers
fname = 'ethtool-link-mode.h'
output : fname,
command : [python, '@INPUT0@', '--header', cpp, '@INPUT1@'],
capture : true)
+
+generated_sources += ethtool_link_mode_h
shared_sources += ethtool_link_mode_h
fname = 'ethtool-link-mode.xml'
capture : true,
build_by_default : want_tests != 'false')
+generated_sources += test_hashmap_ordered_c
+
path = run_command(sh, '-c', 'echo "$PATH"', check: true).stdout().strip()
test_env = environment()
test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
capture : true,
build_by_default : want_tests != 'false')
+generated_sources += [test_libsystemd_sym_c, test_libudev_sym_c]
+
############################################################
simple_tests += files(
'timesyncd-bus.c',
)
-sources += custom_target(
+timesyncd_gperf_c = custom_target(
'timesyncd-gperf.c',
input : 'timesyncd-gperf.gperf',
output : 'timesyncd-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += timesyncd_gperf_c
+sources += timesyncd_gperf_c
+
if get_option('link-timesyncd-shared')
timesyncd_link_with = [libshared]
else
'@INPUT@'],
capture : true)
+generated_sources += keyboard_keys_from_name_h
+
############################################################
udev_link_gperf_gperf = files('net/link-config-gperf.gperf')
output : 'link-config-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
+generated_sources += link_config_gperf_c
+
############################################################
if get_option('link-udev-shared')