docs-rst: media: build SVG from graphviz files
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 30 Nov 2016 10:00:17 +0000 (08:00 -0200)
committerJonathan Corbet <corbet@lwn.net>
Thu, 1 Dec 2016 00:07:54 +0000 (17:07 -0700)
Instead of keeping both SVG and graphviz files, dynamically
build SVG from its graphviz sources.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Documentation/media/.gitignore
Documentation/media/Makefile
Documentation/media/uapi/v4l/pipeline.svg [deleted file]

index a1363379944a5745ceb49c0e493d80eb9335c79a..08b21de3ef94bdb6b92aaa5280d0c4eb2b48e70d 100644 (file)
@@ -1 +1,3 @@
 *.pdf
+# Files generated from *.dot
+uapi/v4l/pipeline.svg
index 998e8dd493525d6e34fc751ed4db3d0f11f0783a..547b4105f826935990e15676173cedadeb52c541 100644 (file)
@@ -10,6 +10,9 @@ FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
 
 TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
 
+DOTS = \
+       uapi/v4l/pipeline.dot \
+
 IMAGES = \
        typical_media_device.svg \
        uapi/dvb/dvbstb.svg \
@@ -29,8 +32,10 @@ IMAGES = \
        uapi/v4l/vbi_625.svg \
        uapi/v4l/vbi_hsync.svg \
 
+DOTTGT := $(patsubst %.dot,%.svg,$(DOTS))
+IMGDOT := $(patsubst %,$(SRC_DIR)/%,$(DOTTGT))
 
-IMGTGT := $(patsubst %.png,%.pdf,$(patsubst %.svg,%.pdf,$(IMAGES)))
+IMGTGT := $(patsubst %.svg,%.pdf,$(IMAGES))
 IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))
 
 cmd = $(echo-cmd) $(cmd_$(1))
@@ -38,19 +43,25 @@ cmd = $(echo-cmd) $(cmd_$(1))
 quiet_cmd_genpdf = GENPDF  $2
       cmd_genpdf = convert $2 $3
 
+quiet_cmd_gendot = DOT     $2
+      cmd_gendot = dot -Tsvg $2 > $3
+
 %.pdf: %.svg
        @$(call cmd,genpdf,$<,$@)
 
+%.svg: %.dot
+       @$(call cmd,gendot,$<,$@)
+
 .PHONY: all html epub xml latex
 
-all: $(BUILDDIR) ${TARGETS}
+all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
 html: all
 epub: all
 xml: all
 latex: $(IMGPDF) all
 
 clean:
-       -rm -f $(IMGTGT) 2>/dev/null
+       -rm -f $(DOTTGT) $(IMGTGT) $(patsubst %,$(SRC_DIR)/%,${TARGETS}) 2>/dev/null
 
 $(BUILDDIR):
        $(Q)mkdir -p $@
