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@
47 shlib_mode = @SHLIB_MODE@
49 SUBDIRS = compat common @ZLIB_SRC@ plugins/sudoers src include doc
51 SAMPLES = plugins/sample plugins/sample_group plugins/system_group
53 VERSION = @PACKAGE_VERSION@
54 PACKAGE_TARNAME = @PACKAGE_TARNAME@
56 LIBTOOL_DEPS = @LIBTOOL_DEPS@
60 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
65 # Message catalog support
67 POTFILES = src/po/sudo.pot plugins/sudoers/po/sudoers.pot
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
80 for d in $(SUBDIRS) $(SAMPLES); \
81 do (cd $$d && exec $(MAKE) $@) && continue; \
85 check pre-install: config.status
86 for d in $(SUBDIRS); \
87 do (cd $$d && exec $(MAKE) $@) && continue; \
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; \
97 install-doc: config.status ChangeLog
98 for d in $(SUBDIRS); \
99 do (cd $$d && exec $(MAKE) $@) && continue; \
103 install: config.status ChangeLog pre-install install-nls
104 for d in $(SUBDIRS); \
105 do (cd $$d && exec $(MAKE) $@) && continue; \
109 uninstall: uninstall-nls
110 for d in $(SUBDIRS); \
111 do (cd $$d && exec $(MAKE) $@) && continue; \
116 for pot in $(POTFILES); do \
117 domain=`basename $$pot .pot`; \
118 rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/$$domain.mo; \
125 (cd compat && exec $(MAKE) $@)
127 depend: siglist.c signame.c
128 @if test "$(srcdir)" != "."; then \
129 echo "make depend only supported in the source directory"; \
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
147 if test -d $(srcdir)/.hg && cd $(srcdir); then \
148 if hg log --style=changelog -b default > $@.tmp; then \
156 @if [ ! -s config.status ]; then \
157 echo "Please run configure first"; \
161 libtool: $(LIBTOOL_DEPS)
162 $(SHELL) ./config.status --recheck
164 Makefile: $(srcdir)/Makefile.in
165 ./config.status --file Makefile
167 sync-po: rsync-po compile-po
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' -I'^.Project-Id-Version' -I'^#' $$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 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; \
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; \
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
262 DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \
263 $(MAKE) install DESTDIR=$$DESTDIR && \
264 $(SHELL) $(srcdir)/pp $(PPFLAGS) \
265 --destdir=$$DESTDIR \
269 libexecdir=$(libexecdir) \
270 includedir=$(includedir) \
273 localedir=$(localedir) \
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)
284 for d in $(SUBDIRS) $(SAMPLES); do \
285 (cd $$d && exec $(MAKE) $@); \
290 distclean: config.status
291 for d in $(SUBDIRS) $(SAMPLES); do \
292 (cd $$d && exec $(MAKE) $@); \
294 -rm -rf Makefile pathnames.h config.h config.status config.cache \
295 config.log libtool stamp-* autom4te.cache
308 @if test -n "$$SUDO_USER"; then \
311 echo "What? Make it yourself!"; \
314 .PHONY: ChangeLog me a sandwhich