fcfbbc9ce0b0a3b7a514e628d01d48025e5cb456
[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
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 = -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)/src/Makefile.in $(srcdir)/zlib/Makefile.in; \
136         ./config.status --file $(srcdir)/common/Makefile \
137             --file $(srcdir)/compat/Makefile \
138             --file $(srcdir)/plugins/sample/Makefile \
139             --file $(srcdir)/plugins/sample_group/Makefile \
140             --file $(srcdir)/plugins/sudoers/Makefile \
141             --file $(srcdir)/src/Makefile --file $(srcdir)/zlib/Makefile
142
143 # The 1.8 branch started February 25, 2011
144 ChangeLog:
145         if test -d $(srcdir)/.hg && cd $(srcdir); then \
146             if hg log --style=changelog -b 1.8 > $@.tmp && hg log --style=changelog -b default --date '<2011-02-25 21:30:00' >> $@.tmp; then \
147                 mv -f $@.tmp $@; \
148             else \
149                 rm -f $@.tmp; \
150             fi; \
151         fi
152
153 config.status:
154         @if [ ! -s config.status ]; then \
155                 echo "Please run configure first"; \
156                 exit 1; \
157         fi
158
159 libtool: $(LIBTOOL_DEPS)
160         $(SHELL) ./config.status --recheck
161
162 Makefile: $(srcdir)/Makefile.in
163         ./config.status --file Makefile
164
165 sync-po: rsync-po compile-po
166
167 rsync-po:
168         rsync -Lrtvz  translationproject.org::tp/latest/sudo/ src/po/
169         rsync -Lrtvz  translationproject.org::tp/latest/sudoers/ plugins/sudoers/po/
170
171 update-pot:
172         @if $(XGETTEXT) --help >/dev/null 2>&1; then \
173             cd $(top_srcdir); \
174             for pot in $(POTFILES); do \
175                 echo "Updating $$pot"; \
176                 domain=`basename $$pot .pot`; \
177                 case "$$domain" in \
178                     sudo) cfiles="src/*c common/*c compat/*c";; \
179                     sudoers) cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \
180                     *) echo unknown domain $$domain; continue;; \
181                 esac; \
182                 $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot.tmp; \
183                 if diff -I'^.POT-Creation-Date' $$pot.tmp $$pot >/dev/null; then \
184                     rm -f $$pot.tmp; \
185                 else \
186                     mv -f $$pot.tmp $$pot; \
187                 fi; \
188             done; \
189         fi
190
191 update-po: update-pot
192         @if $(MSGFMT) --help >/dev/null 2>&1; then \
193             cd $(top_srcdir); \
194             for pot in $(POTFILES); do \
195                 podir=`dirname $$pot`; \
196                 for po in $$podir/*.po; do \
197                     echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \
198                     $(MSGMERGE) --update $$po $$pot; \
199                     $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \
200                 done; \
201             done; \
202         fi
203
204 compile-po:
205         @if $(MSGFMT) --help >/dev/null 2>&1; then \
206             cd $(top_srcdir); \
207             rm -f Makefile.$$$$; \
208             POFILES=""; \
209             for pot in $(POTFILES); do \
210                 podir=`dirname $$pot`; \
211                 for po in $$podir/*.po; do \
212                     POFILES="$$POFILES $$po"; \
213                 done; \
214             done; \
215             echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \
216             echo "" >> Makefile.$$$$; \
217             for po in $$POFILES; do \
218                 mo=`echo $$po | sed 's/po$$/mo/'`; \
219                 echo "$$mo: $$po" >> Makefile.$$$$; \
220                 echo "  $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \
221             done; \
222             make -f Makefile.$$$$; \
223             rm -f Makefile.$$$$; \
224         fi
225
226 install-nls:
227         @if test "$(NLS)" = "enabled"; then \
228             cd $(top_srcdir); \
229             for pot in $(POTFILES); do \
230                 podir=`dirname $$pot`; \
231                 domain=`basename $$pot .pot`; \
232                 SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo|sed 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
233                 echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
234                 for lang in $$SUDO_LINGUAS; do \
235                     test -s $$podir/$$lang.mo || continue; \
236                     echo $(ECHO_N) " $$lang$(ECHO_C)"; \
237                     $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
238                     $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0444 $$podir/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$domain.mo; \
239                 done; \
240                 echo ""; \
241             done; \
242         fi
243
244 check-dist: update-pot compile-po
245         @if [ -d .hg ]; then \
246             if hg stat -am | grep '\.[mp]ot*$$'; then \
247                 echo "Uncommitted message catalog changes" 1>&2; \
248                 false; \
249             fi; \
250         fi
251
252 dist: check-dist ChangeLog $(srcdir)/MANIFEST
253         pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \
254             -f ../$(PACKAGE_TARNAME)-$(VERSION).tar \
255             `sed 's/[   ].*//' $(srcdir)/MANIFEST`
256         gzip -9f ../$(PACKAGE_TARNAME)-$(VERSION).tar
257         ls -l ../$(PACKAGE_TARNAME)-$(VERSION).tar.gz
258
259 package: sudo.pp
260         DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
261         $(MAKE) install DESTDIR=$$DESTDIR && \
262         $(SHELL) $(srcdir)/pp $(PPFLAGS) \
263             --destdir=$$DESTDIR \
264             $(srcdir)/sudo.pp \
265             bindir=$(bindir) \
266             sbindir=$(sbindir) \
267             libexecdir=$(libexecdir) \
268             includedir=$(includedir) \
269             timedir=$(timedir) \
270             mandir=$(mandir) \
271             localedir=$(localedir) \
272             docdir=$(docdir) \
273             sysconfdir=$(sysconfdir) \
274             sudoersdir=$(sudoersdir) \
275             sudoers_uid=$(sudoers_uid) \
276             sudoers_gid=$(sudoers_gid) \
277             sudoers_mode=$(sudoers_mode) \
278             version=$(VERSION) $(PPVARS)
279
280 clean: config.status
281         for d in $(SUBDIRS) $(SAMPLES); do \
282             (cd $$d && exec $(MAKE) $@); \
283         done
284
285 mostlyclean: clean
286
287 distclean: config.status
288         for d in $(SUBDIRS) $(SAMPLES); do \
289             (cd $$d && exec $(MAKE) $@); \
290         done
291         -rm -rf Makefile pathnames.h config.h config.status config.cache \
292                 config.log libtool stamp-* autom4te.cache
293
294 cleandir: distclean
295
296 clobber: distclean
297
298 realclean: distclean
299
300 .PHONY: ChangeLog