diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e5ae1f54347254322e5ce4d50435c1ad8560a6b..7a5d0542cce9b47e9fe3303a3cfd1f202a860fd2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,6 +132,7 @@ endif ()
 if (OPENDHT_TOOLS)
     add_subdirectory(tools)
 endif ()
+add_subdirectory(doc)
 
 if (OPENDHT_PYTHON)
     add_subdirectory(python)
diff --git a/Makefile.am b/Makefile.am
index eeb24dd007667a467b7594ecc9ba0606ff301878..8e4e6045a5d0a2ddfee89d7a47946f0c0eca6c0d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,9 +10,7 @@ if USE_CYTHON
 SUBDIRS += python
 endif
 
-if HAVE_DOXYGEN
 SUBDIRS += doc
-endif
 
 ACLOCAL_AMFLAGS = -I m4
 
diff --git a/configure.ac b/configure.ac
index c9e50a083cc439f109decc0fc4051911b0939d75..777d71cfc51e68a7f000563442615a3b1e85d7cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl Check for Doxygen
 AC_ARG_ENABLE([doc], AS_HELP_STRING([--enable-doc], [Enable documentation generation (doxygen)]))
 AS_IF([test "x$enable_doc" = "xyes"], [
        AC_CHECK_PROGS([DOXYGEN], [doxygen])
-       AS_IF([test -z "$DOXYGEN"], [AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])])       
+       AS_IF([test -z "$DOXYGEN"], [AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])])
 ])
 AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
 
@@ -88,7 +88,7 @@ AM_COND_IF([ENABLE_TOOLS], [
   ])
 ])
 
-AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile doc/Makefile])])
+AC_CONFIG_FILES([doc/Doxyfile doc/Makefile])
 
 dnl Configure setup.py if we build the python module
 AM_COND_IF([USE_CYTHON], [
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 51bc7996ed6ebe607a5e5c209bc7a3610633b6be..ab00293b61d544db2b9e17e32c996fbf79540795 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,3 +1,6 @@
+dist_man1_MANS = dhtnode.1
+
+if HAVE_DOXYGEN
 doxyfile.stamp:
 	$(DOXYGEN) Doxyfile
 	echo stamp > doxyfile.stamp
@@ -7,3 +10,4 @@ CLEANFILES = doxyfile.stamp
 all-local: doxyfile.stamp
 clean-local:
 	rm -rf $(top_srcdir)/doc/man $(top_srcdir)/doc/html
+endif