File: Makefile

package info (click to toggle)
iputils 3%3A20161105-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,060 kB
  • ctags: 1,282
  • sloc: ansic: 11,706; perl: 585; makefile: 344; sh: 277
file content (65 lines) | stat: -rw-r--r-- 1,505 bytes parent folder | download
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
SHELL:=/bin/bash #required for pushd and popd

BUILD_DATE=$(shell dpkg-parsechangelog -S Date -l../debian/changelog | LC_ALL=C date -u "+%d %B %Y" -f -)
SGMLFILES=$(shell echo *.sgml)
HTMLFILES=$(subst .sgml,.html,$(SGMLFILES)) index.html
MANFILES=$(subst .sgml,.8,$(SGMLFILES))

all: html

html: $(HTMLFILES) iputils.html

man: $(MANFILES) fix_sgml2man

# docbook scripts are incredibly dirty in the sense that they leak
# lots of some strange temporary junk directories and files.
# So, scope it to a temporary dir and clean all after each run.

SETUP_TMPDIR = \
	t="tmp.db2html.$@"; \
	rm -rf $$t; \
	mkdir $$t; \
	pushd $$t >/dev/null
CLEAN_TMPDIR = \
	popd >/dev/null; \
	rm -rf $$t

MAKE_HTML = \
	@set -e; \
	$(SETUP_TMPDIR); \
	docbook2html ../$<; \
	mv *.html ..; \
	$(CLEAN_TMPDIR)

$(HTMLFILES): index.db
	$(MAKE_HTML)

iputils.html: iputils.db
	$(MAKE_HTML)

# docbook2man produces utterly ugly output and I did not find
# any way to customize this but hacking backend perl script a little.
# Well, hence...

$(MANFILES): index.db
	@set -e; \
	$(SETUP_TMPDIR); \
	onsgmls ../$< | sgmlspl ../docbook2man-spec.pl "$(BUILD_DATE)"; \
	mv $@ ..; \
	$(CLEAN_TMPDIR)

fix_sgml2man: tracepath.8
	@sed -i -e 's!\\fB\\fIdestination\\fB\\fR \[\\fB/\\fIport\\fB\\fR\]!\\fB\\fIdestination\\fB\\fR[\\fB/\\fIport\\fB\\fR]!g' $<

clean:
	@rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html* tmp.db2man*

snapshot:
	@date "+%y%m%d" > snapshot.db


$(MANFILES): $(SGMLFILES)

$(HTMLFILES): $(SGMLFILES)