Browse Source

Makefile: add documentation build targets docs & docs-live

BTW:
- add build & dist folder to .gitignore
- justify indentation of build messages (makefile.python)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 5 years ago
parent
commit
ef85943e06
3 changed files with 20 additions and 2 deletions
  1. 2 0
      .gitignore
  2. 16 0
      Makefile
  3. 2 2
      utils/makefile.python

+ 2 - 0
.gitignore

@@ -19,5 +19,7 @@ node_modules/
 
 
 .tx/
 .tx/
 
 
+build/
+dist/
 local/
 local/
 searx.egg-info/
 searx.egg-info/

+ 16 - 0
Makefile

@@ -1,16 +1,20 @@
 # -*- coding: utf-8; mode: makefile-gmake -*-
 # -*- coding: utf-8; mode: makefile-gmake -*-
 
 
 PYOBJECTS = searx
 PYOBJECTS = searx
+DOC       = docs
 PY_SETUP_EXTRAS ?= \[test\]
 PY_SETUP_EXTRAS ?= \[test\]
 
 
 include utils/makefile.include
 include utils/makefile.include
 include utils/makefile.python
 include utils/makefile.python
+include utils/makefile.sphinx
 
 
 all: clean install
 all: clean install
 
 
 PHONY += help
 PHONY += help
 help:
 help:
 	@echo  '  test      - run developer tests'
 	@echo  '  test      - run developer tests'
+	@echo  '  docs      - build documentation'
+	@echo  '  docs-live - autobuild HTML documentation while editing'
 	@echo  '  run       - run developer instance'
 	@echo  '  run       - run developer instance'
 	@echo  '  install   - developer install (./local)'
 	@echo  '  install   - developer install (./local)'
 	@echo  '  uninstall - uninstall (./local)'
 	@echo  '  uninstall - uninstall (./local)'
@@ -40,6 +44,18 @@ run:  pyenvinstall
 	) &
 	) &
 	$(PY_ENV)/bin/python ./searx/webapp.py
 	$(PY_ENV)/bin/python ./searx/webapp.py
 
 
+# docs
+# ----
+
+PHONY += docs
+docs:  pyenvinstall sphinx-doc
+	$(call cmd,sphinx,html,docs,docs)
+
+PHONY += docs-live
+docs-live:  pyenvinstall sphinx-live
+	$(call cmd,sphinx_autobuild,html,docs,docs)
+
+
 # test
 # test
 # ----
 # ----
 
 

+ 2 - 2
utils/makefile.python

@@ -155,7 +155,7 @@ quiet_cmd_virtualenv  = PYENV     usage: $ source ./$@/bin/activate
 	if [ ! -d "./$(PY_ENV)" ];then                                  \
 	if [ ! -d "./$(PY_ENV)" ];then                                  \
 		$(VIRTUALENV) $(VIRTUALENV_VERBOSE) $(VTENV_OPTS) $2;   \
 		$(VIRTUALENV) $(VIRTUALENV_VERBOSE) $(VTENV_OPTS) $2;   \
 	else                                                            \
 	else                                                            \
-		echo "  PYENV     using virtualenv from $2";            \
+		echo "PYENV     using virtualenv from $2";              \
         fi
         fi
 
 
 # $2 path to lint
 # $2 path to lint
@@ -263,7 +263,7 @@ pydebug: $(PY_ENV)
 # install / uninstall python objects into virtualenv (PYENV)
 # install / uninstall python objects into virtualenv (PYENV)
 pyenv-install: $(PY_ENV)
 pyenv-install: $(PY_ENV)
 	@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) install -e .
 	@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) install -e .
-	@echo "  ACTIVATE  $(call normpath,$(PY_ENV_ACT)) "
+	@echo "ACTIVATE  $(call normpath,$(PY_ENV_ACT)) "
 
 
 pyenv-uninstall: $(PY_ENV)
 pyenv-uninstall: $(PY_ENV)
 	@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) uninstall --yes .
 	@$(PY_ENV_BIN)/pip $(PIP_VERBOSE) uninstall --yes .