update control to reflect move of primary repo to collab-maint
[debian/sudo] / Makefile.in
1 #
2 # Copyright (c) 2010-2011 Todd C. Miller <Todd.Miller@courtesan.com>
3 #
4 # Permission to use, copy, modify, and distribute this software for any
5 # purpose with or without fee is hereby granted, provided that the above
6 # copyright notice and this permission notice appear in all copies.
7 #
8 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 #
17
18 srcdir = @srcdir@
19 devdir = @devdir@
20 top_builddir = @top_builddir@
21 top_srcdir = @top_srcdir@
22
23 # Installation paths for package building
24 prefix = @prefix@
25 exec_prefix = @exec_prefix@
26 bindir = @bindir@
27 sbindir = @sbindir@
28 sysconfdir = @sysconfdir@
29 libexecdir = @libexecdir@
30 includedir = @includedir@
31 datarootdir = @datarootdir@
32 localedir = @localedir@
33 localstatedir = @localstatedir@
34 docdir = @docdir@
35 mandir = @mandir@
36 timedir = @timedir@
37
38 # User and group ids the installed files should be "owned" by
39 install_uid = 0
40 install_gid = 0
41
42 # sudoers owner and mode for package building
43 sudoersdir = $(sysconfdir)
44 sudoers_uid = @SUDOERS_UID@
45 sudoers_gid = @SUDOERS_GID@
46 sudoers_mode = @SUDOERS_MODE@
47
48 SUBDIRS = compat common @ZLIB_SRC@ plugins/sudoers src include doc
49
50 SAMPLES = plugins/sample plugins/sample_group plugins/system_group
51
52 VERSION = @PACKAGE_VERSION@
53 PACKAGE_TARNAME = @PACKAGE_TARNAME@
54
55 LIBTOOL_DEPS = @LIBTOOL_DEPS@
56
57 SHELL = @SHELL@
58
59 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
60
61 ECHO_N = @ECHO_N@
62 ECHO_C = @ECHO_C@
63
64 # Message catalog support
65 NLS = @SUDO_NLS@
66 POTFILES = src/po/sudo.pot plugins/sudoers/po/sudoers.pot
67 MSGFMT = msgfmt
68 MSGMERGE = msgmerge
69 XGETTEXT = xgettext
70 XGETTEXT_OPTS = -F -k_ -kN_ --copyright-holder="Todd C. Miller" \
71                 "--msgid-bugs-address=http://www.sudo.ws/bugs" \
72                 --package-name=@PACKAGE_NAME@ --package-version=$(VERSION) \
73                 --flag warning:1:c-format --flag warningx:1:c-format \
74                 --flag error:2:c-format --flag errorx:2:c-format \
75                 --flag easprintf:3:c-format --flag lbuf_append:2:c-format \
76                 --flag lbuf_append_quoted:3:c-format --foreign-user
77
78 all: config.status
79         for d in $(SUBDIRS) $(SAMPLES); \
80             do (cd $$d && exec $(MAKE) $@) && continue; \
81             exit $$?; \
82         done
83
84 check pre-install: config.status
85         for d in $(SUBDIRS); \
86             do (cd $$d && exec $(MAKE) $@) && continue; \
87             exit $$?; \
88         done
89
90 install-dirs install-binaries install-includes install-plugin: config.status pre-install
91         for d in $(SUBDIRS); \
92             do (cd $$d && exec $(MAKE) $@) && continue; \
93             exit $$?; \
94         done
95
96 install-doc: config.status ChangeLog
97         for d in $(SUBDIRS); \
98             do (cd $$d && exec $(MAKE) $@) && continue; \
99             exit $$?; \
100         done
101
102 install: config.status ChangeLog pre-install install-nls
103         for d in $(SUBDIRS); \
104             do (cd $$d && exec $(MAKE) $@) && continue; \
105             exit $$?; \
106         done
107
108 uninstall: uninstall-nls
109         for d in $(SUBDIRS); \
110             do (cd $$d && exec $(MAKE) $@) && continue; \
111             exit $$?; \
112         done
113
114 uninstall-nls:
115         for pot in $(POTFILES); do \
116             domain=`basename $$pot .pot`; \
117             rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/$$domain.mo; \
118         done
119
120 autoconf:
121         autoconf -I m4
122
123 siglist.c:
124         (cd compat && exec $(MAKE) $@)
125
126 depend: siglist.c
127         @if test "$(srcdir)" != "."; then \
128             echo "make depend only supported in the source directory"; \
129             exit 1; \
130         fi; \
131         $(srcdir)/mkdep.pl $(srcdir)/common/Makefile.in \
132             $(srcdir)/compat/Makefile.in $(srcdir)/plugins/sample/Makefile.in \
133             $(srcdir)/plugins/sample_group/Makefile.in \
134             $(srcdir)/plugins/sudoers/Makefile.in \
135             $(srcdir)/plugins/system_group/Makefile.in \
136             $(srcdir)/src/Makefile.in $(srcdir)/zlib/Makefile.in; \
137         ./config.status --file $(srcdir)/common/Makefile \
138             --file $(srcdir)/compat/Makefile \
139             --file $(srcdir)/plugins/sample/Makefile \
140             --file $(srcdir)/plugins/sample_group/Makefile \
141             --file $(srcdir)/plugins/sudoers/Makefile \
142             --file $(srcdir)/plugins/system_group/Makefile \
143             --file $(srcdir)/src/Makefile --file $(srcdir)/zlib/Makefile
144
145 ChangeLog:
146         if test -d $(srcdir)/.hg && cd $(srcdir); then \
147             if hg log --style=changelog -b default > $@.tmp; then \
148                 mv -f $@.tmp $@; \
149             else \
150                 rm -f $@.tmp; \
151             fi; \
152         fi
153
154 config.status:
155         @if [ ! -s config.status ]; then \
156                 echo "Please run configure first"; \
157                 exit 1; \
158         fi
159
160 libtool: $(LIBTOOL_DEPS)
161         $(SHELL) ./config.status --recheck
162
163 Makefile: $(srcdir)/Makefile.in
164         ./config.status --file Makefile
165
166 sync-po: rsync-po compile-po
167
168 rsync-po:
169         rsync -Lrtvz  translationproject.org::tp/latest/sudo/ src/po/
170         rsync -Lrtvz  translationproject.org::tp/latest/sudoers/ plugins/sudoers/po/
171
172 update-pot:
173         @if $(XGETTEXT) --help >/dev/null 2>&1; then \
174             cd $(top_srcdir); \
175             for pot in $(POTFILES); do \
176                 echo "Updating $$pot"; \
177                 domain=`basename $$pot .pot`; \
178                 case "$$domain" in \
179                     sudo) cfiles="src/*c common/*c compat/*c";; \
180                     sudoers) cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \
181                     *) echo unknown domain $$domain; continue;; \
182                 esac; \
183                 $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot.tmp; \
184                 if diff -I'^.POT-Creation-Date' -I'^.Project-Id-Version' -I'^#' $$pot.tmp $$pot >/dev/null; then \
185                     rm -f $$pot.tmp; \
186                 else \
187                     mv -f $$pot.tmp $$pot; \
188                 fi; \
189             done; \
190         fi
191
192 update-po: update-pot
193         @if $(MSGFMT) --help >/dev/null 2>&1; then \
194             cd $(top_srcdir); \
195             for pot in $(POTFILES); do \
196                 podir=`dirname $$pot`; \
197                 for po in $$podir/*.po; do \
198                     echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \
199                     $(MSGMERGE) --update $$po $$pot; \
200                     $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \
201                 done; \
202             done; \
203         fi
204
205 compile-po:
206         @if $(MSGFMT) --help >/dev/null 2>&1; then \
207             cd $(top_srcdir); \
208             rm -f Makefile.$$$$; \
209             POFILES=""; \
210             for pot in $(POTFILES); do \
211                 podir=`dirname $$pot`; \
212                 for po in $$podir/*.po; do \
213                     POFILES="$$POFILES $$po"; \
214                 done; \
215             done; \
216             echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \
217             echo "" >> Makefile.$$$$; \
218             for po in $$POFILES; do \
219                 mo=`echo $$po | sed 's/po$$/mo/'`; \
220                 echo "$$mo: $$po" >> Makefile.$$$$; \
221                 echo "  $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \
222             done; \
223             make -f Makefile.$$$$; \
224             rm -f Makefile.$$$$; \
225         fi
226
227 install-nls:
228         @if test "$(NLS)" = "enabled"; then \
229             cd $(top_srcdir); \
230             for pot in $(POTFILES); do \
231                 podir=`dirname $$pot`; \
232                 domain=`basename $$pot .pot`; \
233                 SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo|sed 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
234                 echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
235                 for lang in $$SUDO_LINGUAS; do \
236                     test -s $$podir/$$lang.mo || continue; \
237                     echo $(ECHO_N) " $$lang$(ECHO_C)"; \
238                     $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
239                     $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0444 $$podir/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$domain.mo; \
240                 done; \
241                 echo ""; \
242             done; \
243         fi
244
245 check-dist: update-pot compile-po
246         @if [ -d .hg ]; then \
247             if hg stat -am | grep '\.[mp]ot*$$'; then \
248                 echo "Uncommitted message catalog changes" 1>&2; \
249                 false; \
250             fi; \
251         fi
252
253 dist: check-dist ChangeLog $(srcdir)/MANIFEST
254         pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \
255             -f ../$(PACKAGE_TARNAME)-$(VERSION).tar \
256             `sed 's/[   ].*//' $(srcdir)/MANIFEST`
257         gzip -9f ../$(PACKAGE_TARNAME)-$(VERSION).tar
258         ls -l ../$(PACKAGE_TARNAME)-$(VERSION).tar.gz
259
260 package: sudo.pp
261         DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
262         $(MAKE) install DESTDIR=$$DESTDIR && \
263         $(SHELL) $(srcdir)/pp $(PPFLAGS) \
264             --destdir=$$DESTDIR \
265             $(srcdir)/sudo.pp \
266             bindir=$(bindir) \
267             sbindir=$(sbindir) \
268             libexecdir=$(libexecdir) \
269             includedir=$(includedir) \
270             timedir=$(timedir) \
271             mandir=$(mandir) \
272             localedir=$(localedir) \
273             docdir=$(docdir) \
274             sysconfdir=$(sysconfdir) \
275             sudoersdir=$(sudoersdir) \
276             sudoers_uid=$(sudoers_uid) \
277             sudoers_gid=$(sudoers_gid) \
278             sudoers_mode=$(sudoers_mode) \
279             version=$(VERSION) $(PPVARS)
280
281 clean: config.status
282         for d in $(SUBDIRS) $(SAMPLES); do \
283             (cd $$d && exec $(MAKE) $@); \
284         done
285
286 mostlyclean: clean
287
288 distclean: config.status
289         for d in $(SUBDIRS) $(SAMPLES); do \
290             (cd $$d && exec $(MAKE) $@); \
291         done
292         -rm -rf Makefile pathnames.h config.h config.status config.cache \
293                 config.log libtool stamp-* autom4te.cache
294
295 cleandir: distclean
296
297 clobber: distclean
298
299 realclean: distclean
300
301 .PHONY: ChangeLog