@@ -20,6 +20,11 @@ api_files = [
2020 ' util.h'
2121]
2222
23+ api_paths = []
24+ foreach f : api_files
25+ api_paths += files (' ../src/nvme/' + f)
26+ endforeach
27+
2328sphinx_sources = [
2429 ' conf.py' ,
2530 ' api.rst' ,
@@ -41,8 +46,12 @@ subdir('rst')
4146
4247want_docs = get_option (' docs' )
4348want_docs_build = get_option (' docs-build' )
49+ kernel_doc = find_program (' kernel-doc' )
50+ kernel_doc_check = find_program (' kernel-doc-check' )
51+
52+ test (' kdoc' , kernel_doc_check, args : api_paths)
53+
4454if want_docs != ' false'
45- kernel_doc = find_program (' kernel-doc' )
4655
4756 conf = configuration_data ()
4857 conf.set(' SYSCONFDIR' , sysconfdir)
@@ -51,29 +60,27 @@ if want_docs != 'false'
5160 mandir = join_paths (get_option (' mandir' ), ' man2' )
5261 list_man_pages = find_program (' list-man-pages.sh' )
5362 if want_docs_build
54- foreach apif : api_files
55- foreach file : files (' ../src/nvme/' + apif)
56- subst = configure_file (
57- input : file,
58- 59- configuration : conf)
60- c = run_command (list_man_pages, subst)
61- man_pages = c.stdout().split()
62- foreach page : man_pages
63- custom_target (
64- page.underscorify() + ' _man' ,
65- input : subst,
66- output : page + ' .2' ,
67- capture : true ,
68- command : [kernel_doc,
69- ' -module' , ' libnvme' ,
70- ' -man' ,
71- ' -function' ,
72- page,
73- subst],
74- install : true ,
75- install_dir : mandir)
76- endforeach
63+ foreach apif : api_paths
64+ subst = configure_file (
65+ input : file,
66+ 67+ configuration : conf)
68+ c = run_command (list_man_pages, subst)
69+ man_pages = c.stdout().split()
70+ foreach page : man_pages
71+ custom_target (
72+ page.underscorify() + ' _man' ,
73+ input : subst,
74+ output : page + ' .2' ,
75+ capture : true ,
76+ command : [kernel_doc,
77+ ' -module' , ' libnvme' ,
78+ ' -man' ,
79+ ' -function' ,
80+ page,
81+ subst],
82+ install : true ,
83+ install_dir : mandir)
7784 endforeach
7885 endforeach
7986 else
0 commit comments