Imported Upstream version 1.8.7
[debian/sudo] / Makefile.in
1 #
2 # Copyright (c) 2010-2013 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 shlib_mode = @SHLIB_MODE@
48
49 SUBDIRS = compat common @ZLIB_SRC@ plugins/group_file plugins/sudoers \
50           plugins/system_group src include doc
51
52 SAMPLES = plugins/sample
53
54 VERSION = @PACKAGE_VERSION@
55 PACKAGE_TARNAME = @PACKAGE_TARNAME@
56
57 LIBTOOL_DEPS = @LIBTOOL_DEPS@
58
59 SHELL = @SHELL@
60
61 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
62
63 ECHO_N = @ECHO_N@
64 ECHO_C = @ECHO_C@
65
66 # Message catalog support
67 NLS = @SUDO_NLS@
68 POTFILES = src/po/sudo.pot plugins/sudoers/po/sudoers.pot
69 LOCALEDIR_SUFFIX = @LOCALEDIR_SUFFIX@
70 MSGFMT = msgfmt
71 MSGMERGE = msgmerge
72 XGETTEXT = xgettext
73 XGETTEXT_OPTS = -F -k_ -kN_ --copyright-holder="Todd C. Miller" \
74                 "--msgid-bugs-address=http://www.sudo.ws/bugs" \
75                 --package-name=@PACKAGE_NAME@ --package-version=$(VERSION) \
76                 --flag warning:1:c-format --flag warningx:1:c-format \
77                 --flag fatal:1:c-format --flag fatalx:1:c-format \
78                 --flag easprintf:3:c-format --flag lbuf_append:2:c-format \
79                 --flag lbuf_append_quoted:3:c-format --foreign-user
80
81 all: config.status
82         for d in $(SUBDIRS); \
83             do (cd $$d && exec $(MAKE) $@) && continue; \
84             exit $$?; \
85         done
86
87 check pre-install: config.status
88         for d in $(SUBDIRS); \
89             do (cd $$d && exec $(MAKE) $@) && continue; \
90             exit $$?; \
91         done
92
93 install-dirs install-binaries install-includes install-plugin: config.status pre-install
94         for d in $(SUBDIRS); \
95             do (cd $$d && exec $(MAKE) $@) && continue; \
96             exit $$?; \
97         done
98
99 install-doc: config.status ChangeLog
100         for d in $(SUBDIRS); \
101             do (cd $$d && exec $(MAKE) $@) && continue; \
102             exit $$?; \
103         done
104
105 install: config.status ChangeLog pre-install install-nls
106         for d in $(SUBDIRS); \
107             do (cd $$d && exec $(MAKE) $@) && continue; \
108             exit $$?; \
109         done
110
111 uninstall: uninstall-nls
112         for d in $(SUBDIRS); \
113             do (cd $$d && exec $(MAKE) $@) && continue; \
114             exit $$?; \
115         done
116
117 uninstall-nls:
118         for pot in $(POTFILES); do \
119             domain=`basename $$pot .pot`; \
120             rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/$$domain.mo; \
121         done
122
123 siglist.c signame.c:
124         (cd compat && exec $(MAKE) $@)
125
126 depend: siglist.c signame.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/group_file/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/group_file/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) tmpfiles=; cfiles="src/*c common/*c compat/*c";; \
180                     sudoers) \
181                         echo "syntax error" > confstr.sh; \
182                         sed -n -e 's/^badpass_message="/gettext "/p' \
183                             -e 's/^passprompt="/gettext "/p' \
184                             -e 's/^mailsub="/gettext "/p' configure.in \
185                             >> confstr.sh; \
186                         tmpfiles=confstr.sh; \
187                         cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \
188                     *) echo unknown domain $$domain; continue;; \
189                 esac; \
190                 $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles $$tmpfiles -o $$pot.tmp; \
191                 test -n "$$tmpfiles" && rm -f $$tmpfiles; \
192                 if diff -I'^.POT-Creation-Date' -I'^.Project-Id-Version' -I'^#' $$pot.tmp $$pot >/dev/null; then \
193                     rm -f $$pot.tmp; \
194                 else \
195                     printf '/^#$$/+1,$$d\nw\nq\n' | ed - $$pot; \
196                     sed '1,/^#$$/d' $$pot.tmp >> $$pot; \
197                     rm -f $$pot.tmp; \
198                 fi; \
199             done; \
200         fi
201
202 update-po: update-pot
203         @if $(MSGFMT) --help >/dev/null 2>&1; then \
204             cd $(top_srcdir); \
205             for pot in $(POTFILES); do \
206                 podir=`dirname $$pot`; \
207                 for po in $$podir/*.po; do \
208                     echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \
209                     $(MSGMERGE) --update $$po $$pot; \
210                     $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \
211                 done; \
212             done; \
213         fi
214
215 compile-po:
216         @if $(MSGFMT) --help >/dev/null 2>&1; then \
217             cd $(top_srcdir); \
218             rm -f Makefile.$$$$; \
219             POFILES=""; \
220             for pot in $(POTFILES); do \
221                 podir=`dirname $$pot`; \
222                 for po in $$podir/*.po; do \
223                     POFILES="$$POFILES $$po"; \
224                 done; \
225             done; \
226             echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \
227             echo "" >> Makefile.$$$$; \
228             for po in $$POFILES; do \
229                 mo=`echo $$po | sed 's/po$$/mo/'`; \
230                 echo "$$mo: $$po" >> Makefile.$$$$; \
231                 echo "  $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \
232             done; \
233             make -f Makefile.$$$$; \
234             rm -f Makefile.$$$$; \
235         fi
236
237 install-nls:
238         @if test "$(NLS)" = "enabled"; then \
239             cd $(top_srcdir); \
240             for pot in $(POTFILES); do \
241                 podir=`dirname $$pot`; \
242                 domain=`basename $$pot .pot`; \
243                 SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo|sed 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
244                 echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
245                 for lang in $$SUDO_LINGUAS; do \
246                     test -s $$podir/$$lang.mo || continue; \
247                     echo $(ECHO_N) " $$lang$(ECHO_C)"; \
248                     $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
249                     if test -n "$(LOCALEDIR_SUFFIX)"; then \
250                         if test ! -d $(DESTDIR)$(localedir)/$$lang$(LOCALEDIR_SUFFIX); then \
251                             ln -s $$lang $(DESTDIR)$(localedir)/$$lang$(LOCALEDIR_SUFFIX); \
252                         fi; \
253                     fi; \
254                     $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $$podir/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$domain.mo; \
255                 done; \
256                 echo ""; \
257             done; \
258         fi
259
260 check-dist: update-pot compile-po
261         @if [ -d .hg ]; then \
262             if test `hg stat -am | wc -l` -ne 0; then \
263                 echo "Uncommitted changes" 1>&2; \
264                 hg stat -am 1>&2; \
265                 exit 1; \
266             fi; \
267         fi
268
269 dist: check-dist force-dist
270
271 force-dist: ChangeLog $(srcdir)/MANIFEST
272         pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \
273             -f ../$(PACKAGE_TARNAME)-$(VERSION).tar \
274             `sed 's/[   ].*//' $(srcdir)/MANIFEST`
275         gzip -9f ../$(PACKAGE_TARNAME)-$(VERSION).tar
276         ls -l ../$(PACKAGE_TARNAME)-$(VERSION).tar.gz
277
278 package: sudo.pp
279         DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
280         $(MAKE) install DESTDIR=$$DESTDIR && \
281         $(SHELL) $(srcdir)/pp $(PPFLAGS) \
282             --destdir=$$DESTDIR \
283             $(srcdir)/sudo.pp \
284             bindir=$(bindir) \
285             sbindir=$(sbindir) \
286             libexecdir=$(libexecdir) \
287             includedir=$(includedir) \
288             timedir=$(timedir) \
289             mandir=$(mandir) \
290             localedir=$(localedir) \
291             docdir=$(docdir) \
292             sysconfdir=$(sysconfdir) \
293             sudoersdir=$(sudoersdir) \
294             sudoers_uid=$(sudoers_uid) \
295             sudoers_gid=$(sudoers_gid) \
296             sudoers_mode=$(sudoers_mode) \
297             shlib_mode=$(shlib_mode) \
298             version=$(VERSION) $(PPVARS)
299
300 clean: config.status
301         for d in $(SUBDIRS) $(SAMPLES); do \
302             (cd $$d && exec $(MAKE) $@); \
303         done
304
305 mostlyclean: clean
306
307 distclean: config.status
308         for d in $(SUBDIRS) $(SAMPLES); do \
309             (cd $$d && exec $(MAKE) $@); \
310         done
311         -rm -rf Makefile pathnames.h config.h config.status config.cache \
312                 config.log libtool stamp-* autom4te.cache
313
314 cleandir: distclean
315
316 clobber: distclean
317
318 realclean: distclean
319
320 me:
321
322 a:
323
324 sandwich:
325         @if test -n "$$SUDO_USER"; then \
326             echo "Okay."; \
327         else \
328             echo "What?  Make it yourself!"; \
329         fi
330
331 .PHONY: ChangeLog me a sandwhich