2016-05-10 01:22:38 +08:00
|
|
|
# Makefile for LAMMPS documentation
|
2016-09-22 04:50:23 +08:00
|
|
|
|
2016-09-22 05:22:32 +08:00
|
|
|
SHELL = /bin/bash
|
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)
|
2016-10-13 23:40:44 +08:00
|
|
|
HAS_PYTHON3 = NO
|
|
|
|
HAS_VIRTUALENV = 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
|
|
|
|
|
2016-10-13 23:40:44 +08:00
|
|
|
ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0)
|
|
|
|
HAS_VIRTUALENV = YES
|
2016-05-10 01:22:38 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
SOURCES=$(wildcard src/*.txt)
|
|
|
|
OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst)
|
|
|
|
|
2017-03-06 10:23:41 +08:00
|
|
|
.PHONY: help clean-all clean epub html pdf old venv spelling
|
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"
|
2016-09-22 05:22:32 +08:00
|
|
|
@echo " html create HTML doc pages in html dir"
|
|
|
|
@echo " pdf create Manual.pdf and Developer.pdf in this dir"
|
|
|
|
@echo " old create old-style HTML doc pages in old dir"
|
|
|
|
@echo " fetch fetch HTML and PDF files from LAMMPS web site"
|
2016-10-22 00:05:21 +08:00
|
|
|
@echo " epub create ePUB format manual for e-book readers"
|
2016-09-22 05:22:32 +08:00
|
|
|
@echo " clean remove all intermediate RST files"
|
|
|
|
@echo " clean-all reset the entire build environment"
|
|
|
|
@echo " txt2html build txt2html tool"
|
|
|
|
|
|
|
|
# ------------------------------------------
|
2016-05-10 01:22:38 +08:00
|
|
|
|
|
|
|
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:
|
2016-11-19 04:37:49 +08:00
|
|
|
rm -rf $(RSTDIR) html
|
2017-03-06 10:23:41 +08:00
|
|
|
rm -rf spelling
|
|
|
|
|
|
|
|
clean-spelling:
|
|
|
|
rm -rf spelling
|
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
|
2016-09-22 06:14:06 +08:00
|
|
|
@rm -rf html/_sources
|
|
|
|
@rm -rf html/PDF
|
|
|
|
@rm -rf html/USER
|
|
|
|
@cp -r src/PDF html/PDF
|
|
|
|
@cp -r src/USER html/USER
|
|
|
|
@rm -rf html/PDF/.[sg]*
|
|
|
|
@rm -rf html/USER/.[sg]*
|
|
|
|
@rm -rf html/USER/*/.[sg]*
|
|
|
|
@rm -rf html/USER/*/*.[sg]*
|
2016-05-10 01:22:38 +08:00
|
|
|
@echo "Build finished. The HTML pages are in doc/html."
|
|
|
|
|
2017-03-06 10:23:41 +08:00
|
|
|
spelling: $(OBJECTS) utils/sphinx-config/false_positives.txt
|
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
|
|
|
pip install sphinxcontrib-spelling ;\
|
|
|
|
cp -r src/* $(RSTDIR)/ ;\
|
|
|
|
cp utils/sphinx-config/false_positives.txt $(RSTDIR)/ ;\
|
|
|
|
sphinx-build -b spelling -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
|
|
|
deactivate ;\
|
|
|
|
)
|
|
|
|
@echo "Spell check finished."
|
|
|
|
|
2016-10-22 00:05:21 +08:00
|
|
|
epub: $(OBJECTS)
|
2016-10-21 04:16:17 +08:00
|
|
|
@mkdir -p epub
|
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/
|
2016-10-20 21:27:26 +08:00
|
|
|
@(\
|
|
|
|
. $(VENV)/bin/activate ;\
|
|
|
|
cp -r src/* $(RSTDIR)/ ;\
|
|
|
|
sphinx-build -j 8 -b epub -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
|
|
|
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."
|
2016-10-20 21:27:26 +08:00
|
|
|
|
2016-05-12 21:58:19 +08:00
|
|
|
pdf: utils/txt2html/txt2html.exe
|
|
|
|
@(\
|
|
|
|
cd src; \
|
|
|
|
../utils/txt2html/txt2html.exe -b *.txt; \
|
2016-09-22 05:26:00 +08:00
|
|
|
htmldoc --batch lammps.book; \
|
2016-05-12 21:58:19 +08:00
|
|
|
for s in `echo *.txt | sed -e 's,\.txt,\.html,g'` ; \
|
2016-09-22 05:26:00 +08:00
|
|
|
do grep -q $$s lammps.book || \
|
|
|
|
echo doc file $$s missing in src/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-09-22 05:22:32 +08:00
|
|
|
old: utils/txt2html/txt2html.exe
|
|
|
|
@rm -rf old
|
|
|
|
@mkdir old; mkdir old/Eqs; mkdir old/JPG; mkdir old/PDF
|
|
|
|
@cd src; ../utils/txt2html/txt2html.exe -b *.txt; \
|
|
|
|
mv *.html ../old; \
|
|
|
|
cp Eqs/*.jpg ../old/Eqs; \
|
|
|
|
cp JPG/* ../old/JPG; \
|
|
|
|
cp PDF/* ../old/PDF;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
txt2html: utils/txt2html/txt2html.exe
|
|
|
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
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):
|
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
|
|
|
@( \
|
|
|
|
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;\
|
|
|
|
)
|