Martin Roth | bfdb489 | 2022-10-28 22:25:02 -0600 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 2 | # |
Uwe Hermann | d2a5a5a | 2009-04-18 14:18:20 +0000 | [diff] [blame] | 3 | # Makefile for coreboot paper. |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 4 | # hacked together by Stefan Reinauer <stepan@openbios.org> |
| 5 | # |
| 6 | |
Martin Roth | 4d8da8e | 2023-05-29 23:09:54 -0600 | [diff] [blame] | 7 | PDFLATEX = pdflatex -t a4 |
Felix Singer | f036b1d | 2023-06-16 06:26:05 +0200 | [diff] [blame] | 8 | BUILDDIR ?= _build |
Simon Glass | 7de2fa3 | 2023-08-21 13:08:00 -0600 | [diff] [blame] | 9 | SPHINXOPTS ?= -j auto |
| 10 | |
| 11 | export SPHINXOPTS |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 12 | |
| 13 | FIGS=codeflow.pdf hypertransport.pdf |
| 14 | |
Martin Roth | 3b89102 | 2023-05-29 23:06:52 -0600 | [diff] [blame] | 15 | all: sphinx corebootPortingGuide.pdf |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 16 | |
Martin Roth | fd8854e | 2023-02-10 09:56:40 -0700 | [diff] [blame] | 17 | SVG2PDF=$(shell command -v svg2pdf) |
| 18 | INKSCAPE=$(shell command -v inkscape) |
| 19 | CONVERT=$(shell command -v convert) |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 20 | |
Stefan Reinauer | ebf2589 | 2009-04-21 21:45:11 +0000 | [diff] [blame] | 21 | codeflow.pdf: codeflow.svg |
Uwe Hermann | 67ee8f8 | 2009-05-12 14:24:25 +0000 | [diff] [blame] | 22 | ifneq ($(strip $(SVG2PDF)),) |
Stefan Reinauer | ebf2589 | 2009-04-21 21:45:11 +0000 | [diff] [blame] | 23 | svg2pdf $< $@ |
Uwe Hermann | 67ee8f8 | 2009-05-12 14:24:25 +0000 | [diff] [blame] | 24 | else ifneq ($(strip $(INKSCAPE)),) |
| 25 | inkscape $< --export-pdf=$@ |
| 26 | else ifneq ($(strip $(CONVERT)),) |
| 27 | convert $< $@ |
| 28 | endif |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 29 | |
Stefan Reinauer | ebf2589 | 2009-04-21 21:45:11 +0000 | [diff] [blame] | 30 | hypertransport.pdf: hypertransport.svg |
Uwe Hermann | 67ee8f8 | 2009-05-12 14:24:25 +0000 | [diff] [blame] | 31 | ifneq ($(strip $(SVG2PDF)),) |
Stefan Reinauer | ebf2589 | 2009-04-21 21:45:11 +0000 | [diff] [blame] | 32 | svg2pdf $< $@ |
Uwe Hermann | 67ee8f8 | 2009-05-12 14:24:25 +0000 | [diff] [blame] | 33 | else ifneq ($(strip $(INKSCAPE)),) |
| 34 | inkscape $< --export-pdf=$@ |
| 35 | else ifneq ($(strip $(CONVERT)),) |
| 36 | convert $< $@ |
| 37 | endif |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 38 | |
Felix Singer | f036b1d | 2023-06-16 06:26:05 +0200 | [diff] [blame] | 39 | $(BUILDDIR): |
| 40 | mkdir -p $(BUILDDIR) |
Martin Roth | 4d8da8e | 2023-05-29 23:09:54 -0600 | [diff] [blame] | 41 | |
Martin Roth | 4b18a92 | 2017-06-03 20:16:01 -0600 | [diff] [blame] | 42 | corebootPortingGuide.toc: $(FIGS) corebootBuildingGuide.tex |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 43 | # 2 times to make sure we have a current toc. |
Martin Roth | 4b18a92 | 2017-06-03 20:16:01 -0600 | [diff] [blame] | 44 | $(PDFLATEX) corebootBuildingGuide.tex |
| 45 | $(PDFLATEX) corebootBuildingGuide.tex |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 46 | |
Martin Roth | 4b18a92 | 2017-06-03 20:16:01 -0600 | [diff] [blame] | 47 | corebootPortingGuide.pdf: $(FIGS) corebootBuildingGuide.tex corebootPortingGuide.toc |
| 48 | $(PDFLATEX) corebootBuildingGuide.tex |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 49 | |
Felix Singer | f036b1d | 2023-06-16 06:26:05 +0200 | [diff] [blame] | 50 | sphinx: $(BUILDDIR) |
| 51 | $(MAKE) -f Makefile.sphinx html BUILDDIR="$(BUILDDIR)" |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 52 | |
| 53 | clean-sphinx: |
Felix Singer | f036b1d | 2023-06-16 06:26:05 +0200 | [diff] [blame] | 54 | $(MAKE) -f Makefile.sphinx clean BUILDDIR="$(BUILDDIR)" |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 55 | |
| 56 | clean: clean-sphinx |
Jonathan Neuschäfer | bdebc89 | 2018-09-25 23:15:16 +0200 | [diff] [blame] | 57 | rm -f *.aux *.idx *.log *.toc *.out $(FIGS) |
Stefan Reinauer | 37414ca | 2003-11-22 15:15:47 +0000 | [diff] [blame] | 58 | |
| 59 | distclean: clean |
Jonathan Neuschäfer | bdebc89 | 2018-09-25 23:15:16 +0200 | [diff] [blame] | 60 | rm -f corebootPortingGuide.pdf |
Tom Hiller | 651b11b | 2018-08-18 19:20:16 -0400 | [diff] [blame] | 61 | |
Felix Singer | f036b1d | 2023-06-16 06:26:05 +0200 | [diff] [blame] | 62 | livesphinx: $(BUILDDIR) |
Simon Glass | 7de2fa3 | 2023-08-21 13:08:00 -0600 | [diff] [blame] | 63 | $(MAKE) -f Makefile.sphinx livehtml BUILDDIR="$(BUILDDIR)" |
Martin Roth | e441b31 | 2023-05-29 23:02:10 -0600 | [diff] [blame] | 64 | |
Martin Roth | 34e43f6 | 2023-05-29 23:05:09 -0600 | [diff] [blame] | 65 | test: |
| 66 | @echo "Test for logging purposes - Failing tests will not fail the build" |
| 67 | -$(MAKE) -f Makefile.sphinx clean && $(MAKE) -K -f Makefile.sphinx html |
| 68 | -$(MAKE) -f Makefile.sphinx clean && $(MAKE) -K -f Makefile.sphinx doctest |
| 69 | |
Martin Roth | e441b31 | 2023-05-29 23:02:10 -0600 | [diff] [blame] | 70 | help: |
| 71 | @echo "all - Builds coreboot porting guide PDF (outdated)" |
| 72 | @echo "sphinx - Builds html documentation in _build directory" |
| 73 | @echo "clean - Cleans intermediate files" |
| 74 | @echo "clean-sphinx - Removes sphinx output files" |
| 75 | @echo "distclean - Removes PDF files as well" |
Martin Roth | 34e43f6 | 2023-05-29 23:05:09 -0600 | [diff] [blame] | 76 | @echo "test - Runs documentation tests" |
Martin Roth | e441b31 | 2023-05-29 23:02:10 -0600 | [diff] [blame] | 77 | @echo |
| 78 | @echo " Makefile.sphinx builds - run with $(MAKE) -f Makefile-sphinx [target]" |
| 79 | @echo |
| 80 | @$(MAKE) -s -f Makefile.sphinx help 2>/dev/null |
| 81 | |
| 82 | .phony: help livesphinx sphinx test |
| 83 | .phony: distclean clean clean-sphinx |