File: rules

package info (click to toggle)
ada-reference-manual 1%3A2020.1commit85143dcb-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,724 kB
  • sloc: ada: 29,703; makefile: 174; python: 109; lisp: 30
file content (103 lines) | stat: -rwxr-xr-x 3,956 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
#!/usr/bin/make -f
#
# Makefile for Ada Reference Manual.
# Copyright (c) 2010-2012 Stephen Leake <stephen_leake@stephe-leake.org>
# Copyright (c) 2013-2024 Nicolas Boulenguez <nicolas@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

YEARS := $(shell \
  sed -n 's/^Package: ada-reference-manual-//p' debian/control)
FORMATS := html info txt pdf

# For now, ADAFLAGS and LDFLAGS must be passed via the command line
# because build/Makefile does not look in the environment.

# Prevent new compiler warnings from breaking Debian builds.
DEB_ADAFLAGS_MAINT_APPEND := -gnatwn

DEB_BUILD_MAINT_OPTIONS := hardening=+all
include /usr/share/dpkg/buildflags.mk
include /usr/share/ada/packaging.mk

%:
	dh $@ --sourcedirectory=build

# Ignore the upstream build/ directory.
.PHONY: build
build:
	dh $@ --sourcedirectory=build

######################################################################
# Default settings do not produce PDF format.
.PHONY: override_dh_auto_build
override_dh_auto_build:
	dh_auto_build -- \
	  BUILDER_OPTIONS='$(GNATMAKEFLAGS)' \
	  $(foreach v,ADAFLAGS FORMATS LDFLAGS YEARS,'$(v)=$($(v))')

######################################################################
.PHONY: override_dh_compress
override_dh_compress:
	dh_compress --all --exclude=.TXT

######################################################################
.PHONY: override_dh_installinfo
override_dh_installinfo: $(addprefix installinfo-,$(YEARS))
installinfo-%:
	dh_installinfo --package=ada-reference-manual-$* \
	  build/aarm$*.info build/arm$*.info

######################################################################
# Debhelper files for doc-base.

# This must be updated when the packages change in debian/control.
ISO_2005        := 2007
ISO_2012        := 2012
ISO_2020        := 202x

define foreach_year_template

  installdocs-$(y): debian/ada-reference-manual-$(y).doc-base.aarm$(y) \
                    debian/ada-reference-manual-$(y).doc-base.arm$(y)
  debian/ada-reference-manual-$(y).doc-base.%$(y): debian/doc_base_template_%
	sed 's/@YEAR@/$(y)/g; s/@ISO@/$(ISO_$(y))/g' $$< > $$@

endef
$(foreach y,$(YEARS),$(eval $(foreach_year_template)))

.PHONY: override_dh_installdocs
override_dh_installdocs: $(addprefix installdocs-,$(YEARS))
installdocs-%:
	dh_installdocs --package=ada-reference-manual-$* README.txt \
	  build/aarm$*.html/ build/aarm$*.txt/ build/aarm$*.pdf \
	  build/arm$*.html/  build/arm$*.txt/  build/arm$*.pdf

######################################################################
# Check that some .txt docs are still duplicates, then symlink.

.PHONY: override_dh_link
override_dh_link: $(addprefix link-,$(YEARS))
link-%:
	diff -q \
	  debian/ada-reference-manual-$*/usr/share/doc/ada-reference-manual-$*/aarm$*.txt/aa-Lib.TXT \
	  debian/ada-reference-manual-$*/usr/share/doc/ada-reference-manual-$*/arm$*.txt/rm-Lib.TXT
	diff -q \
	  debian/ada-reference-manual-$*/usr/share/doc/ada-reference-manual-$*/aarm$*.txt/aa-TOC.TXT \
	  debian/ada-reference-manual-$*/usr/share/doc/ada-reference-manual-$*/arm$*.txt/rm-TOC.TXT
	dh_link --package=ada-reference-manual-$* \
	  usr/share/doc/ada-reference-manual-$*/aarm$*.txt/aa-Lib.TXT \
	  usr/share/doc/ada-reference-manual-$*/arm$*.txt/rm-Lib.TXT \
	  usr/share/doc/ada-reference-manual-$*/aarm$*.txt/aa-TOC.TXT \
	  usr/share/doc/ada-reference-manual-$*/arm$*.txt/rm-TOC.TXT