2 # Copyright (c) 2010-2011 Todd C. Miller <Todd.Miller@courtesan.com>
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.
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.
20 top_builddir = @top_builddir@
21 top_srcdir = @top_srcdir@
23 # Installation paths for package building
25 exec_prefix = @exec_prefix@
28 sysconfdir = @sysconfdir@
29 libexecdir = @libexecdir@
30 includedir = @includedir@
31 datarootdir = @datarootdir@
32 localedir = @localedir@
33 localstatedir = @localstatedir@
38 # User and group ids the installed files should be "owned" by
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@
48 SUBDIRS = compat common @ZLIB_SRC@ plugins/sudoers src include doc
50 SAMPLES = plugins/sample plugins/sample_group
52 VERSION = @PACKAGE_VERSION@
53 PACKAGE_TARNAME = @PACKAGE_TARNAME@
55 LIBTOOL_DEPS = @LIBTOOL_DEPS@
59 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
64 # Message catalog support
66 POTFILES = src/po/sudo.pot plugins/sudoers/po/sudoers.pot
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
79 for d in $(SUBDIRS) $(SAMPLES); \
80 do (cd $$d && exec $(MAKE) $@) && continue; \
84 check pre-install: config.status
85 for d in $(SUBDIRS); \
86 do (cd $$d && exec $(MAKE) $@) && continue; \
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; \
96 install-doc: config.status ChangeLog
97 for d in $(SUBDIRS); \
98 do (cd $$d && exec $(MAKE) $@) && continue; \
102 install: config.status pre-install install-nls
103 for d in $(SUBDIRS); \
104 do (cd $$d && exec $(MAKE) $@) && continue; \
108 uninstall: uninstall-nls
109 for d in $(SUBDIRS); \
110 do (cd $$d && exec $(MAKE) $@) && continue; \
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; \
128 (cd compat && exec $(MAKE) $@)
131 @if test "$(srcdir)" != "."; then \
132 echo "make depend only supported in the source directory"; \
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
147 # The 1.8 branch started February 25, 2011
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 \
158 @if [ ! -s config.status ]; then \
159 echo "Please run configure first"; \
163 libtool: $(LIBTOOL_DEPS)
164 $(SHELL) ./config.status --recheck
166 Makefile: $(srcdir)/Makefile.in
167 ./config.status --file Makefile
170 rsync -Lrtvz translationproject.org::tp/latest/sudo/ src/po/
171 rsync -Lrtvz translationproject.org::tp/latest/sudoers/ plugins/sudoers/po/
174 @if $(XGETTEXT) --help >/dev/null 2>&1; then \
176 for pot in $(POTFILES); do \
177 echo "Updating $$pot"; \
178 domain=`basename $$pot .pot`; \
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;; \
184 $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot.tmp; \
185 if diff -I'^.POT-Creation-Date' $$pot.tmp $$pot >/dev/null; then \
188 mv -f $$pot.tmp $$pot; \
193 update-po: update-pot
194 @if $(MSGFMT) --help >/dev/null 2>&1; then \
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; \
207 @if $(MSGFMT) --help >/dev/null 2>&1; then \
209 rm -f Makefile.$$$$; \
211 for pot in $(POTFILES); do \
212 podir=`dirname $$pot`; \
213 for po in $$podir/*.po; do \
214 POFILES="$$POFILES $$po"; \
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.$$$$; \
224 make -f Makefile.$$$$; \
225 rm -f Makefile.$$$$; \
229 @if test "$(NLS)" = "enabled"; then \
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; \
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; \
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
261 DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
262 $(MAKE) install DESTDIR=$$DESTDIR && \
263 $(SHELL) $(srcdir)/pp $(PPFLAGS) \
264 --destdir=$$DESTDIR \
268 libexecdir=$(libexecdir) \
269 includedir=$(includedir) \
272 localedir=$(localedir) \
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)
282 for d in $(SUBDIRS) $(SAMPLES); do \
283 (cd $$d && exec $(MAKE) $@); \
288 distclean: config.status
289 for d in $(SUBDIRS) $(SAMPLES); do \
290 (cd $$d && exec $(MAKE) $@); \
292 -rm -rf Makefile pathnames.h config.h config.status config.cache \
293 config.log libtool stamp-* autom4te.cache