docs: Fix links generation for markdown-code-symlinks

Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
diff --git a/docs/Makefile b/docs/Makefile
index 103b5e1..21bd156 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -69,5 +69,5 @@
 
 # Catch-all target: route all unknown targets to Sphinx using the new
 # "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile links
+%: Makefile
 	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/conf.py b/docs/conf.py
index d7cbee0..7e8d7c0 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -30,6 +30,8 @@
 #
 import os
 import sys
+import subprocess
+
 sys.path.insert(0, os.path.abspath('.'))
 from markdown_code_symlinks import LinkParser, MarkdownSymlinksDomain
 
@@ -86,7 +88,6 @@
 else:
     docs_dir = os.path.abspath(os.path.dirname(__file__))
     print("Docs dir is:", docs_dir)
-    import subprocess
     subprocess.call('git fetch origin --unshallow', cwd=docs_dir, shell=True)
     subprocess.check_call('git fetch origin --tags', cwd=docs_dir, shell=True)
     subprocess.check_call('make links', cwd=docs_dir, shell=True)
@@ -268,6 +269,9 @@
 
 
 def setup(app):
+    # Generate links for markdown-code-symlinks
+    subprocess.check_call("make links", shell=True)
+
     github_code_repo = 'https://github.com/SymbiFlow/prjxray/'
     github_code_branch = 'blob/master/'