blob: 4d08c932b411741a25763a959c51f32486545966 [file] [log] [blame]
Martin Rothbfdb4892022-10-28 22:25:02 -06001## SPDX-License-Identifier: GPL-2.0-only
Stefan Reinauer37414ca2003-11-22 15:15:47 +00002#
Uwe Hermannd2a5a5a2009-04-18 14:18:20 +00003# Makefile for coreboot paper.
Stefan Reinauer37414ca2003-11-22 15:15:47 +00004# hacked together by Stefan Reinauer <stepan@openbios.org>
5#
6
Martin Roth4d8da8e2023-05-29 23:09:54 -06007PDFLATEX = pdflatex -t a4
Felix Singerf036b1d2023-06-16 06:26:05 +02008BUILDDIR ?= _build
Simon Glass7de2fa32023-08-21 13:08:00 -06009SPHINXOPTS ?= -j auto
10
11export SPHINXOPTS
Stefan Reinauer37414ca2003-11-22 15:15:47 +000012
13FIGS=codeflow.pdf hypertransport.pdf
14
Martin Roth3b891022023-05-29 23:06:52 -060015all: sphinx corebootPortingGuide.pdf
Stefan Reinauer37414ca2003-11-22 15:15:47 +000016
Martin Rothfd8854e2023-02-10 09:56:40 -070017SVG2PDF=$(shell command -v svg2pdf)
18INKSCAPE=$(shell command -v inkscape)
19CONVERT=$(shell command -v convert)
Stefan Reinauer37414ca2003-11-22 15:15:47 +000020
Stefan Reinauerebf25892009-04-21 21:45:11 +000021codeflow.pdf: codeflow.svg
Uwe Hermann67ee8f82009-05-12 14:24:25 +000022ifneq ($(strip $(SVG2PDF)),)
Stefan Reinauerebf25892009-04-21 21:45:11 +000023 svg2pdf $< $@
Uwe Hermann67ee8f82009-05-12 14:24:25 +000024else ifneq ($(strip $(INKSCAPE)),)
25 inkscape $< --export-pdf=$@
26else ifneq ($(strip $(CONVERT)),)
27 convert $< $@
28endif
Stefan Reinauer37414ca2003-11-22 15:15:47 +000029
Stefan Reinauerebf25892009-04-21 21:45:11 +000030hypertransport.pdf: hypertransport.svg
Uwe Hermann67ee8f82009-05-12 14:24:25 +000031ifneq ($(strip $(SVG2PDF)),)
Stefan Reinauerebf25892009-04-21 21:45:11 +000032 svg2pdf $< $@
Uwe Hermann67ee8f82009-05-12 14:24:25 +000033else ifneq ($(strip $(INKSCAPE)),)
34 inkscape $< --export-pdf=$@
35else ifneq ($(strip $(CONVERT)),)
36 convert $< $@
37endif
Stefan Reinauer37414ca2003-11-22 15:15:47 +000038
Felix Singerf036b1d2023-06-16 06:26:05 +020039$(BUILDDIR):
40 mkdir -p $(BUILDDIR)
Martin Roth4d8da8e2023-05-29 23:09:54 -060041
Martin Roth4b18a922017-06-03 20:16:01 -060042corebootPortingGuide.toc: $(FIGS) corebootBuildingGuide.tex
Stefan Reinauer37414ca2003-11-22 15:15:47 +000043 # 2 times to make sure we have a current toc.
Martin Roth4b18a922017-06-03 20:16:01 -060044 $(PDFLATEX) corebootBuildingGuide.tex
45 $(PDFLATEX) corebootBuildingGuide.tex
Stefan Reinauer37414ca2003-11-22 15:15:47 +000046
Martin Roth4b18a922017-06-03 20:16:01 -060047corebootPortingGuide.pdf: $(FIGS) corebootBuildingGuide.tex corebootPortingGuide.toc
48 $(PDFLATEX) corebootBuildingGuide.tex
Stefan Reinauer37414ca2003-11-22 15:15:47 +000049
Felix Singerf036b1d2023-06-16 06:26:05 +020050sphinx: $(BUILDDIR)
51 $(MAKE) -f Makefile.sphinx html BUILDDIR="$(BUILDDIR)"
Jonathan Neuschäfer5e48c752018-04-19 16:23:56 +020052
53clean-sphinx:
Felix Singerf036b1d2023-06-16 06:26:05 +020054 $(MAKE) -f Makefile.sphinx clean BUILDDIR="$(BUILDDIR)"
Jonathan Neuschäfer5e48c752018-04-19 16:23:56 +020055
56clean: clean-sphinx
Jonathan Neuschäferbdebc892018-09-25 23:15:16 +020057 rm -f *.aux *.idx *.log *.toc *.out $(FIGS)
Stefan Reinauer37414ca2003-11-22 15:15:47 +000058
59distclean: clean
Jonathan Neuschäferbdebc892018-09-25 23:15:16 +020060 rm -f corebootPortingGuide.pdf
Tom Hiller651b11b2018-08-18 19:20:16 -040061
Felix Singerf036b1d2023-06-16 06:26:05 +020062livesphinx: $(BUILDDIR)
Simon Glass7de2fa32023-08-21 13:08:00 -060063 $(MAKE) -f Makefile.sphinx livehtml BUILDDIR="$(BUILDDIR)"
Martin Rothe441b312023-05-29 23:02:10 -060064
Martin Roth34e43f62023-05-29 23:05:09 -060065test:
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 Rothe441b312023-05-29 23:02:10 -060070help:
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 Roth34e43f62023-05-29 23:05:09 -060076 @echo "test - Runs documentation tests"
Martin Rothe441b312023-05-29 23:02:10 -060077 @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