E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 1 | #================================================================================== |
| 2 | # Copyright (c) 2020 Nokia |
| 3 | # Copyright (c) 2020 AT&T Intellectual Property. |
| 4 | # |
| 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 |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 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 | #================================================================================== |
| 17 | |
| 18 | # this uses {X}fm which can be cloned from: https://gitlab.com/rouxware/xfm |
| 19 | |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame^] | 20 | XPATH=XFM_PATH=.:/usr/local/share/xfm TFM_PATH=.:/usr/local/share/xfm |
| 21 | |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 22 | docs = user_guide |
| 23 | src = user_guide.xfm |
E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 24 | imbed_src = cpp_frame.im example1.im example2.im example3.im jhash.im |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 25 | desired_out = rst ps |
| 26 | |
| 27 | # use care: the output type is used to source the macros based on the type |
| 28 | # of output being rendered. |
| 29 | # Two pass builds allow for table of contents gen/insert, forward var |
| 30 | # references etc. |
| 31 | # |
| 32 | %.ps: %.xfm |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame^] | 33 | $(XPATH) OUTPUT_TYPE=generic_ps XFM_PASS=1 pfm $< /dev/null |
| 34 | $(XPATH) OUTPUT_TYPE=generic_ps XFM_PASS=2 pfm $< $@ |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 35 | |
| 36 | %.md: %.xfm |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame^] | 37 | $(XPATH) OUTPUT_TYPE=markdown XFM_PASS=1 tfm $< /dev/null |
| 38 | $(XPATH) OUTPUT_TYPE=markdown XFM_PASS=2 tfm $< | sed 's/^ //' >$@ |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 39 | |
| 40 | %.rst: %.xfm |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame^] | 41 | $(XPATH) OUTPUT_TYPE=rst XFM_PASS=1 tfm $< /dev/null |
| 42 | $(XPATH) GEN_TITLE=1 OUTPUT_TYPE=rst XFM_PASS=2 tfm $< | sed 's/^ //; s/ *$$//' >$@ |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 43 | |
| 44 | %.txt: %.xfm |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame^] | 45 | $(XPATH) OUTPUT_TYPE=txt XFM_PASS=1 tfm $< /dev/null |
| 46 | $(XPATH) OUTPUT_TYPE=txt XFM_PASS=2 tfm $< $@ |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 47 | |
| 48 | # ----------------------------------------------------------------------------------- |
| 49 | all: $(desired_out:%=user_guide.%) |
| 50 | |
| 51 | user_guide.ps: user_guide.xfm $(imbed_src) |
| 52 | |
| 53 | # we force the .rst docs to always be out of date so that we don't have to |
| 54 | # jump hoops to ensure that they build for make publish. (See hack rule |
| 55 | # at the end of the file.) |
| 56 | # |
| 57 | $(docs:%=%.rst): always |
| 58 | |
| 59 | publish: user_guide.rst |
E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 60 | cp user_guide.rst ../../../docs/user-guide.rst |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 61 | |
| 62 | # intermeidate junk that might straggle |
| 63 | clean: |
| 64 | rm -fr *.bcnfile *.ca *.ecnfile *.sp |
| 65 | |
| 66 | # Destroy anything that can be built |
| 67 | nuke: clean |
| 68 | rm -fr *.md *.ps *.pdf *.txt *.rst *.toc |
| 69 | |
| 70 | # make hack to force a rule to always be out of date |
| 71 | always: |
| 72 | |