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