cleaning out the closet
[platform/upstream/gstreamer.git] / docs / manuals.mak
1 # rewritten by Thomas to be more simple and working
2
3 # SF username
4 USERNAME ?= thomasvs
5
6 ### These are all generic; we set all the variables we need
7
8 # intermediary build path
9 BUILDDIR = build
10 # same for images
11 BUILDIMAGESDIR = $(BUILDDIR)/images
12
13 # images
14 # right now, we only allow .png and .fig as source
15 # we might add more later if we feel the need
16
17 # PNG's can be source or built from .fig
18 PNG = $(strip $(PNG_SRC) $(FIG_SRC:.fig=.png))
19 # EPS .ps files can be built from .png or .fig
20 EPS = $(strip $(FIG_SRC:.fig=.ps) $(PNG_SRC:.png=.ps))
21 # PDF .pdf files can be built from .png or .fig
22 PDF = $(strip $(FIG_SRC:.fig=.pdf) $(PNG_SRC:.png=.pdf))
23
24 # where we expect to find images during building, whether by copying
25 # or by generating them
26 PNG_BUILT = $(foreach file, $(PNG), $(BUILDIMAGESDIR)/$(file))
27 EPS_BUILT = $(foreach file, $(EPS), $(BUILDIMAGESDIR)/$(file))
28 PDF_BUILT = $(foreach file, $(PDF), $(BUILDIMAGESDIR)/$(file))
29
30 # everything considered source
31 SRC = $(XML) $(PNG_SRC) $(FIG_SRC) $(CSS)
32
33 # generate A4 docs
34 PAPER_LOCALE = nl_NL
35
36 ### generate all documentation by default
37 all: html ps pdf
38
39 # can we generate HTML ?
40 if     DOC_HTML
41 HTML_DAT = html
42 html: html/index.html
43 else  #!DOC_HTML
44 HTML_DAT =
45 html:
46 endif #DOC_HTML
47
48 # can we generate PS ?
49 if     DOC_PS
50 PS_DAT = $(DOC).ps
51 ps: $(DOC).ps
52 else  #!DOC_PS
53 PS_DAT =
54 ps:
55 endif #DOC_PS
56
57 # can we generate PDF ?
58 if     DOC_PDF
59 PDF_DAT = $(DOC).pdf
60 pdf: $(DOC).pdf
61 else  #!DOC_PDF
62 PDF_DAT =
63 pdf:
64 endif #DOC_PDF
65
66 debug:
67         @echo "outputting some useful debug information"
68         @echo "Source XML:"
69         @echo "XML: '$(XML)'"
70         @echo "CSS: '$(CSS)'"
71         @echo "Source image files:"
72         @echo "PNG_SRC: '$(PNG_SRC)'"
73         @echo "FIG_SRC: '$(FIG_SRC)'"
74         @echo "All used image files:"
75         @echo "PNG: '$(PNG)'"
76         @echo "EPS: '$(EPS)'"
77         @echo "PDF: '$(PDF)'"
78         @echo "All used image files in their built path:"
79         @echo "PNG_BUILT: '$(PNG_BUILT)'"
80         @echo "EPS_BUILT: '$(EPS_BUILT)'"
81         @echo "PDF_BUILT: '$(PDF_BUILT)'"
82         @echo "End result products:"
83         @echo "HTML_DAT: '$(HTML_DAT)'"
84         @echo "PS_DAT:   '$(PS_DAT)'"
85         @echo "PDF_DAT:  '$(PDF_DAT)'"
86
87 # a rule to copy all of the source for docs into $(builddir)/build
88 $(BUILDDIR)/$(MAIN): $(XML) $(CSS)
89         @-mkdir -p $(BUILDDIR)
90         @for a in $(XML); do cp $(srcdir)/$$a $(BUILDDIR); done
91         @for a in $(CSS); do cp $(srcdir)/$$a $(BUILDDIR); done
92         @cp ../version.entities $(BUILDDIR)
93
94 html/index.html: $(BUILDDIR)/$(MAIN) $(PNG_BUILT) $(FIG_SRC)
95         @echo "*** Generating HTML output ***"
96         @-mkdir -p html
97         @cp -f $(srcdir)/../image-png $(BUILDDIR)/image.entities
98         @cd $(BUILDDIR) && xmlto html -o ../html $(MAIN)
99         @test "x$(CSS)" != "x" && \
100           echo "Copying .css files: $(CSS)" && \
101           cp $(srcdir)/$(CSS) html
102         @test "x$(PNG)" != "x" && \
103           echo "Copying .png images: $(PNG_BUILT)" && \
104           mkdir -p html/images && \
105           cp $(PNG_BUILT) html/images || true
106
107 $(DOC).ps: $(BUILDDIR)/$(MAIN) $(EPS_BUILT) $(PNG_SRC) $(FIG_SRC)
108         @echo "*** Generating PS output ***"
109         @cp -f $(srcdir)/../image-eps $(BUILDDIR)/image.entities
110         cd $(BUILDDIR) && docbook2ps -o .. $(MAIN)
111 #       export LC_PAPER=$(PAPER_LOCALE) && cd $(BUILDDIR) && xmlto ps -o .. $(MAIN)
112
113 $(DOC).pdf: $(DOC).ps
114         @echo "*** Generating PDF output ***"
115         @ps2pdf $(DOC).ps
116
117 #$(DOC).pdf: $(MAIN) $(PDF) $(FIG_SRC)
118 #       @echo "*** Generating PDF output ***"
119 #       @cp -f $(srcdir)/../image-pdf image.entities
120 #       @export LC_PAPER=$(PAPER_LOCALE) && xmlto pdf $(MAIN)
121 #       @rm image.entities
122
123 clean-local:
124         -$(RM) -r $(BUILDDIR)
125         -$(RM) -r html
126         -$(RM) $(DOC).ps
127         -$(RM) $(DOC).pdf
128         -$(RM) -r www
129
130 ### image generation
131
132 # copy png from source dir png
133 $(BUILDIMAGESDIR)/%.png: $(srcdir)/%.png
134         @echo "Copying $< to $@"
135         @mkdir -p $(BUILDIMAGESDIR)
136         @cp $< $@
137 # make png from fig
138 $(BUILDIMAGESDIR)/%.png: %.fig
139         @echo "Generating $@ from $<"
140         @mkdir -p $(BUILDIMAGESDIR)
141         @fig2dev -Lpng $< $@
142
143 # make ps(EPS) from fig
144 $(BUILDIMAGESDIR)/%.ps: %.fig
145         @echo "Generating $@ from $<"
146         @mkdir -p $(BUILDIMAGESDIR)
147         @fig2dev -Leps $< $@
148
149 # make pdf from fig
150 $(BUILDIMAGESDIR)/%.pdf: %.fig
151         @echo "Generating $@ from $<"
152         @mkdir -p $(BUILDIMAGESDIR)
153         @fig2dev -Lpdf $< $@
154
155 # make pdf from png
156 $(BUILDIMAGESDIR)/%.pdf: %.png
157         @echo "Generating $@ from $<"
158         @mkdir -p $(BUILDIMAGESDIR)
159         @cat $< | pngtopnm | pnmtops -noturn 2> /dev/null | epstopdf --filter --outfile $@ 2> /dev/null
160
161 # make ps(EPS) from png
162 $(BUILDIMAGESDIR)/%.ps: %.png
163         @echo "Generating $@ from $<"
164         @mkdir -p $(BUILDIMAGESDIR)
165         @cat $< | pngtopnm | pnmtops -noturn > $@ 2> /dev/null
166
167 # make sure xml validates properly
168 check-local: $(BUILDDIR)/$(MAIN)
169         cd $(BUILDDIR) && xmllint -noout -valid $(MAIN)
170
171 ### this is a website upload target
172
173 upload: html ps pdf
174         @export RSYNC_RSH=ssh; \
175         if test "x$$GST_PLUGINS_VERSION_NANO" = x0; then \
176             export DOCVERSION=$(VERSION); \
177         else export DOCVERSION=cvs; \
178         fi; \
179         echo Uploading docs to shell.sf.net/home/groups/g/gs/gstreamer/htdocs/docs/$$DOCVERSION; \
180         ssh $(USERNAME)@shell.sf.net mkdir -p /home/groups/g/gs/gstreamer/htdocs/docs/$$DOCVERSION/$(DOC); \
181         rsync -arv $(DOC).ps $(DOC).pdf html $(USERNAME)@shell.sf.net:/home/groups/g/gs/gstreamer/htdocs/docs/$$DOCVERSION/$(DOC)
182