1 #=================================================================================2
2 # Copyright (c) 2019-2020 Nokia
3 # Copyright (c) 2018-2020 AT&T Intellectual Property.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #==================================================================================
22 # ----- generics --------------------------------------------------------
23 # two pass builds in order to forward reference variables for figures and to insert
24 # table of contents in postscript output
27 $(P1) pfm $< /dev/null
31 $(P1) OUTPUT_TYPE=markdown tfm $< /dev/null
32 $(P2) OUTPUT_TYPE=markdown tfm $< stdout | sed 's/^ //' >$@
35 $(P1) OUTPUT_TYPE=rst tfm $< /dev/null
36 $(P2) OUTPUT_TYPE=rst tfm $< stdout | sed 's/^ //' >$@
39 $(P1) OUTPUT_TYPE=txt tfm $< /dev/null
40 $(P2) OUTPUT_TYPE=txt tfm $< $@
43 $(P1) OUTPUT_TYPE=html hfm $< /dev/null
44 $(P2) OUTPUT_TYPE=html hfm $< $@
47 gs -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$@ $<
50 # ----- lists --------------------------------------------------------
51 # source common to all documents
52 common_src = index_snatch.im setup.im mbuf.im front_junk.im license.im
54 user_src = user.xfm advanced_use.im api_qref.im code_appendix.im code_send.im \
55 config.im failures.im general_use.im glossary.im
57 # user guide code examples
58 code_src = $(shell ls code_*.im)
60 rt_src = rt_tables.xfm
62 # output types for different builds
63 all_types = pdf md rst txt html
67 # ------ rules --------------------------------------------------------
68 all: $(all_types:%=user.%) $(all_types:%=rt_tables.%)
69 mv user.rst user-guide.rst
71 # just the things which are pushed to the docs scraper dirctory,
72 # renames to expected filenames where required.
73 docs: $(rtd_types:%=user.%) $(rtd_types:%=rt_tables.%)
74 mv user.rst user-guide.rst
76 # dependencies; actual recipes are generic
77 $(all_types:%=user.%): $(user_src) $(code_src) $(common_src)
78 $(all_types:%=rt_tables.%): $(rt_src) $(common_src)
81 # ---------- housekeeping ----------------------------------------------
82 # remove only intermeidate junk that might straggle; leave output
84 rm -fr *.bcnfile *.ca *.ecnfile *.sp *.toc
86 # Remove anything that can be built
88 rm -fr *.ps *.pdf *.txt *.rst *.md *.html