patch from Luca Capello to move LDAP examples into sudo-ldap/examples
[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 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             podir=`dirname $$pot`; \
118             for po in $$podir/*.po; do \
119                 lang=`basename $$po .po`; \
120                 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$domain.mo; \
121             done; \
122         done
123
124 autoconf:
125         autoconf -I m4
126
127 siglist.c:
128         (cd compat && exec $(MAKE) $@)
129
130 depend: siglist.c
131         @if test "$(srcdir)" != "."; then \
132             echo "make depend only supported in the source directory"; \
133             exit 1; \
134         fi; \
135         $(srcdir)/mkdep.pl $(srcdir)/common/Makefile.in \
136             $(srcdir)/compat/Makefile.in $(srcdir)/plugins/sample/Makefile.in \
137             $(srcdir)/plugins/sample_group/Makefile.in \
138             $(srcdir)/plugins/sudoers/Makefile.in \
139             $(srcdir)/src/Makefile.in $(srcdir)/zlib/Makefile.in; \
140         ./config.status --file $(srcdir)/common/Makefile \
141             --file $(srcdir)/compat/Makefile \
142             --file $(srcdir)/plugins/sample/Makefile \
143             --file $(srcdir)/plugins/sample_group/Makefile \
144             --file $(srcdir)/plugins/sudoers/Makefile \
145             --file $(srcdir)/src/Makefile --file $(srcdir)/zlib/Makefile
146
147 # The 1.8 branch started February 25, 2011
148 ChangeLog:
149         if test -d $(srcdir)/.hg && cd $(srcdir); then \
150             if hg log --style=changelog -b 1.8 > $@.tmp && hg log --style=changelog -b default --date '<2011-02-25 21:30:00' >> $@.tmp; then \
151                 mv -f $@.tmp $@; \
152             else \
153                 rm -f $@.tmp; \
154             fi; \
155         fi
156
157 config.status:
158         @if [ ! -s config.status ]; then \
159                 echo "Please run configure first"; \
160                 exit 1; \
161         fi
162
163 libtool: $(LIBTOOL_DEPS)
164         $(SHELL) ./config.status --recheck
165
166 Makefile: $(srcdir)/Makefile.in
167         ./config.status --file Makefile
168
169 sync-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' $$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                 echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
235                 for mo in $$podir/*.mo; do \
236                     lang=`basename $$mo .mo`; \
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 0644 $$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