2016-05-10 01:22:38 +08:00
|
|
|
# Makefile for LAMMPS documentation
|
2016-09-22 04:50:23 +08:00
|
|
|
|
2018-12-04 03:59:43 +08:00
|
|
|
SHELL = /bin/bash
|
2019-11-06 03:01:48 +08:00
|
|
|
BUILDDIR = ${CURDIR}
|
|
|
|
RSTDIR = $(BUILDDIR)/src
|
2016-05-10 01:22:38 +08:00
|
|
|
VENV = $(BUILDDIR)/docenv
|
2020-02-22 15:27:18 +08:00
|
|
|
MATHJAX = $(BUILDDIR)/mathjax
|
2016-05-10 01:22:38 +08:00
|
|
|
TXT2RST = $(VENV)/bin/txt2rst
|
2019-11-06 03:01:48 +08:00
|
|
|
ANCHORCHECK = $(VENV)/bin/rst_anchor_check
|
2016-05-10 01:22:38 +08:00
|
|
|
|
|
|
|
PYTHON = $(shell which python3)
|
2018-06-01 07:03:28 +08:00
|
|
|
VIRTUALENV = virtualenv
|
2016-10-13 23:40:44 +08:00
|
|
|
HAS_PYTHON3 = NO
|
|
|
|
HAS_VIRTUALENV = NO
|
2020-04-03 02:31:47 +08:00
|
|
|
HAS_PDFLATEX = NO
|
2016-05-10 01:22:38 +08:00
|
|
|
|
2016-10-13 23:40:44 +08:00
|
|
|
ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0)
|
|
|
|
HAS_PYTHON3 = YES
|
2016-05-10 01:22:38 +08:00
|
|
|
endif
|
|
|
|
|
2018-06-01 07:03:28 +08:00
|
|
|
ifeq ($(shell which virtualenv-3 >/dev/null 2>&1; echo $$?), 0)
|
|
|
|
VIRTUALENV = virtualenv-3
|
|
|
|
HAS_VIRTUALENV = YES
|
|
|
|
endif
|
|
|
|
|
2016-10-13 23:40:44 +08:00
|
|
|
ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0)
|
2018-06-01 07:03:28 +08:00
|
|
|
VIRTUALENV = virtualenv
|
2016-10-13 23:40:44 +08:00
|
|
|
HAS_VIRTUALENV = YES
|
2016-05-10 01:22:38 +08:00
|
|
|
endif
|
|
|
|
|
2020-04-03 02:31:47 +08:00
|
|
|
ifeq ($(shell which pdflatex >/dev/null 2>&1; echo $$?), 0)
|
|
|
|
HAS_PDFLATEX = YES
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2017-12-08 04:38:15 +08:00
|
|
|
SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())')
|
2016-05-10 01:22:38 +08:00
|
|
|
|
2020-02-27 04:55:20 +08:00
|
|
|
.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check
|
2016-09-22 05:22:32 +08:00
|
|
|
|
|
|
|
# ------------------------------------------
|
2016-05-10 01:22:38 +08:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Please use \`make <target>' where <target> is one of"
|
2020-02-22 15:27:18 +08:00
|
|
|
@echo " html create HTML doc pages in html dir"
|
|
|
|
@echo " pdf create Developer.pdf and Manual.pdf in this dir"
|
|
|
|
@echo " fetch fetch HTML and PDF files from LAMMPS web site"
|
|
|
|
@echo " epub create ePUB format manual for e-book readers"
|
|
|
|
@echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)"
|
2018-08-23 10:24:51 +08:00
|
|
|
@echo " (requires ebook-convert tool from calibre)"
|
2020-02-22 15:27:18 +08:00
|
|
|
@echo " clean remove all intermediate RST files"
|
|
|
|
@echo " clean-all reset the entire build environment"
|
2017-03-17 10:21:55 +08:00
|
|
|
@echo " anchor_check scan for duplicate anchor labels"
|
2020-01-12 09:39:58 +08:00
|
|
|
@echo " style_check check for complete and consistent style lists"
|
2020-02-23 00:46:31 +08:00
|
|
|
@echo " package_check check for complete and consistent package lists"
|
2020-02-22 15:27:18 +08:00
|
|
|
@echo " spelling spell-check the manual"
|
2016-09-22 05:22:32 +08:00
|
|
|
|
|
|
|
# ------------------------------------------
|
2016-05-10 01:22:38 +08:00
|
|
|
|
2018-07-26 04:49:51 +08:00
|
|
|
clean-all: clean
|
2020-04-14 11:34:29 +08:00
|
|
|
rm -rf $(BUILDDIR)/docenv $(BUILDDIR)/doctrees $(BUILDDIR)/mathjax Manual.pdf Developer.pdf
|
2016-05-10 01:22:38 +08:00
|
|
|
|
2020-02-22 15:27:18 +08:00
|
|
|
clean: clean-spelling
|
2020-02-27 04:55:20 +08:00
|
|
|
rm -rf html epub latex
|
2017-03-06 10:23:41 +08:00
|
|
|
|
|
|
|
clean-spelling:
|
|
|
|
rm -rf spelling
|
2016-05-10 01:22:38 +08:00
|
|
|
|
2020-02-27 04:55:20 +08:00
|
|
|
html: $(ANCHORCHECK) $(MATHJAX)
|
2016-05-10 01:22:38 +08:00
|
|
|
@(\
|
2016-05-12 21:58:19 +08:00
|
|
|
. $(VENV)/bin/activate ;\
|
2017-12-08 04:38:15 +08:00
|
|
|
sphinx-build $(SPHINXEXTRA) -b html -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
2017-03-17 10:21:55 +08:00
|
|
|
echo "############################################" ;\
|
2019-11-06 03:01:48 +08:00
|
|
|
rst_anchor_check src/*.rst ;\
|
2020-02-23 00:46:31 +08:00
|
|
|
python utils/check-packages.py -s ../src -d src ;\
|
2019-11-06 03:01:48 +08:00
|
|
|
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
2020-01-12 09:39:58 +08:00
|
|
|
python utils/check-styles.py -s ../src -d src ;\
|
2017-03-17 10:21:55 +08:00
|
|
|
echo "############################################" ;\
|
2016-05-10 01:22:38 +08:00
|
|
|
deactivate ;\
|
2016-09-01 09:55:31 +08:00
|
|
|
)
|
2016-09-22 06:14:06 +08:00
|
|
|
@rm -rf html/_sources
|
|
|
|
@rm -rf html/PDF
|
|
|
|
@rm -rf html/USER
|
2020-02-11 05:21:19 +08:00
|
|
|
@rm -rf html/JPG
|
2016-09-22 06:14:06 +08:00
|
|
|
@cp -r src/PDF html/PDF
|
2020-02-11 05:21:19 +08:00
|
|
|
@mkdir -p html/JPG
|
2020-04-11 23:53:55 +08:00
|
|
|
@cp `grep -A2 '\.\. .*\(image\|figure\)::' src/*.rst | grep ':target:' | sed -e 's,.*:target: JPG/,src/JPG/,' | sort | uniq` html/JPG/
|
2016-09-22 06:14:06 +08:00
|
|
|
@rm -rf html/PDF/.[sg]*
|
2020-02-27 04:55:20 +08:00
|
|
|
@mkdir -p html/_static/mathjax
|
|
|
|
@cp -r $(MATHJAX)/es5 html/_static/mathjax/
|
2016-05-10 01:22:38 +08:00
|
|
|
@echo "Build finished. The HTML pages are in doc/html."
|
|
|
|
|
2020-02-23 02:49:57 +08:00
|
|
|
spelling: $(VENV) utils/sphinx-config/false_positives.txt
|
2017-03-06 10:23:41 +08:00
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
2020-04-06 09:36:06 +08:00
|
|
|
cp utils/sphinx-config/false_positives.txt $(RSTDIR)/ ; env PYTHONWARNINGS= \
|
2017-03-06 10:23:41 +08:00
|
|
|
sphinx-build -b spelling -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
|
|
|
deactivate ;\
|
|
|
|
)
|
|
|
|
@echo "Spell check finished."
|
|
|
|
|
2020-02-23 02:49:57 +08:00
|
|
|
epub: $(VENV)
|
2018-10-22 06:38:46 +08:00
|
|
|
@mkdir -p epub/JPG
|
2016-10-22 00:05:21 +08:00
|
|
|
@rm -f LAMMPS.epub
|
2016-10-21 04:16:17 +08:00
|
|
|
@cp src/JPG/lammps-logo.png epub/
|
2018-10-22 06:38:46 +08:00
|
|
|
@cp src/JPG/*.* epub/JPG
|
2016-10-20 21:27:26 +08:00
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
2017-12-08 04:38:15 +08:00
|
|
|
sphinx-build $(SPHINXEXTRA) -b epub -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
2016-10-20 21:27:26 +08:00
|
|
|
deactivate ;\
|
|
|
|
)
|
2016-10-22 00:05:21 +08:00
|
|
|
@mv epub/LAMMPS.epub .
|
2016-10-20 21:27:26 +08:00
|
|
|
@rm -rf epub
|
2016-10-22 00:05:21 +08:00
|
|
|
@echo "Build finished. The ePUB manual file is created."
|
2018-08-23 07:17:21 +08:00
|
|
|
|
|
|
|
mobi: epub
|
|
|
|
@rm -f LAMMPS.mobi
|
|
|
|
@ebook-convert LAMMPS.epub LAMMPS.mobi
|
|
|
|
@echo "Conversion finished. The MOBI manual file is created."
|
2016-10-20 21:27:26 +08:00
|
|
|
|
2020-01-24 05:56:41 +08:00
|
|
|
pdf: $(ANCHORCHECK)
|
2020-04-03 02:31:47 +08:00
|
|
|
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX was not found! Please check README.md for further instructions" 1>&2; exit 1; fi
|
2019-03-26 09:18:06 +08:00
|
|
|
@(\
|
|
|
|
cd src/Developer; \
|
|
|
|
pdflatex developer; \
|
|
|
|
pdflatex developer; \
|
|
|
|
mv developer.pdf ../../Developer.pdf; \
|
|
|
|
cd ../../; \
|
|
|
|
)
|
2019-02-07 08:56:09 +08:00
|
|
|
@(\
|
2020-01-13 01:34:54 +08:00
|
|
|
. $(VENV)/bin/activate ;\
|
|
|
|
sphinx-build $(SPHINXEXTRA) -b latex -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
|
|
|
echo "############################################" ;\
|
|
|
|
rst_anchor_check src/*.rst ;\
|
2020-02-23 00:46:31 +08:00
|
|
|
python utils/check-packages.py -s ../src -d src ;\
|
2020-01-12 09:39:58 +08:00
|
|
|
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
|
|
|
python utils/check-styles.py -s ../src -d src ;\
|
2020-01-13 01:34:54 +08:00
|
|
|
echo "############################################" ;\
|
|
|
|
deactivate ;\
|
2019-02-07 08:56:09 +08:00
|
|
|
)
|
|
|
|
@cd latex && \
|
2020-01-13 01:34:54 +08:00
|
|
|
sed 's/latexmk -pdf -dvi- -ps-/pdflatex/g' Makefile > temp && \
|
|
|
|
mv temp Makefile && \
|
|
|
|
sed 's/\\begin{equation}//g' LAMMPS.tex > tmp.tex && \
|
|
|
|
mv tmp.tex LAMMPS.tex && \
|
|
|
|
sed 's/\\end{equation}//g' LAMMPS.tex > tmp.tex && \
|
|
|
|
mv tmp.tex LAMMPS.tex && \
|
|
|
|
make && \
|
|
|
|
make && \
|
|
|
|
make && \
|
|
|
|
mv LAMMPS.pdf ../Manual.pdf && \
|
|
|
|
cd ../;
|
2019-02-07 08:56:09 +08:00
|
|
|
@rm -rf latex/_sources
|
|
|
|
@rm -rf latex/PDF
|
|
|
|
@rm -rf latex/USER
|
|
|
|
@cp -r src/PDF latex/PDF
|
|
|
|
@rm -rf latex/PDF/.[sg]*
|
|
|
|
@echo "Build finished. Manual.pdf and Developer.pdf are in this directory."
|
2016-05-10 22:07:05 +08:00
|
|
|
|
2016-09-22 05:22:32 +08:00
|
|
|
fetch:
|
2016-09-22 05:29:19 +08:00
|
|
|
@rm -rf html_www Manual_www.pdf Developer_www.pdf
|
|
|
|
@curl -s -o Manual_www.pdf http://lammps.sandia.gov/doc/Manual.pdf
|
|
|
|
@curl -s -o Developer_www.pdf http://lammps.sandia.gov/doc/Developer.pdf
|
2016-09-22 06:31:49 +08:00
|
|
|
@curl -s -o lammps-doc.tar.gz http://lammps.sandia.gov/tars/lammps-doc.tar.gz
|
|
|
|
@tar xzf lammps-doc.tar.gz
|
|
|
|
@rm -f lammps-doc.tar.gz
|
2016-09-22 05:22:32 +08:00
|
|
|
|
2017-03-23 02:40:30 +08:00
|
|
|
anchor_check : $(ANCHORCHECK)
|
2017-03-17 10:21:55 +08:00
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
2020-01-23 12:51:53 +08:00
|
|
|
rst_anchor_check src/*.rst ;\
|
2017-03-17 10:21:55 +08:00
|
|
|
deactivate ;\
|
|
|
|
)
|
|
|
|
|
2020-02-23 02:49:57 +08:00
|
|
|
style_check : $(VENV)
|
2020-01-12 09:39:58 +08:00
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
|
|
|
python utils/check-styles.py -s ../src -d src ;\
|
|
|
|
deactivate ;\
|
|
|
|
)
|
|
|
|
|
2020-02-23 02:49:57 +08:00
|
|
|
package_check : $(VENV)
|
2020-02-23 00:46:31 +08:00
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
|
|
|
python utils/check-packages.py -s ../src -d src ;\
|
|
|
|
deactivate ;\
|
|
|
|
)
|
|
|
|
|
2016-09-22 05:22:32 +08:00
|
|
|
# ------------------------------------------
|
|
|
|
|
2016-05-10 01:22:38 +08:00
|
|
|
$(VENV):
|
2016-10-13 23:40:44 +08:00
|
|
|
@if [ "$(HAS_PYTHON3)" == "NO" ] ; then echo "Python3 was not found! Please check README.md for further instructions" 1>&2; exit 1; fi
|
|
|
|
@if [ "$(HAS_VIRTUALENV)" == "NO" ] ; then echo "virtualenv was not found! Please check README.md for further instructions" 1>&2; exit 1; fi
|
2016-05-10 01:22:38 +08:00
|
|
|
@( \
|
2018-06-01 07:03:28 +08:00
|
|
|
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
|
2016-05-12 21:58:19 +08:00
|
|
|
. $(VENV)/bin/activate; \
|
2020-04-03 02:31:47 +08:00
|
|
|
pip install --upgrade pip; \
|
2020-04-14 10:55:20 +08:00
|
|
|
pip install Sphinx; \
|
2020-04-06 09:36:06 +08:00
|
|
|
pip install sphinxcontrib-spelling ;\
|
|
|
|
pip install breathe; \
|
2016-05-10 01:22:38 +08:00
|
|
|
deactivate;\
|
|
|
|
)
|
|
|
|
|
2020-02-22 15:27:18 +08:00
|
|
|
$(MATHJAX):
|
2020-02-27 04:55:20 +08:00
|
|
|
@git clone --depth 1 https://github.com/mathjax/MathJax.git mathjax
|
2020-02-22 15:27:18 +08:00
|
|
|
|
2017-03-23 02:40:30 +08:00
|
|
|
$(TXT2RST) $(ANCHORCHECK): $(VENV)
|
2016-05-10 01:22:38 +08:00
|
|
|
@( \
|
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;\
|
|
|
|
)
|