aeb3aa542d29f6d00739e652f178b53e4f1abd29
[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 shlib_mode = @SHLIB_MODE@
48
49 SUBDIRS = compat common @ZLIB_SRC@ plugins/sudoers src include doc
50
51 SAMPLES = plugins/sample plugins/sample_group plugins/system_group
52
53 VERSION = @PACKAGE_VERSION@
54 PACKAGE_TARNAME = @PACKAGE_TARNAME@
55
56 LIBTOOL_DEPS = @LIBTOOL_DEPS@
57
58 SHELL = @SHELL@
59
60 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
61
62 ECHO_N = @ECHO_N@
63 ECHO_C = @ECHO_C@
64
65 # Message catalog support
66 NLS = @SUDO_NLS@
67 POTFILES = src/po/sudo.pot plugins/sudoers/po/sudoers.pot
68 MSGFMT = msgfmt
69 MSGMERGE = msgmerge
70 XGETTEXT = xgettext
71 XGETTEXT_OPTS = -F -k_ -kN_ --copyright-holder="Todd C. Miller" \
72                 "--msgid-bugs-address=http://www.sudo.ws/bugs" \
73                 --package-name=@PACKAGE_NAME@ --package-version=$(VERSION) \
74                 --flag warning:1:c-format --flag warningx:1:c-format \
75                 --flag error:2:c-format --flag errorx:2:c-format \
76                 --flag easprintf:3:c-format --flag lbuf_append:2:c-format \
77                 --flag lbuf_append_quoted:3:c-format --foreign-user
78
79 all: config.status
80         for d in $(SUBDIRS) $(SAMPLES); \
81             do (cd $$d && exec $(MAKE) $@) && continue; \
82             exit $$?; \
83         done
84
85 check pre-install: config.status
86         for d in $(SUBDIRS); \
87             do (cd $$d && exec $(MAKE) $@) && continue; \
88             exit $$?; \
89         done
90
91 install-dirs install-binaries install-includes install-plugin: config.status pre-install
92         for d in $(SUBDIRS); \
93             do (cd $$d && exec $(MAKE) $@) && continue; \
94             exit $$?; \
95         done
96
97 install-doc: config.status ChangeLog
98         for d in $(SUBDIRS); \
99             do (cd $$d && exec $(MAKE) $@) && continue; \
100             exit $$?; \
101         done
102
103 install: config.status ChangeLog pre-install install-nls
104         for d in $(SUBDIRS); \
105             do (cd $$d && exec $(MAKE) $@) && continue; \
106             exit $$?; \
107         done
108
109 uninstall: uninstall-nls
110         for d in $(SUBDIRS); \
111             do (cd $$d && exec $(MAKE) $@) && continue; \
112             exit $$?; \
113         done
114
115 uninstall-nls:
116         for pot in $(POTFILES); do \
117             domain=`basename $$pot .pot`; \
118             rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/$$domain.mo; \
119         done
120
121 autoconf:
122         autoconf -I m4
123
124 siglist.c signame.c:
125         (cd compat && exec $(MAKE) $@)
126
127 depend: siglist.c signame.c
128         @if test "$(srcdir)" != "."; then \
129             echo "make depend only supported in the source directory"; \
130             exit 1; \
131         fi; \
132         $(srcdir)/mkdep.pl $(srcdir)/common/Makefile.in \
133             $(srcdir)/compat/Makefile.in $(srcdir)/plugins/sample/Makefile.in \
134             $(srcdir)/plugins/sample_group/Makefile.in \
135             $(srcdir)/plugins/sudoers/Makefile.in \
136             $(srcdir)/plugins/system_group/Makefile.in \
137             $(srcdir)/src/Makefile.in $(srcdir)/zlib/Makefile.in; \
138         ./config.status --file $(srcdir)/common/Makefile \
139             --file $(srcdir)/compat/Makefile \
140             --file $(srcdir)/plugins/sample/Makefile \
141             --file $(srcdir)/plugins/sample_group/Makefile \
142             --file $(srcdir)/plugins/sudoers/Makefile \
143             --file $(srcdir)/plugins/system_group/Makefile \
144             --file $(srcdir)/src/Makefile --file $(srcdir)/zlib/Makefile
145
146 ChangeLog:
147         if test -d $(srcdir)/.hg && cd $(srcdir); then \
148             if hg log --style=changelog -b default > $@.tmp; then \
149                 mv -f $@.tmp $@; \
150             else \
151                 rm -f $@.tmp; \
152             fi; \
153         fi
154
155 config.status:
156         @if [ ! -s config.status ]; then \
157                 echo "Please run configure first"; \
158                 exit 1; \
159         fi
160
161 libtool: $(LIBTOOL_DEPS)
162         $(SHELL) ./config.status --recheck
163
164 Makefile: $(srcdir)/Makefile.in
165         ./config.status --file Makefile
166
167 sync-po: rsync-po compile-po
168
169 rsync-po:
170         rsync -Lrtvz  translationproject.org::tp/latest/sudo/ src/po/
171         rsync -Lrtvz  translationproject.org::tp/latest/sudoers/ plugins/sudoers/po/
172
173 update-pot:
174         @if $(XGETTEXT) --help >/dev/null 2>&1; then \
175             cd $(top_srcdir); \
176             for pot in $(POTFILES); do \
177                 echo "Updating $$pot"; \
178                 domain=`basename $$pot .pot`; \
179                 case "$$domain" in \
180                     sudo) cfiles="src/*c common/*c compat/*c";; \
181                     sudoers) cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \
182                     *) echo unknown domain $$domain; continue;; \
183                 esac; \
184                 $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot.tmp; \
185                 if diff -I'^.POT-Creation-Date' -I'^.Project-Id-Version' -I'^#' $$pot.tmp $$pot >/dev/null; then \
186                     rm -f $$pot.tmp; \
187                 else \
188                     mv -f $$pot.tmp $$pot; \
189                 fi; \
190             done; \
191         fi
192
193 update-po: update-pot
194         @if $(MSGFMT) --help >/dev/null 2>&1; then \
195             cd $(top_srcdir); \
196             for pot in $(POTFILES); do \
197                 podir=`dirname $$pot`; \
198                 for po in $$podir/*.po; do \
199                     echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \
200                     $(MSGMERGE) --update $$po $$pot; \
201                     $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \
202                 done; \
203             done; \
204         fi
205
206 compile-po:
207         @if $(MSGFMT) --help >/dev/null 2>&1; then \
208             cd $(top_srcdir); \
209             rm -f Makefile.$$$$; \
210             POFILES=""; \
211             for pot in $(POTFILES); do \
212                 podir=`dirname $$pot`; \
213                 for po in $$podir/*.po; do \
214                     POFILES="$$POFILES $$po"; \
215                 done; \
216             done; \
217             echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \
218             echo "" >> Makefile.$$$$; \
219             for po in $$POFILES; do \
220                 mo=`echo $$po | sed 's/po$$/mo/'`; \
221                 echo "$$mo: $$po" >> Makefile.$$$$; \
222                 echo "  $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \
223             done; \
224             make -f Makefile.$$$$; \
225             rm -f Makefile.$$$$; \
226         fi
227
228 install-nls:
229         @if test "$(NLS)" = "enabled"; then \
230             cd $(top_srcdir); \
231             for pot in $(POTFILES); do \
232                 podir=`dirname $$pot`; \
233                 domain=`basename $$pot .pot`; \
234                 SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo|sed 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
235                 echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
236                 for lang in $$SUDO_LINGUAS; do \
237                     test -s $$podir/$$lang.mo || continue; \
238                     echo $(ECHO_N) " $$lang$(ECHO_C)"; \
239                     $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
240                     $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0644 $$podir/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$domain.mo; \
241                 done; \
242                 echo ""; \
243             done; \
244         fi
245
246 check-dist: update-pot compile-po
247         @if [ -d .hg ]; then \
248             if hg stat -am | grep '\.[mp]ot*$$'; then \
249                 echo "Uncommitted message catalog changes" 1>&2; \
250                 false; \
251             fi; \
252         fi
253
254 dist: check-dist ChangeLog $(srcdir)/MANIFEST
255         pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \
256             -f ../$(PACKAGE_TARNAME)-$(VERSION).tar \
257             `sed 's/[   ].*//' $(srcdir)/MANIFEST`
258         gzip -9f ../$(PACKAGE_TARNAME)-$(VERSION).tar
259         ls -l ../$(PACKAGE_TARNAME)-$(VERSION).tar.gz
260
261 package: sudo.pp
262         DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
263         $(MAKE) install DESTDIR=$$DESTDIR && \
264         $(SHELL) $(srcdir)/pp $(PPFLAGS) \
265             --destdir=$$DESTDIR \
266             $(srcdir)/sudo.pp \
267             bindir=$(bindir) \
268             sbindir=$(sbindir) \
269             libexecdir=$(libexecdir) \
270             includedir=$(includedir) \
271             timedir=$(timedir) \
272             mandir=$(mandir) \
273             localedir=$(localedir) \
274             docdir=$(docdir) \
275             sysconfdir=$(sysconfdir) \
276             sudoersdir=$(sudoersdir) \
277             sudoers_uid=$(sudoers_uid) \
278             sudoers_gid=$(sudoers_gid) \
279             sudoers_mode=$(sudoers_mode) \
280             shlib_mode=$(shlib_mode) \
281             version=$(VERSION) $(PPVARS)
282
283 clean: config.status
284         for d in $(SUBDIRS) $(SAMPLES); do \
285             (cd $$d && exec $(MAKE) $@); \
286         done
287
288 mostlyclean: clean
289
290 distclean: config.status
291         for d in $(SUBDIRS) $(SAMPLES); do \
292             (cd $$d && exec $(MAKE) $@); \
293         done
294         -rm -rf Makefile pathnames.h config.h config.status config.cache \
295                 config.log libtool stamp-* autom4te.cache
296
297 cleandir: distclean
298
299 clobber: distclean
300
301 realclean: distclean
302
303 me:
304
305 a:
306
307 sandwich:
308         @if test -n "$$SUDO_USER"; then \
309             echo "Okay."; \
310         else \
311             echo "What?  Make it yourself!"; \
312         fi
313
314 .PHONY: ChangeLog me a sandwhich