1: #
2: # Copyright (c) 2011-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: # @configure_input@
18: #
19:
20: #### Start of system configuration section. ####
21:
22: srcdir = @srcdir@
23: devdir = @devdir@
24: top_builddir = @top_builddir@
25: top_srcdir = @top_srcdir@
26: incdir = $(top_srcdir)/include
27: cross_compiling = @CROSS_COMPILING@
28:
29: # Where to install things...
30: prefix = @prefix@
31: exec_prefix = @exec_prefix@
32: bindir = @bindir@
33: sbindir = @sbindir@
34: sysconfdir = @sysconfdir@
35: libexecdir = @libexecdir@
36: datarootdir = @datarootdir@
37: localstatedir = @localstatedir@
38:
39: # Compiler & tools to use
40: CC = @CC@
41: LIBTOOL = @LIBTOOL@
42:
43: # C preprocessor flags
44: CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(top_srcdir) @CPPFLAGS@
45:
46: # Usually -O and/or -g
47: CFLAGS = @CFLAGS@
48:
49: # PIE flags
50: PIE_CFLAGS = @PIE_CFLAGS@
51: PIE_LDFLAGS = @PIE_LDFLAGS@
52:
53: # Stack smashing protection flags
54: SSP_CFLAGS = @SSP_CFLAGS@
55: SSP_LDFLAGS = @SSP_LDFLAGS@
56:
57: # cppcheck options, usually set in the top-level Makefile
58: 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
59:
60: # Regression tests
61: TEST_PROGS = atofoo_test conf_test hltq_test parseln_test
62: TEST_LIBS = @LIBS@ @LIBINTL@ ../compat/libreplace.la
63: TEST_LDFLAGS = @LDFLAGS@
64:
65: # OS dependent defines
66: DEFS = @OSDEFS@ -D_PATH_SUDO_CONF=\"$(sysconfdir)/sudo.conf\"
67:
68: #### End of system configuration section. ####
69:
70: SHELL = @SHELL@
71:
72: LTOBJS = alloc.lo atobool.lo atoid.lo atomode.lo event.lo fatal.lo fileops.lo \
73: fmt_string.lo gidlist.lo lbuf.lo progname.lo secure_path.lo \
74: setgroups.lo sudo_conf.lo sudo_debug.lo sudo_dso.lo sudo_printf.lo \
75: term.lo ttysize.lo @COMMON_OBJS@
76:
77: ATOFOO_TEST_OBJS = atofoo_test.lo locale_stub.lo
78:
79: PARSELN_TEST_OBJS = parseln_test.lo locale_stub.lo
80:
81: CONF_TEST_OBJS = conf_test.lo locale_stub.lo
82:
83: HLTQ_TEST_OBJS = hltq_test.lo locale_stub.lo
84:
85: all: libsudo_util.la
86:
87: Makefile: $(srcdir)/Makefile.in
88: (cd $(top_builddir) && ./config.status --file common/Makefile)
89:
90: .SUFFIXES: .c .h .lo
91:
92: .c.lo:
93: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $<
94:
95: libsudo_util.la: $(LTOBJS)
96: $(LIBTOOL) --mode=link $(CC) -o $@ $(LTOBJS) -no-install
97:
98: atofoo_test: $(ATOFOO_TEST_OBJS) libsudo_util.la
99: $(LIBTOOL) --mode=link $(CC) -o $@ $(ATOFOO_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
100:
101: conf_test: $(CONF_TEST_OBJS) libsudo_util.la
102: $(LIBTOOL) --mode=link $(CC) -o $@ $(CONF_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
103:
104: parseln_test: $(PARSELN_TEST_OBJS) libsudo_util.la
105: $(LIBTOOL) --mode=link $(CC) -o $@ $(PARSELN_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
106:
107: hltq_test: $(HLTQ_TEST_OBJS) libsudo_util.la
108: $(LIBTOOL) --mode=link $(CC) -o $@ $(HLTQ_TEST_OBJS) libsudo_util.la $(PIE_LDFLAGS) $(SSP_LDFLAGS) $(TEST_LDFLAGS) $(TEST_LIBS)
109:
110: pre-install:
111:
112: install:
113:
114: install-dirs:
115:
116: install-binaries:
117:
118: install-includes:
119:
120: install-doc:
121:
122: install-plugin:
123:
124: uninstall:
125:
126: cppcheck:
127: cppcheck $(CPPCHECK_OPTS) -I$(incdir) -I$(top_builddir) -I$(top_srcdir) $(srcdir)/*.c
128:
129: # Note: some regress checks are run from srcdir for consistent error messages
130: check: $(TEST_PROGS)
131: @if test X"$(cross_compiling)" != X"yes"; then \
132: rval=0; \
133: ./atofoo_test || rval=`expr $$rval + $$?`; \
134: ./hltq_test || rval=`expr $$rval + $$?`; \
135: build_dir=`pwd`; \
136: cd $(srcdir); \
137: for dir in sudo_conf sudo_parseln; do \
138: passed=0; failed=0; total=0; \
139: mkdir -p $$build_dir/regress/$$dir; \
140: for t in regress/$$dir/*.in; do \
141: base=`basename $$t .in`; \
142: out="$$build_dir/regress/$$dir/$${base}.out"; \
143: out_ok="regress/$$dir/$${base}.out.ok"; \
144: err="$$build_dir/regress/$$dir/$${base}.err"; \
145: err_ok="regress/$$dir/$${base}.err.ok"; \
146: if test "$$dir" = "sudo_conf"; then \
147: $$build_dir/conf_test $$t >$$out 2>$$err; \
148: else \
149: $$build_dir/parseln_test <$$t >$$out 2>$$err; \
150: fi; \
151: if cmp $$out $$out_ok >/dev/null; then \
152: passed=`expr $$passed + 1`; \
153: echo "$$dir/$$base: OK"; \
154: else \
155: failed=`expr $$failed + 1`; \
156: echo "$$dir/$$base: FAIL"; \
157: diff $$out $$out_ok || true; \
158: fi; \
159: total=`expr $$total + 1`; \
160: if test -s $$err_ok; then \
161: if cmp $$err $$err_ok >/dev/null; then \
162: passed=`expr $$passed + 1`; \
163: echo "$$dir/$$base (stderr): OK"; \
164: else \
165: failed=`expr $$failed + 1`; \
166: echo "$$dir/$$base (stderr): FAIL"; \
167: diff $$err $$err_ok || true; \
168: fi; \
169: total=`expr $$total + 1`; \
170: elif test -s $$err; then \
171: failed=`expr $$failed + 1`; \
172: echo "$$dir/$$base (stderr): FAIL"; \
173: cat $$err 1>&2; \
174: fi; \
175: done; \
176: if test $$failed -ne 0; then \
177: rval=`expr $$rval + $$failed`; \
178: fi; \
179: echo "$$dir: $$passed/$$total tests passed; $$failed/$$total tests failed"; \
180: done; \
181: exit $$rval; \
182: fi
183:
184: clean:
185: -$(LIBTOOL) --mode=clean rm -f $(TEST_PROGS) *.lo *.o *.la *.a stamp-* core *.core core.* regress/*/*.out
186:
187: mostlyclean: clean
188:
189: distclean: clean
190: -rm -rf Makefile .libs
191:
192: clobber: distclean
193:
194: realclean: distclean
195: rm -f TAGS tags
196:
197: cleandir: realclean
198:
199: # Autogenerated dependencies, do not modify
200: aix.lo: $(srcdir)/aix.c $(incdir)/alloc.h $(incdir)/fatal.h \
201: $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_debug.h \
202: $(incdir)/sudo_util.h $(top_builddir)/config.h \
203: $(top_srcdir)/compat/stdbool.h
204: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/aix.c
205: alloc.lo: $(srcdir)/alloc.c $(incdir)/alloc.h $(incdir)/fatal.h \
206: $(incdir)/gettext.h $(incdir)/missing.h $(top_builddir)/config.h
207: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alloc.c
208: atobool.lo: $(srcdir)/atobool.c $(incdir)/missing.h $(incdir)/sudo_debug.h \
209: $(incdir)/sudo_util.h $(top_builddir)/config.h \
210: $(top_srcdir)/compat/stdbool.h
211: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/atobool.c
212: atofoo_test.lo: $(srcdir)/regress/atofoo/atofoo_test.c $(incdir)/fatal.h \
213: $(incdir)/missing.h $(incdir)/sudo_util.h \
214: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
215: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/atofoo/atofoo_test.c
216: atoid.lo: $(srcdir)/atoid.c $(incdir)/gettext.h $(incdir)/missing.h \
217: $(incdir)/sudo_debug.h $(incdir)/sudo_util.h \
218: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
219: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/atoid.c
220: atomode.lo: $(srcdir)/atomode.c $(incdir)/gettext.h $(incdir)/missing.h \
221: $(incdir)/sudo_debug.h $(incdir)/sudo_util.h \
222: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
223: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/atomode.c
224: conf_test.lo: $(srcdir)/regress/sudo_conf/conf_test.c $(incdir)/missing.h \
225: $(incdir)/queue.h $(incdir)/sudo_conf.h $(top_builddir)/config.h \
226: $(top_srcdir)/compat/stdbool.h
227: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/sudo_conf/conf_test.c
228: event.lo: $(srcdir)/event.c $(incdir)/alloc.h $(incdir)/fatal.h \
229: $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \
230: $(incdir)/sudo_event.h $(incdir)/sudo_util.h \
231: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
232: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event.c
233: event_poll.lo: $(srcdir)/event_poll.c $(incdir)/alloc.h $(incdir)/fatal.h \
234: $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \
235: $(incdir)/sudo_event.h $(top_builddir)/config.h \
236: $(top_srcdir)/compat/stdbool.h
237: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event_poll.c
238: event_select.lo: $(srcdir)/event_select.c $(incdir)/alloc.h $(incdir)/fatal.h \
239: $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \
240: $(incdir)/sudo_event.h $(incdir)/sudo_util.h \
241: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
242: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event_select.c
243: fatal.lo: $(srcdir)/fatal.c $(incdir)/alloc.h $(incdir)/fatal.h \
244: $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \
245: $(incdir)/sudo_plugin.h $(top_builddir)/config.h \
246: $(top_srcdir)/compat/stdbool.h
247: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fatal.c
248: fileops.lo: $(srcdir)/fileops.c $(incdir)/fileops.h $(incdir)/missing.h \
249: $(incdir)/sudo_debug.h $(top_builddir)/config.h \
250: $(top_srcdir)/compat/stdbool.h $(top_srcdir)/compat/timespec.h
251: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fileops.c
252: fmt_string.lo: $(srcdir)/fmt_string.c $(incdir)/missing.h \
253: $(incdir)/sudo_debug.h $(incdir)/sudo_util.h \
254: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
255: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fmt_string.c
256: gidlist.lo: $(srcdir)/gidlist.c $(incdir)/alloc.h $(incdir)/fatal.h \
257: $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_debug.h \
258: $(incdir)/sudo_util.h $(top_builddir)/config.h \
259: $(top_srcdir)/compat/stdbool.h
260: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/gidlist.c
261: hltq_test.lo: $(srcdir)/regress/tailq/hltq_test.c $(incdir)/fatal.h \
262: $(incdir)/missing.h $(incdir)/queue.h $(top_builddir)/config.h \
263: $(top_srcdir)/compat/stdbool.h
264: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/tailq/hltq_test.c
265: lbuf.lo: $(srcdir)/lbuf.c $(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/lbuf.h \
266: $(incdir)/missing.h $(incdir)/sudo_debug.h $(top_builddir)/config.h
267: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/lbuf.c
268: locale_stub.lo: $(top_srcdir)/src/locale_stub.c $(incdir)/fatal.h \
269: $(incdir)/gettext.h $(incdir)/missing.h $(top_builddir)/config.h
270: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(top_srcdir)/src/locale_stub.c
271: parseln_test.lo: $(srcdir)/regress/sudo_parseln/parseln_test.c \
272: $(incdir)/fileops.h $(incdir)/missing.h \
273: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
274: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/sudo_parseln/parseln_test.c
275: progname.lo: $(srcdir)/progname.c $(incdir)/missing.h $(incdir)/sudo_util.h \
276: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
277: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/progname.c
278: secure_path.lo: $(srcdir)/secure_path.c $(incdir)/missing.h \
279: $(incdir)/secure_path.h $(incdir)/sudo_debug.h \
280: $(top_builddir)/config.h
281: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/secure_path.c
282: setgroups.lo: $(srcdir)/setgroups.c $(incdir)/missing.h $(incdir)/sudo_debug.h \
283: $(incdir)/sudo_util.h $(top_builddir)/config.h \
284: $(top_srcdir)/compat/stdbool.h
285: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/setgroups.c
286: sudo_conf.lo: $(srcdir)/sudo_conf.c $(incdir)/alloc.h $(incdir)/fatal.h \
287: $(incdir)/fileops.h $(incdir)/gettext.h $(incdir)/missing.h \
288: $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_conf.h \
289: $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \
290: $(incdir)/sudo_util.h $(top_builddir)/config.h \
291: $(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h
292: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_conf.c
293: sudo_debug.lo: $(srcdir)/sudo_debug.c $(incdir)/alloc.h $(incdir)/fatal.h \
294: $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_debug.h \
295: $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \
296: $(top_builddir)/config.h $(top_srcdir)/compat/stdbool.h
297: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_debug.c
298: sudo_dso.lo: $(srcdir)/sudo_dso.c $(incdir)/missing.h $(incdir)/sudo_dso.h \
299: $(top_builddir)/config.h
300: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_dso.c
301: sudo_printf.lo: $(srcdir)/sudo_printf.c $(incdir)/missing.h \
302: $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \
303: $(top_builddir)/config.h
304: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_printf.c
305: term.lo: $(srcdir)/term.c $(incdir)/missing.h $(incdir)/sudo_debug.h \
306: $(incdir)/sudo_util.h $(top_builddir)/config.h \
307: $(top_srcdir)/compat/stdbool.h
308: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/term.c
309: ttysize.lo: $(srcdir)/ttysize.c $(incdir)/missing.h $(incdir)/sudo_debug.h \
310: $(incdir)/sudo_util.h $(top_builddir)/config.h \
311: $(top_srcdir)/compat/stdbool.h
312: $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/ttysize.c
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>