@@ -95,6 +106,3 @@ $(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
 
 $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
        @$($(quiet)gen_rst)
-
-cleandocs:
-       -rm -f ${TARGETS}
diff --git a/Documentation/media/uapi/v4l/pipeline.svg b/Documentation/media/uapi/v4l/pipeline.svg
deleted file mode 100644 (file)
index 70f4c1b..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<!-- Generated by graphviz version 2.38.0 (20140413.2041)
- -->
-<!-- Title: board Pages: 1 -->
-<svg width="317pt" height="358pt"
- viewBox="0.00 0.00 317.00 358.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 354)">
-<title>board</title>
-<polygon fill="white" stroke="none" points="-4,4 -4,-354 313,-354 313,4 -4,4"/>
-<!-- scaler -->
-<g id="node1" class="node"><title>scaler</title>
-<path fill="lightblue" stroke="black" d="M154,-103.5C154,-103.5 226,-103.5 226,-103.5 232,-103.5 238,-109.5 238,-115.5 238,-115.5 238,-129.5 238,-129.5 238,-135.5 232,-141.5 226,-141.5 226,-141.5 154,-141.5 154,-141.5 148,-141.5 142,-135.5 142,-129.5 142,-129.5 142,-115.5 142,-115.5 142,-109.5 148,-103.5 154,-103.5"/>
-<text text-anchor="middle" x="153.5" y="-118.8" font-family="Times,serif" font-size="14.00">0</text>
-<polyline fill="none" stroke="black" points="165,-103.5 165,-141.5 "/>
-<text text-anchor="middle" x="190" y="-126.3" font-family="Times,serif" font-size="14.00">Host</text>
-<text text-anchor="middle" x="190" y="-111.3" font-family="Times,serif" font-size="14.00">Scaler</text>
-<polyline fill="none" stroke="black" points="215,-103.5 215,-141.5 "/>
-<text text-anchor="middle" x="226.5" y="-118.8" font-family="Times,serif" font-size="14.00">1</text>
-</g>
-<!-- io -->
-<g id="node4" class="node"><title>io</title>
-<path fill="aquamarine" stroke="black" d="M228,-0.5C228,-0.5 290,-0.5 290,-0.5 296,-0.5 302,-6.5 302,-12.5 302,-12.5 302,-24.5 302,-24.5 302,-30.5 296,-36.5 290,-36.5 290,-36.5 228,-36.5 228,-36.5 222,-36.5 216,-30.5 216,-24.5 216,-24.5 216,-12.5 216,-12.5 216,-6.5 222,-0.5 228,-0.5"/>
-<text text-anchor="middle" x="227.5" y="-14.8" font-family="Times,serif" font-size="14.00">0</text>
-<polyline fill="none" stroke="black" points="239,-0.5 239,-36.5 "/>
-<text text-anchor="middle" x="270.5" y="-14.8" font-family="Times,serif" font-size="14.00">V4L I/O</text>
-</g>
-<!-- scaler&#45;&gt;io -->
-<g id="edge3" class="edge"><title>scaler:scaler_1&#45;&gt;io:io_0</title>
-<path fill="none" stroke="blue" d="M227,-103C227,-77.3333 227,-68.5104 227,-47.0547"/>
-<polygon fill="blue" stroke="blue" points="230.5,-47 227,-37 223.5,-47 230.5,-47"/>
-<text text-anchor="middle" x="268" y="-73.8" font-family="Times,serif" font-size="14.00">HQ: 1280x720</text>
-<text text-anchor="middle" x="268" y="-58.8" font-family="Times,serif" font-size="14.00">HS: 1280x720</text>
-</g>
-<!-- frontend -->
-<g id="node2" class="node"><title>frontend</title>
-<path fill="lightblue" stroke="black" d="M65.5,-208.5C65.5,-208.5 152.5,-208.5 152.5,-208.5 158.5,-208.5 164.5,-214.5 164.5,-220.5 164.5,-220.5 164.5,-234.5 164.5,-234.5 164.5,-240.5 158.5,-246.5 152.5,-246.5 152.5,-246.5 65.5,-246.5 65.5,-246.5 59.5,-246.5 53.5,-240.5 53.5,-234.5 53.5,-234.5 53.5,-220.5 53.5,-220.5 53.5,-214.5 59.5,-208.5 65.5,-208.5"/>
-<text text-anchor="middle" x="65" y="-223.8" font-family="Times,serif" font-size="14.00">0</text>
-<polyline fill="none" stroke="black" points="76.5,-208.5 76.5,-246.5 "/>
-<text text-anchor="middle" x="109" y="-231.3" font-family="Times,serif" font-size="14.00">Host</text>
-<text text-anchor="middle" x="109" y="-216.3" font-family="Times,serif" font-size="14.00">Frontend</text>
-<polyline fill="none" stroke="black" points="141.5,-208.5 141.5,-246.5 "/>
-<text text-anchor="middle" x="153" y="-223.8" font-family="Times,serif" font-size="14.00">1</text>
-</g>
-<!-- frontend&#45;&gt;scaler -->
-<g id="edge2" class="edge"><title>frontend:frontend_1&#45;&gt;scaler:scaler_0</title>
-<path fill="none" stroke="blue" d="M153,-208C153,-182.333 153,-173.51 153,-152.055"/>
-<polygon fill="blue" stroke="blue" points="156.5,-152 153,-142 149.5,-152 156.5,-152"/>
-<text text-anchor="middle" x="197" y="-178.8" font-family="Times,serif" font-size="14.00">HQ: 2592x1968</text>
-<text text-anchor="middle" x="197" y="-163.8" font-family="Times,serif" font-size="14.00">HS: 1296x984</text>
-</g>
-<!-- sensor -->
-<g id="node3" class="node"><title>sensor</title>
-<path fill="aquamarine" stroke="black" d="M12,-313.5C12,-313.5 64,-313.5 64,-313.5 70,-313.5 76,-319.5 76,-325.5 76,-325.5 76,-337.5 76,-337.5 76,-343.5 70,-349.5 64,-349.5 64,-349.5 12,-349.5 12,-349.5 6,-349.5 0,-343.5 0,-337.5 0,-337.5 0,-325.5 0,-325.5 0,-319.5 6,-313.5 12,-313.5"/>
-<text text-anchor="middle" x="26.5" y="-327.8" font-family="Times,serif" font-size="14.00">Sensor</text>
-<polyline fill="none" stroke="black" points="53,-313.5 53,-349.5 "/>
-<text text-anchor="middle" x="64.5" y="-327.8" font-family="Times,serif" font-size="14.00">0</text>
-</g>
-<!-- sensor&#45;&gt;frontend -->
-<g id="edge1" class="edge"><title>sensor:sensor_0&#45;&gt;frontend:frontend_0</title>
-<path fill="none" stroke="blue" d="M65,-313C65,-287.333 65,-278.51 65,-257.055"/>
-<polygon fill="blue" stroke="blue" points="68.5001,-257 65,-247 61.5001,-257 68.5001,-257"/>
-<text text-anchor="middle" x="109" y="-283.8" font-family="Times,serif" font-size="14.00">HQ: 2592x1968</text>
-<text text-anchor="middle" x="109" y="-268.8" font-family="Times,serif" font-size="14.00">HS: 1296x984</text>
-</g>
-</g>
-</svg>