diff --git a/meson.build b/meson.build
index 1caa54aa4625871d72ef4e5247272c87ba91444e..e5c9307a0c2cb261e621fa32aecb6c59218057f8 100644
--- a/meson.build
+++ b/meson.build
@@ -109,6 +109,7 @@ sphinx_docs = custom_target(
   command : [
     sphinx_build, '-w', 'sphinx.log', '-b', 'html', meson.project_source_root() , 'html'
   ],
-  depend_files : files('conf.py.in', 'index.rst', 'apidoc/modules.rst'),
+  depend_files : files('conf.py.in', 'index.rst'),
+  depends: apidoc,
   build_by_default : true
 )