1 ### These are all generic; we set all the variables we need
3 # intermediary build path
6 BUILDIMAGESDIR = $(BUILDDIR)/images
9 # right now, we only allow .png and .fig as source
10 # we might add more later if we feel the need
12 # PNG's can be source or built from .fig
13 PNG = $(strip $(PNG_SRC) $(FIG_SRC:.fig=.png))
14 # EPS .ps files can be built from .png or .fig
15 EPS = $(strip $(FIG_SRC:.fig=.ps) $(PNG_SRC:.png=.ps))
16 # PDF .pdf files can be built from .png or .fig
17 PDF = $(strip $(FIG_SRC:.fig=.pdf) $(PNG_SRC:.png=.pdf))
19 # where we expect to find images during building, whether by copying
20 # or by generating them
21 PNG_BUILT = $(foreach file, $(PNG), $(BUILDIMAGESDIR)/$(file))
22 EPS_BUILT = $(foreach file, $(EPS), $(BUILDIMAGESDIR)/$(file))
23 PDF_BUILT = $(foreach file, $(PDF), $(BUILDIMAGESDIR)/$(file))
25 SRC = $(XML) $(PNG_SRC) $(FIG_SRC) $(CSS) $(EXTRA_SOURCES)
30 ### generate all documentation by default
31 # FIXME: I don't think this rule survives automake in any of the dirs ?
34 # can we generate HTML ?
37 HTML_TARGET = html/index.html
44 # can we generate PS ?
52 # can we generate PDF ?
61 @echo "outputting some useful debug information"
65 @echo "Source image files:"
66 @echo "PNG_SRC: '$(PNG_SRC)'"
67 @echo "FIG_SRC: '$(FIG_SRC)'"
68 @echo "All used image files:"
72 @echo "All used image files in their built path:"
73 @echo "PNG_BUILT: '$(PNG_BUILT)'"
74 @echo "EPS_BUILT: '$(EPS_BUILT)'"
75 @echo "PDF_BUILT: '$(PDF_BUILT)'"
76 @echo "End result products:"
77 @echo "HTML_DAT: '$(HTML_DAT)'"
78 @echo "PS_DAT: '$(PS_DAT)'"
79 @echo "PDF_DAT: '$(PDF_DAT)'"
81 # a rule to copy all of the source for docs into $(builddir)/build
82 $(BUILDDIR)/$(MAIN): $(XML) $(CSS) $(EXTRA_SOURCES)
83 @-mkdir -p $(BUILDDIR)
84 @if test "x$(EXTRA_SOURCES)" != "x"; then for a in $(EXTRA_SOURCES); do cp $(srcdir)/$$a $(BUILDDIR); done; fi
85 @for a in $(XML); do cp $(srcdir)/$$a $(BUILDDIR); done
86 @for a in $(CSS); do cp $(srcdir)/$$a $(BUILDDIR); done
87 @cp ../version.entities $(BUILDDIR)
89 html/index.html: $(BUILDDIR)/$(MAIN) $(PNG_BUILT) $(FIG_SRC)
91 @echo "*** Generating HTML output ***"
93 @cp -f $(srcdir)/../image-png $(BUILDDIR)/image.entities
94 @cd $(BUILDDIR) && docbook2html -o ../html -V '%use-id-as-filename%' $(MAIN)
95 @test "x$(CSS)" != "x" && \
96 echo "Copying .css files: $(CSS)" && \
97 cp $(srcdir)/$(CSS) html
98 @test "x$(PNG)" != "x" && \
99 echo "Copying .png images: $(PNG_BUILT)" && \
100 mkdir -p html/images && \
101 cp $(PNG_BUILT) html/images || true
103 $(DOC).ps: $(BUILDDIR)/$(MAIN) $(EPS_BUILT) $(PNG_SRC) $(FIG_SRC)
105 @echo "*** Generating PS output ***"
106 @cp -f $(srcdir)/../image-eps $(BUILDDIR)/image.entities
107 cd $(BUILDDIR) && docbook2ps -o .. $(MAIN)
108 # export LC_PAPER=$(PAPER_LOCALE) && cd $(BUILDDIR) && xmlto ps -o .. $(MAIN)
110 $(DOC).pdf: $(DOC).ps
112 @echo "*** Generating PDF output ***"
115 #$(DOC).pdf: $(MAIN) $(PDF) $(FIG_SRC)
116 # @echo "*** Generating PDF output ***"
117 # @cp -f $(srcdir)/../image-pdf image.entities
118 # @export LC_PAPER=$(PAPER_LOCALE) && xmlto pdf $(MAIN)
122 -$(RM) -r $(BUILDDIR)
130 # copy png from source dir png
131 $(BUILDIMAGESDIR)/%.png: $(srcdir)/%.png
132 @echo "Copying $< to $@"
133 @mkdir -p $(BUILDIMAGESDIR)
136 $(BUILDIMAGESDIR)/%.png: %.fig
137 @echo "Generating $@ from $<"
138 @mkdir -p $(BUILDIMAGESDIR)
141 # make ps(EPS) from fig
142 $(BUILDIMAGESDIR)/%.ps: %.fig
143 @echo "Generating $@ from $<"
144 @mkdir -p $(BUILDIMAGESDIR)
148 $(BUILDIMAGESDIR)/%.pdf: %.fig
149 @echo "Generating $@ from $<"
150 @mkdir -p $(BUILDIMAGESDIR)
154 $(BUILDIMAGESDIR)/%.pdf: %.png
155 @echo "Generating $@ from $<"
156 @mkdir -p $(BUILDIMAGESDIR)
157 @cat $< | pngtopnm | pnmtops -noturn 2> /dev/null | epstopdf --filter --outfile $@ 2> /dev/null
159 # make ps(EPS) from png
160 $(BUILDIMAGESDIR)/%.ps: %.png
161 @echo "Generating $@ from $<"
162 @mkdir -p $(BUILDIMAGESDIR)
163 @cat $< | pngtopnm | pnmtops -noturn > $@ 2> /dev/null
165 # make sure xml validates properly
166 check-local: $(BUILDDIR)/$(MAIN)
167 @cp -f $(srcdir)/../image-png $(BUILDDIR)/image.entities
168 cd $(BUILDDIR) && xmllint -noout -valid $(MAIN)