File: Makefile

package info (click to toggle)
bird2 2.17.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,584 kB
  • sloc: ansic: 74,910; sh: 3,712; perl: 3,444; lex: 883; python: 495; makefile: 464; xml: 260; sed: 13
file content (63 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Force rebuilds
.PHONY: progspell docs progdocs userdocs

doc-srcdir := $(realpath $(srcdir)/doc)
toolsdir := $(realpath $(srcdir)/tools)

docs: progdocs userdocs

doc-fmt = $(1): $(o)prog.$(1) $(o)bird.$(1)
$(call doc-fmt,html)
$(call doc-fmt,dvi)
$(call doc-fmt,ps)
$(call doc-fmt,pdf)

progdocs: $(o)prog.html $(o)prog.pdf
userdocs: $(o)bird.html $(o)bird.pdf
progspell: $(o)prog.spell

$(o)prog.sgml: $(srcdir)/tools/progdoc $(objdir)/.dir-stamp
	$(srcdir)/tools/progdoc $(srcdir) $@

$(o)%.sgml: $(s)%.sgml $(objdir)/.dir-stamp
	sed 's#{{ VERSION }}#$(VERSION)#' <$< >$@

$(o)%.html: $(o)%.sgml
	cd $(dir $@) && $(toolsdir)/linuxdoc -B html $(notdir $<)

ifeq ($(PANDOC),)
$(o)%.md: $(o)%.sgml
	@echo "ERROR: No pandoc available, install pandoc to build documentation"
	@false
else
LINUXDOC_PANDOC_PARSER := $(srcdir)/tools/linuxdoc.lua
$(o)%.md: $(o)%.sgml $(LINUXDOC_PANDOC_PARSER) $(objdir)/.dir-stamp
	$(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -s -t markdown -o $@ $<

$(o)%-singlepage.html: $(o)%.md
	$(PANDOC) -f markdown -t html5 -s -o $@ $<

endif

$(o)%.tex: $(o)%.sgml
	cd $(dir $@) && $(toolsdir)/linuxdoc -B latex --output=tex $(notdir $<)

$(o)%.dvi: $(o)%.tex
	cd $(dir $@) && TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex latex $(notdir $<)
	cd $(dir $@) && TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex latex $(notdir $<)

$(o)%.ps: $(o)%.dvi
	dvips -D600 -ta4 -o $@ $<

$(o)%.pdf: $(o)%.tex
	TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex pdflatex -output-directory=$(dir $@) $<
	TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex pdflatex -output-directory=$(dir $@) $<

$(o)%.txt: $(o)%.sgml
	cd $(dir $@) && $(toolsdir)/linuxdoc -B txt $(notdir $<)

$(o)prog.spell: $(o)prog.sgml $(s)prog-spell.sed
	sed -f $(lastword $^) <$< >$@
	ispell $@

$(call clean,prog.spell $(addprefix *.,html dvi ps pdf sgml tex txt aux log toc))