blob: 54306a278cb2c78ae62647b7c2258393b8e5c466 [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
Stefan Reinauer37414ca2003-11-22 15:15:47 +00009
10FIGS=codeflow.pdf hypertransport.pdf
11
Martin Roth3b891022023-05-29 23:06:52 -060012all: sphinx corebootPortingGuide.pdf
Stefan Reinauer37414ca2003-11-22 15:15:47 +000013
Martin Rothfd8854e2023-02-10 09:56:40 -070014SVG2PDF=$(shell command -v svg2pdf)
15INKSCAPE=$(shell command -v inkscape)
16CONVERT=$(shell command -v convert)
Stefan Reinauer37414ca2003-11-22 15:15:47 +000017
Stefan Reinauerebf25892009-04-21 21:45:11 +000018codeflow.pdf: codeflow.svg
Uwe Hermann67ee8f82009-05-12 14:24:25 +000019ifneq ($(strip $(SVG2PDF)),)
Stefan Reinauerebf25892009-04-21 21:45:11 +000020 svg2pdf $< $@
Uwe Hermann67ee8f82009-05-12 14:24:25 +000021else ifneq ($(strip $(INKSCAPE)),)
22 inkscape $< --export-pdf=$@
23else ifneq ($(strip $(CONVERT)),)
24 convert $< $@
25endif
Stefan Reinauer37414ca2003-11-22 15:15:47 +000026
Stefan Reinauerebf25892009-04-21 21:45:11 +000027hypertransport.pdf: hypertransport.svg
Uwe Hermann67ee8f82009-05-12 14:24:25 +000028ifneq ($(strip $(SVG2PDF)),)
Stefan Reinauerebf25892009-04-21 21:45:11 +000029 svg2pdf $< $@
Uwe Hermann67ee8f82009-05-12 14:24:25 +000030else ifneq ($(strip $(INKSCAPE)),)
31 inkscape $< --export-pdf=$@
32else ifneq ($(strip $(CONVERT)),)
33 convert $< $@
34endif
Stefan Reinauer37414ca2003-11-22 15:15:47 +000035
Felix Singerf036b1d2023-06-16 06:26:05 +020036$(BUILDDIR):
37 mkdir -p $(BUILDDIR)
Martin Roth4d8da8e2023-05-29 23:09:54 -060038
Martin Roth4b18a922017-06-03 20:16:01 -060039corebootPortingGuide.toc: $(FIGS) corebootBuildingGuide.tex
Stefan Reinauer37414ca2003-11-22 15:15:47 +000040 # 2 times to make sure we have a current toc.
Martin Roth4b18a922017-06-03 20:16:01 -060041 $(PDFLATEX) corebootBuildingGuide.tex
42 $(PDFLATEX) corebootBuildingGuide.tex
Stefan Reinauer37414ca2003-11-22 15:15:47 +000043
Martin Roth4b18a922017-06-03 20:16:01 -060044corebootPortingGuide.pdf: $(FIGS) corebootBuildingGuide.tex corebootPortingGuide.toc
45 $(PDFLATEX) corebootBuildingGuide.tex
Stefan Reinauer37414ca2003-11-22 15:15:47 +000046
Felix Singerf036b1d2023-06-16 06:26:05 +020047sphinx: $(BUILDDIR)
48 $(MAKE) -f Makefile.sphinx html BUILDDIR="$(BUILDDIR)"
Jonathan Neuschäfer5e48c752018-04-19 16:23:56 +020049
50clean-sphinx:
Felix Singerf036b1d2023-06-16 06:26:05 +020051 $(MAKE) -f Makefile.sphinx clean BUILDDIR="$(BUILDDIR)"
Jonathan Neuschäfer5e48c752018-04-19 16:23:56 +020052
53clean: clean-sphinx
Jonathan Neuschäferbdebc892018-09-25 23:15:16 +020054 rm -f *.aux *.idx *.log *.toc *.out $(FIGS)
Stefan Reinauer37414ca2003-11-22 15:15:47 +000055
56distclean: clean
Jonathan Neuschäferbdebc892018-09-25 23:15:16 +020057 rm -f corebootPortingGuide.pdf
Tom Hiller651b11b2018-08-18 19:20:16 -040058
Felix Singerf036b1d2023-06-16 06:26:05 +020059livesphinx: $(BUILDDIR)
60 $(MAKE) -f Makefile.sphinx livehtml SPHINXOPTS="$(SPHINXOPTS)" BUILDDIR="$(BUILDDIR)"
Martin Rothe441b312023-05-29 23:02:10 -060061
Martin Roth34e43f62023-05-29 23:05:09 -060062test:
63 @echo "Test for logging purposes - Failing tests will not fail the build"
64 -$(MAKE) -f Makefile.sphinx clean && $(MAKE) -K -f Makefile.sphinx html
65 -$(MAKE) -f Makefile.sphinx clean && $(MAKE) -K -f Makefile.sphinx doctest
66
Martin Rothe441b312023-05-29 23:02:10 -060067help:
68 @echo "all - Builds coreboot porting guide PDF (outdated)"
69 @echo "sphinx - Builds html documentation in _build directory"
70 @echo "clean - Cleans intermediate files"
71 @echo "clean-sphinx - Removes sphinx output files"
72 @echo "distclean - Removes PDF files as well"
Martin Roth34e43f62023-05-29 23:05:09 -060073 @echo "test - Runs documentation tests"
Martin Rothe441b312023-05-29 23:02:10 -060074 @echo
75 @echo " Makefile.sphinx builds - run with $(MAKE) -f Makefile-sphinx [target]"
76 @echo
77 @$(MAKE) -s -f Makefile.sphinx help 2>/dev/null
78
79.phony: help livesphinx sphinx test
80.phony: distclean clean clean-sphinx