aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2022-01-23 16:52:05 -0800
committerVishal Verma <vishal.l.verma@intel.com>2022-01-26 14:37:53 -0700
commit6dafb0baf8fda14f25e0a764fe8f89d8a4727b0c (patch)
tree3986f0b9f78f1145659d8661385de6bbab375be7
parentd7c5fa695a91d66485ca1febd6f29c3a483e20f6 (diff)
build: Add tags
Copy the systemd approach to generating tags with a file listing from git. Link: https://lore.kernel.org/r/164298552547.3021641.2951502977152843738.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
-rw-r--r--meson.build19
1 files changed, 19 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index b22fb2e5..68f3d0ce 100644
--- a/meson.build
+++ b/meson.build
@@ -82,6 +82,7 @@ project_source_root = meson.current_source_dir()
# Cleanup the leftover config.h files to avoid conflicts with the meson
# generated config.h
git = find_program('git', required : false)
+env = find_program('env')
if git.found()
run_command('clean_config.sh',
env : 'GIT_DIR=@0@/.git'.format(project_source_root),
@@ -111,6 +112,24 @@ else
)
endif
+if git.found()
+ all_files = run_command(
+ env, '-u', 'GIT_WORK_TREE',
+ git, '--git-dir=@0@/.git'.format(project_source_root),
+ 'ls-files', ':/*.[ch]',
+ check : false)
+ if all_files.returncode() == 0
+ all_files = files(all_files.stdout().split())
+ custom_target(
+ 'tags',
+ output : 'tags',
+ command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
+ run_target(
+ 'ctags',
+ command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
+ endif
+endif
+
versiondep = declare_dependency(
compile_args: ['-include', 'version.h'],
sources: version_h