dbb4a7360c10c6936db96601545778dd443164a7
[platform/upstream/help2man.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Debian build rules for help2man.
4
5 # Copyright (C) 2012, 2014, 2017, 2018, 2021 Free Software Foundation, Inc.
6
7 # Copying and distribution of this file, with or without modification,
8 # are permitted in any medium without royalty provided the copyright
9 # notice and this notice are preserved.  This file is offered as-is,
10 # without any warranty.
11
12 # Written by Brendan O'Dea <bod@debian.org>
13
14 SHELL = /bin/bash
15
16 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
17
18 %:
19         dh $@
20
21 execute_before_dh_clean: check-maint-prep  # maintainer sanity check
22
23 override_dh_auto_configure:
24         dh_auto_configure -- --libdir=\$$\{prefix\}/lib  # omit arch from libdir
25
26 execute_after_dh_auto_build:
27         $(MAKE) help2man.h2m  # for examples
28
29 .PHONY: execute_before_dh_clean override_dh_auto_configure
30 .PHONY: execute_after_dh_auto_build
31
32 # Maintainer pre-release setup.  Intended to be run from a copy of the
33 # contents of the git repository, excluding the .git subdir.  E.g. something
34 # like this:
35 #
36 #  set -e
37 #  version=$(./help2man.PL --version)
38 #  mkdir ../help2man-$version
39 #  find -name .git -prune -o -print | cpio -vdump ../help2man-$version
40 #  cd ../help2man-$version
41 #  debian/rules maint-prep
42 #
43 # should result in a directory which is ready to be archived for release.
44 AM_DOC = COPYING INSTALL
45 AM_AUX = install-sh missing mkinstalldirs
46 AM_DIR = $(shell ls -d /usr/share/automake* 2>/dev/null | tail -1)
47 PKG_VERSION = $(shell ./help2man.PL --version)
48 include /usr/share/dpkg/pkg-info.mk  # DEB_VERSION
49 maint-prep:
50         test -n $(AM_DIR)
51         test $(DEB_VERSION) = $(PKG_VERSION)  # mismatch b/w $$version in help2man.PL and changelog
52         cp $(addprefix $(AM_DIR)/,$(AM_DOC)) .
53         cp $(addprefix $(AM_DIR)/,$(AM_AUX)) build-aux
54         (eval `sed -n 's/^Vcs-\([^:]*\): /VCS_\U\1=/p' debian/control`; \
55          echo "         README for GNU help2man version $(PKG_VERSION)"; \
56          echo; \
57          echo "help2man is a script to create simple man pages from the --help and"; \
58          echo "--version output of programs."; \
59          echo ""; \
60          echo "Since most GNU documentation is now in info format, this provides a"; \
61          echo "way to generate a placeholder man page pointing to that resource while"; \
62          echo "still providing some useful information."; \
63          echo ""; \
64          echo "  Home page:    http://www.gnu.org/software/help2man/"; \
65          echo "  Distribution: ftp://ftp.gnu.org/gnu/help2man/help2man-$(PKG_VERSION).tar.xz"; \
66          echo "  Repository:   $$VCS_GIT"; \
67          echo ""; \
68          echo "-- "; \
69          echo "Brendan O'Dea <bod@debian.org>") >README
70         ln -sf debian/changelog ChangeLog
71         autoconf
72         ./configure
73         $(MAKE) update-po all distclean
74
75 # Simple sanity check that the above rule has been run prior to release (run
76 # as part of the "clean" rule, which is the first thing run when building a
77 # debian package).
78 check-maint-prep:
79         test -x configure  # autoconf has been run
80         [[ $(DEB_VERSION) = *+b[0-9]* ]] ||  # this is a bin-NMU, or... \
81         grep -qF 'help2man-$(DEB_VERSION).tar' README  # exists and up to date
82
83 maint-clean: maint-prep
84         ./configure
85         $(MAKE) maintainer-clean
86         rm -f README ChangeLog $(AM_DOC) $(addprefix build-aux/,$(AM_AUX))
87
88 .PHONY: maint-prep check-maint-prep maint-clean