improve portability of docs makefile
- detect if /bin/bash is not found and provide a suitable error message - use $(MAKE) and $(MFLAGS) variables to handle cases where GNU make is not called "make"
This commit is contained in:
18
doc/Makefile
18
doc/Makefile
@ -1,6 +1,12 @@
|
||||
# Makefile for LAMMPS documentation
|
||||
|
||||
SHELL = /bin/bash
|
||||
HAS_BASH = YES
|
||||
ifeq (,$(wildcard $(SHELL)))
|
||||
OSHELL := $(SHELL)
|
||||
override SHELL = /bin/sh
|
||||
HAS_BASH = NO
|
||||
endif
|
||||
BUILDDIR = ${CURDIR}
|
||||
RSTDIR = $(BUILDDIR)/src
|
||||
VENV = $(BUILDDIR)/docenv
|
||||
@ -55,6 +61,7 @@ DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+
|
||||
# ------------------------------------------
|
||||
|
||||
help:
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html create HTML doc pages in html dir"
|
||||
@echo " pdf create Manual.pdf in this dir"
|
||||
@ -87,6 +94,7 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in
|
||||
-e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@
|
||||
|
||||
html: xmlgen $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) $(POLYFILL)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||
@ -110,6 +118,7 @@ html: xmlgen $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) $(POLYFILL)
|
||||
@echo "Build finished. The HTML pages are in doc/html."
|
||||
|
||||
spelling: xmlgen $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@(\
|
||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
||||
cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/ ; env PYTHONWARNINGS= \
|
||||
@ -120,6 +129,7 @@ spelling: xmlgen $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||
@echo "Spell check finished."
|
||||
|
||||
epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@mkdir -p epub/JPG
|
||||
@rm -f LAMMPS.epub
|
||||
@ -140,6 +150,7 @@ mobi: epub
|
||||
@echo "Conversion finished. The MOBI manual file is created."
|
||||
|
||||
pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX was not found! Please check README.md for further instructions" 1>&2; exit 1; fi
|
||||
@(\
|
||||
@ -161,9 +172,9 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
||||
mv tmp.tex LAMMPS.tex && \
|
||||
sed 's/\\end{equation}//g' LAMMPS.tex > tmp.tex && \
|
||||
mv tmp.tex LAMMPS.tex && \
|
||||
make && \
|
||||
make && \
|
||||
make && \
|
||||
$(MAKE) $(MFLAGS) && \
|
||||
$(MAKE) $(MFLAGS) && \
|
||||
$(make) $(MFLAGS) && \
|
||||
mv LAMMPS.pdf ../Manual.pdf && \
|
||||
cd ../;
|
||||
@rm -rf latex/_sources
|
||||
@ -211,6 +222,7 @@ doxygen/xml/index.xml : $(VENV) doxygen/Doxyfile $(DOXYFILES)
|
||||
# ------------------------------------------
|
||||
|
||||
$(VENV):
|
||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||
@if [ "$(HAS_PYTHON3)" == "NO" ] ; then echo "python3 was not found! Please see README for further instructions" 1>&2; exit 1; fi
|
||||
@if [ "$(HAS_DOXYGEN)" == "NO" ] ; then echo "doxygen was not found! Please see README for further instructions" 1>&2; exit 1; fi
|
||||
@if [ "$(HAS_VIRTUALENV)" == "NO" ] ; then echo "virtualenv was not found! Please see README for further instructions" 1>&2; exit 1; fi
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
# Makefile for generating images with graphviz
|
||||
#
|
||||
SHELL = /bin/bash
|
||||
BUILDDIR = ${CURDIR}/..
|
||||
IMGDIR = $(BUILDDIR)/src/JPG
|
||||
IMGSRC = $(wildcard *.dot)
|
||||
|
||||
Reference in New Issue
Block a user