2016-05-10 01:22:38 +08:00
|
|
|
# Makefile for LAMMPS documentation
|
2016-09-22 04:50:23 +08:00
|
|
|
|
2016-08-28 07:09:15 +08:00
|
|
|
SHA1 = $(shell echo $USER-$PWD | python utils/sha1sum.py)
|
2016-05-10 01:22:38 +08:00
|
|
|
BUILDDIR = /tmp/lammps-docs-$(SHA1)
|
|
|
|
RSTDIR = $(BUILDDIR)/rst
|
|
|
|
VENV = $(BUILDDIR)/docenv
|
|
|
|
TXT2RST = $(VENV)/bin/txt2rst
|
|
|
|
|
|
|
|
PYTHON = $(shell which python3)
|
|
|
|
|
|
|
|
ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 1)
|
|
|
|
$(error Python3 was not found! Please check README.md for further instructions)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 1)
|
|
|
|
$(error virtualenv was not found! Please check README.md for further instructions)
|
|
|
|
endif
|
|
|
|
|
|
|
|
SOURCES=$(wildcard src/*.txt)
|
|
|
|
OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst)
|
|
|
|
|
|
|
|
.PHONY: help clean-all clean html pdf venv
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Please use \`make <target>' where <target> is one of"
|
|
|
|
@echo " html to make HTML version of documentation using Sphinx"
|
2016-09-22 04:50:23 +08:00
|
|
|
@echo " pdf to make Manual.pdf and Developer.pdf"
|
2016-05-10 22:07:05 +08:00
|
|
|
@echo " txt2html to build txt2html tool"
|
2016-05-10 01:22:38 +08:00
|
|
|
@echo " clean to remove all generated RST files"
|
|
|
|
@echo " clean-all to reset the entire build environment"
|
|
|
|
|
|
|
|
clean-all:
|
2016-05-12 21:58:19 +08:00
|
|
|
rm -rf $(BUILDDIR)/* utils/txt2html/txt2html.exe
|
2016-05-10 01:22:38 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(RSTDIR)
|
|
|
|
|
2016-05-12 21:58:19 +08:00
|
|
|
txt2html: utils/txt2html/txt2html.exe
|
|
|
|
|
2016-05-10 01:22:38 +08:00
|
|
|
html: $(OBJECTS)
|
|
|
|
@(\
|
2016-05-12 21:58:19 +08:00
|
|
|
. $(VENV)/bin/activate ;\
|
2016-05-10 01:22:38 +08:00
|
|
|
cp -r src/* $(RSTDIR)/ ;\
|
|
|
|
sphinx-build -j 8 -b html -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
|
|
|
deactivate ;\
|
2016-09-01 09:55:31 +08:00
|
|
|
)
|
|
|
|
-rm html/searchindex.js
|
|
|
|
-rm -rf html/_sources
|
2016-05-10 01:22:38 +08:00
|
|
|
@echo "Build finished. The HTML pages are in doc/html."
|
|
|
|
|
2016-05-12 21:58:19 +08:00
|
|
|
pdf: utils/txt2html/txt2html.exe
|
|
|
|
@(\
|
|
|
|
cd src; \
|
|
|
|
../utils/txt2html/txt2html.exe -b *.txt; \
|
2016-09-22 04:50:23 +08:00
|
|
|
htmldoc --batch ../utils/pdfbook/lammps.book; \
|
2016-05-12 21:58:19 +08:00
|
|
|
for s in `echo *.txt | sed -e 's,\.txt,\.html,g'` ; \
|
2016-09-22 04:50:23 +08:00
|
|
|
do grep -q $$s ../utils/pdfbook/lammps.book || \
|
|
|
|
echo doc file $$s missing in utils/pdfbook/lammps.book; done; \
|
2016-05-12 21:58:19 +08:00
|
|
|
rm *.html; \
|
2016-09-22 04:50:23 +08:00
|
|
|
cd Developer; \
|
|
|
|
pdflatex developer; \
|
|
|
|
pdflatex developer; \
|
|
|
|
mv developer.pdf ../../Developer.pdf; \
|
2016-05-12 21:58:19 +08:00
|
|
|
)
|
2016-05-10 22:07:05 +08:00
|
|
|
|
2016-05-12 21:58:19 +08:00
|
|
|
utils/txt2html/txt2html.exe: utils/txt2html/txt2html.cpp
|
|
|
|
g++ -O -Wall -o $@ $<
|
2016-05-10 01:22:38 +08:00
|
|
|
|
|
|
|
$(RSTDIR)/%.rst : src/%.txt $(TXT2RST)
|
|
|
|
@(\
|
|
|
|
mkdir -p $(RSTDIR) ; \
|
2016-05-12 21:58:19 +08:00
|
|
|
. $(VENV)/bin/activate ;\
|
2016-05-10 01:22:38 +08:00
|
|
|
txt2rst $< > $@ ;\
|
|
|
|
deactivate ;\
|
|
|
|
)
|
|
|
|
|
|
|
|
$(VENV):
|
|
|
|
@( \
|
|
|
|
virtualenv -p $(PYTHON) $(VENV); \
|
2016-05-12 21:58:19 +08:00
|
|
|
. $(VENV)/bin/activate; \
|
2016-05-10 01:22:38 +08:00
|
|
|
pip install Sphinx; \
|
|
|
|
pip install sphinxcontrib-images; \
|
|
|
|
deactivate;\
|
|
|
|
)
|
|
|
|
|
|
|
|
$(TXT2RST): $(VENV)
|
|
|
|
@( \
|
2016-05-12 21:58:19 +08:00
|
|
|
. $(VENV)/bin/activate; \
|
|
|
|
(cd utils/converters;\
|
|
|
|
python setup.py develop);\
|
2016-05-10 01:22:38 +08:00
|
|
|
deactivate;\
|
|
|
|
)
|