chiark / gitweb /
test suite: gitattributes: Rename a sums file to the right name
[dgit.git] / Makefile
1 # dgit
2 # Integration between git and Debian-style archives
3 #
4 # Copyright (C)2013-2016 Ian Jackson
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 INSTALL=install
20 INSTALL_DIR=$(INSTALL) -d
21 INSTALL_PROGRAM=$(INSTALL) -m 755
22 INSTALL_DATA=$(INSTALL) -m 644
23
24 prefix?=/usr/local
25
26 bindir=$(prefix)/bin
27 mandir=$(prefix)/share/man
28 perldir=$(prefix)/share/perl5
29 man1dir=$(mandir)/man1
30 man5dir=$(mandir)/man5
31 man7dir=$(mandir)/man7
32 infraexamplesdir=$(prefix)/share/doc/dgit-infrastructure/examples
33 txtdocdir=$(prefix)/share/doc/dgit
34 absurddir=$(prefix)/share/dgit/absurd
35
36 PROGRAMS=dgit dgit-badcommit-fixup
37 MAN1PAGES=dgit.1
38
39 MAN7PAGES=dgit.7                                \
40         dgit-user.7 dgit-nmu-simple.7           \
41         dgit-maint-native.7                     \
42         dgit-maint-merge.7 dgit-maint-gbp.7     \
43         dgit-maint-debrebase.7                  \
44         dgit-sponsorship.7
45
46 TXTDOCS=README.dsc-import
47 PERLMODULES=Debian/Dgit.pm Debian/Dgit/ExitStatus.pm
48 ABSURDITIES=git
49
50 GDR_PROGRAMS=git-debrebase
51 GDR_PERLMODULES= \
52         Debian/Dgit.pm \
53         Debian/Dgit/GDR.pm \
54         Debian/Dgit/ExitStatus.pm
55 GDR_MAN1PAGES=git-debrebase.1
56 GDR_MAN5PAGES=git-debrebase.5
57
58 INFRA_PROGRAMS=dgit-repos-server dgit-ssh-dispatch \
59         dgit-repos-policy-debian dgit-repos-admin-debian \
60         dgit-repos-policy-trusting dgit-mirror-rsync
61 INFRA_EXAMPLES=get-dm-txt ssh-wrap drs-cron-wrap get-suites
62 INFRA_PERLMODULES= \
63         Debian/Dgit.pm \
64         Debian/Dgit/Infra.pm \
65         Debian/Dgit/Policy/Debian.pm
66
67 MANPAGES=$(MAN1PAGES) $(MAN5PAGES) $(MAN7PAGES) \
68         $(GDR_MAN1PAGES) $(GDR_MAN5PAGES)
69
70 all:    $(MANPAGES) $(addprefix substituted/,$(PROGRAMS))
71
72 substituted/%:  %
73         mkdir -p substituted
74         perl -pe 's{\bundef\b}{'\''$(absurddir)'\''} if m/###substituted###/' \
75                 <$< >$@
76
77 install:        installdirs all
78         $(INSTALL_PROGRAM) $(addprefix substituted/,$(PROGRAMS)) \
79                 $(DESTDIR)$(bindir)
80         $(INSTALL_PROGRAM) $(addprefix absurd/,$(ABSURDITIES)) \
81                 $(DESTDIR)$(absurddir)
82         $(INSTALL_DATA) $(MAN1PAGES) $(DESTDIR)$(man1dir)
83         $(INSTALL_DATA) $(MAN7PAGES) $(DESTDIR)$(man7dir)
84         $(INSTALL_DATA) $(TXTDOCS) $(DESTDIR)$(txtdocdir)
85         set -e; for m in $(PERLMODULES); do \
86                 $(INSTALL_DATA) $$m $(DESTDIR)$(perldir)/$${m%/*}; \
87         done
88
89 installdirs:
90         $(INSTALL_DIR) $(DESTDIR)$(bindir) \
91                 $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) \
92                 $(DESTDIR)$(man7dir) \
93                 $(DESTDIR)$(txtdocdir) $(DESTDIR)$(absurddir) \
94                 $(addprefix $(DESTDIR)$(perldir)/, $(dir $(PERLMODULES)))
95
96 install-gdr:    installdirs-gdr
97         $(INSTALL_PROGRAM) $(GDR_PROGRAMS) $(DESTDIR)$(bindir)
98         $(INSTALL_DATA) $(GDR_MAN1PAGES) $(DESTDIR)$(man1dir)
99         $(INSTALL_DATA) $(GDR_MAN5PAGES) $(DESTDIR)$(man5dir)
100         set -e; for m in $(GDR_PERLMODULES); do \
101                 $(INSTALL_DATA) $$m $(DESTDIR)$(perldir)/$${m%/*}; \
102         done
103
104 install-infra:  installdirs-infra
105         $(INSTALL_PROGRAM) $(addprefix infra/, $(INFRA_PROGRAMS)) \
106                 $(DESTDIR)$(bindir)
107         $(INSTALL_PROGRAM) $(addprefix infra/, $(INFRA_EXAMPLES)) \
108                 $(DESTDIR)$(infraexamplesdir)
109         set -e; for m in $(INFRA_PERLMODULES); do \
110                 $(INSTALL_DATA) $$m $(DESTDIR)$(perldir)/$${m%/*}; \
111         done
112
113 installdirs-gdr:
114         $(INSTALL_DIR) $(DESTDIR)$(bindir) \
115                 $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) \
116                 $(addprefix $(DESTDIR)$(perldir)/, $(dir $(GDR_PERLMODULES)))
117
118 installdirs-infra:
119         $(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(infraexamplesdir) \
120                 $(addprefix $(DESTDIR)$(perldir)/, $(dir $(INFRA_PERLMODULES)))
121
122 check installcheck:
123
124 clean distclean mostlyclean maintainer-clean:
125         rm -rf tests/tmp substituted
126         set -e; for m in $(MANPAGES); do \
127                 test -e $$m.pod && rm -f $$m; \
128         done
129
130 %.7: %.7.pod
131         pod2man --section=7 --date="Debian Project" --center="dgit" \
132                 --name=$(subst .7,,$@) \
133                 $^ $@
134
135 git-debrebase.%: git-debrebase.%.pod
136         pod2man --section=$* --date="Debian Project" --center="git-debrebase" \
137                 --name=$(subst .$*,,$@) \
138                 $^ $@
139
140 %.view: %
141         man -l $*