1f0e1ea4ccc8823f5c946c40c71ce9f2eeaf0d02
[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 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 DPKG_EXPORT_BUILDFLAGS = 1
16
17 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
18
19 include /usr/share/dpkg/architecture.mk
20 include /usr/share/dpkg/buildflags.mk
21 include /usr/share/dpkg/pkg-info.mk
22
23 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
24  CONFARGS = --host=$(DEB_HOST_GNU_TYPE)
25 endif
26
27 build: build-arch build-indep
28 build-arch build-indep: build-stamp
29 build-stamp:
30         dh_testdir
31         dh_update_autotools_config  # update config.guess, config.sub
32         ./configure --prefix=/usr --enable-nls --mandir='$${prefix}/share/man' \
33             --infodir='$${prefix}/share/info' $(CONFARGS)
34
35         $(MAKE)
36         $(MAKE) help2man.h2m  # for examples
37         touch build-stamp
38
39 clean:
40         test README -nt help2man.PL  # maintainer sanity check
41         dh_testdir
42         dh_testroot
43         [ ! -f Makefile ] || $(MAKE) distclean
44         rm -f build-stamp install-stamp
45         dh_clean
46
47 install: install-stamp
48 install-stamp: build-stamp
49         dh_testdir
50         dh_testroot
51         dh_prep
52         dh_installdirs
53         $(MAKE) install DESTDIR=$(CURDIR)/debian/help2man
54         touch install-stamp
55
56 binary-arch: build install
57         dh_testdir
58         dh_testroot
59         dh_installdocs
60         dh_installinfo
61         dh_installexamples
62         dh_installchangelogs
63         dh_strip
64         dh_compress
65         dh_fixperms
66         dh_perl -V
67         dh_installdeb
68         dh_shlibdeps
69         dh_gencontrol
70         dh_md5sums
71         dh_builddeb
72
73 binary-indep: build install
74
75 source diff:
76         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
77
78 # Maintainer pre-release setup.  Intended to be run from a copy of the
79 # contents of the git repository, excluding the .git subdir.  E.g. something
80 # like this:
81 #
82 #  set -e
83 #  version=$(./help2man.PL --version)
84 #  mkdir ../help2man-$version
85 #  find -name .git -prune -o -print | cpio -vdump ../help2man-$version
86 #  cd ../help2man-$version
87 #  debian/rules maint-prep
88 #
89 # should result in a directory which is ready to be archived for release.
90 AM_DOC = COPYING INSTALL
91 AM_AUX = install-sh missing mkinstalldirs
92 AM_DIR = $(shell ls -d /usr/share/automake* 2>/dev/null | tail -1)
93 PKG_VERSION = $(shell ./help2man.PL --version)
94 maint-prep:
95         test -n $(AM_DIR)
96         test $(DEB_VERSION) = $(PKG_VERSION)  # $version in help2man.PL updated
97         cp $(addprefix $(AM_DIR)/,$(AM_DOC)) .
98         cp $(addprefix $(AM_DIR)/,$(AM_AUX)) build-aux
99         (eval `sed -n 's/^Vcs-\([^:]*\): /VCS_\U\1=/p' debian/control`; \
100          echo "         README for GNU help2man version $(PKG_VERSION)"; \
101          echo; \
102          echo "help2man is a script to create simple man pages from the --help and"; \
103          echo "--version output of programs."; \
104          echo ""; \
105          echo "Since most GNU documentation is now in info format, this provides a"; \
106          echo "way to generate a placeholder man page pointing to that resource while"; \
107          echo "still providing some useful information."; \
108          echo ""; \
109          echo "  Home page:    http://www.gnu.org/software/help2man/"; \
110          echo "  Distribution: ftp://ftp.gnu.org/gnu/help2man/help2man-$(PKG_VERSION).tar.xz"; \
111          echo "  Repository:   $$VCS_GIT"; \
112          echo ""; \
113          echo "-- "; \
114          echo "Brendan O'Dea <bod@debian.org>") >README
115         ln -sf debian/changelog ChangeLog
116         autoconf
117         ./configure
118         $(MAKE) update-po all distclean
119
120 maint-clean: maint-prep
121         ./configure
122         $(MAKE) maintainer-clean
123         rm -f README ChangeLog $(AM_DOC) $(addprefix build-aux/,$(AM_AUX))
124
125 binary: binary-indep binary-arch
126 .PHONY: build clean binary-indep binary-arch binary maint-prep maint-clean