File: Makefile

package info (click to toggle)
doc-base 0.11.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 600 kB
  • sloc: perl: 1,582; xml: 1,114; makefile: 195; sh: 96
file content (68 lines) | stat: -rw-r--r-- 2,440 bytes parent folder | download | duplicates (3)
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
64
65
66
67
68
# vim:ts=2
# makefile for doc-base
# $Id: Makefile 206 2011-01-16 21:08:22Z robert $
#

ALL_TARGET := build-local
SUBDIRS		 := 
include ../common.mk

XMLLINT  := xmllint --nonet --noout --postvalid --xinclude
XSLTPROC := xsltproc --nonet --xinclude


generated := $(bdir)/version.ent							\
						 $(bdir)/doc-base.xml  						\
						 $(bdir)/doc-base.txt 						\
						 $(bdir)/doc-base.html/index.html \
						 $(bdir)/check-stamp							\
						 $(bdir)/section.list

$(ALL_TARGET): $(generated) | $(bdir)


$(bdir)/doc-base.xml: doc-base.xml | $(bdir)
	$(call msg,$@)
	cp -f $< $@
	touch -r $< $@

$(bdir)/check-stamp: $(bdir)/doc-base.xml $(bdir)/version.ent
	$(call msg,$@)
	$(XMLLINT) $(bdir)/doc-base.xml # check xml syntax
	touch $@

$(bdir)/doc-base.txt: $(bdir)/doc-base.xml $(bdir)/version.ent $(bdir)/check-stamp xsl/*.xsl
	$(call msg,$@)
	cd $(bdir) && $(XSLTPROC) $(CURDIR)/xsl/text.xsl $(<F) > doc-base.tmp.html
	lynx -dump -nolist $(bdir)/doc-base.tmp.html > $@

$(bdir)/doc-base.html/%: $(bdir)/doc-base.xml $(bdir)/version.ent $(bdir)/check-stamp xsl/*.xsl
	$(call msg,$@)
	cd $(bdir) &&  $(XSLTPROC) --stringparam base.dir doc-base.html $(CURDIR)/xsl/html-chunk.xsl $(<F)

$(bdir)/version.ent: $(bdir)/doc-base.xml $(CHANGELOGFILE) $(MAKEFILESLIST) | $(bdir)
	$(call msg,$@)
	echo "<!ENTITY version \"$(VERSION)\">"    > $@.new
	echo "<!ENTITY date    \"$(DATE_EN)\">"    >> $@.new
	mv -f $@.new $@

$(bdir)/section.list: doc-base.xml | $(bdir)
	$(call msg,$@)
	perl -e  \
	   'exec ("'perl'", "-ne", join("",@ARGV)) if $$#ARGV >-1;                                     '\
	   '      last           if /^\s*<!--\s*section\s+list\s+end\s*-->\s*$$/;                      '\
	   '      $$insect = 1   if /^\s*<!--\s*section\s+list\s+begin\s*-->\s*$$/;                    '\
	   '      next           unless $$insect;                                                      '\
	   '      next           if /\s*<!--\s*section\s+list\s+skip\s*-->/;                           '\
	   '      print "$$2\n"  if /^\s*<(term|para)>\s*<literal>\s*(.*)\s*<\/literal>\s*<\/\1>\s$$/; '\
	 < $< > $@.tmp
	touch -r $< $@.tmp
	mv $@.tmp $@
	sha1sum $@

install-local: $(generated) 
	$(call msg,$@)
	$(call install,$(docdir),$(bdir)/version.ent)
	$(call install,$(docdir)/doc-base.html,$(bdir)/doc-base.html/*)
	$(call install,$(docdir),$(bdir)/doc-base.xml $(bdir)/doc-base.txt,compress)
	$(call install,$(sharedir)/data,$(bdir)/section.list)