File: Makefile

package info (click to toggle)
debmake-doc 1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 12,952 kB
  • sloc: makefile: 916; sh: 692; python: 202; ansic: 114; sed: 16
file content (104 lines) | stat: -rw-r--r-- 2,736 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Build 1-page html, manpage, and xml source
# Copyright (C) 2015 Osamu Aoki

# manually copy 1-page html to the people.debian.org
# manually copy manpage to the debmake command
# xml is used to build this package
# This Makefile can function by itself.

# version of the debmake command used
DEBMAKEVERSION ?= $(shell { debmake -v 2>&1 | sed -ne '/^debmake/s/^.*(version: \([0-9.]*\)).*$$/\1/p' ; })
# version of this Debian package (debian/changelog)
DEBVERSION ?= $(shell { cd .. >/dev/null ;dpkg-parsechangelog -SVersion || echo "vcs-0.0" ; })
# short date of this Debian package (debian/changelog)
DEBDATE ?= $(shell { cd .. >/dev/null && date +'%Y-%m-%d' -d"`dpkg-parsechangelog -SDate`" || date +'(No changelog) %Y-%m-%d' ; })

MANUAL := debmake-doc
GENTXT := 90-manpage.txt binary.txt caveat-version.txt
ALLTXT := $(wildcard *.txt) $(GENTXT)

#ASCIIDOC := asciidoc
ASCIIDOC := asciidoctor -w
# https://docs.asciidoctor.org/asciidoctor/latest/migrate/asciidoc-py/

# These are used as test build target
all:
	$(MAKE) clean
	$(MAKE) man html

test: test.html

html: $(MANUAL).html

# This is used from the parent directory to build debmake-doc
xml: $(MANUAL).xml

# This is used to make manpage for debmake
# Copy result to debmake
man: debmake.1

check:
	@echo "DEBMAKEVERSION = $(DEBMAKEVERSION)"
	@echo "DEBVERSION     = $(DEBVERSION)"
	@echo "DEBDATE        = $(DEBDATE)"
	@echo "ALLTXT         = $(ALLTXT)"

90-manpage.txt: manpage.txt
	sed -e 's/^= DEBMAKE(1)$$/= *debmake*(1) manpage/' -e 's/^=/==/' $< >$@

binary.txt: manpage.txt
	sed -n -e '/^\*-b\*/,$$p' $< | sed -e '/^\*-e\*/,$$d'> $@

caveat-version.txt: manpage.txt
	sed -e '1,/BEGIN: SNIP_FOR_VERSION/d' $< | sed -e '/END: SNIP_FOR_VERSION/,$$d'> $@

$(MANUAL).xml: $(ALLTXT)
	@$(call check-command, $(ASCIIDOC), $(ASCIIDOC))
	$(ASCIIDOC) --doctype book\
		-b docbook \
		-a 'newline=\n' \
		$(MANUAL).txt

%.xml: %.txt
	@$(call check-command, $(ASCIIDOC), $(ASCIIDOC))
	$(ASCIIDOC) --doctype book\
		-b docbook \
		-a 'newline=\n' \
		$<

$(MANUAL).html: $(ALLTXT)
	@$(call check-command, $(ASCIIDOC), $(ASCIIDOC))
	$(ASCIIDOC) --doctype book\
		-b html \
		-a toc2 \
		-a 'newline=\n' \
		$(MANUAL).txt
	sed -i -e "s/@@@dhcompat@@@/13/g" $@

%.html: %.txt
	$(ASCIIDOC) --doctype book\
		-b html \
		-a toc2 \
		-a 'newline=\n' \
		$<

debmake.1: manpage.txt
  ifeq ($(ASCIIDOC), asciidoc)
	a2x --doctype manpage --format manpage \
		manpage.txt
  else
	$(ASCIIDOC) --doctype manpage\
		-b manpage \
		-a 'newline=\n' \
		$<
  endif

clean:
	-rm -f debmake.1 $(GENTXT) $(MANUAL).html

distclean: clean

remote: $(MANUAL).html
	scp $(MANUAL).html people.debian.org:~osamu/public_html/$(MANUAL).html

.PHONY: all xml xml1 html man clean distclean check test remote