diff options
Diffstat (limited to 'plugins-root/Makefile.am')
-rw-r--r-- | plugins-root/Makefile.am | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/plugins-root/Makefile.am b/plugins-root/Makefile.am new file mode 100644 index 00000000..aae9adbe --- /dev/null +++ b/plugins-root/Makefile.am | |||
@@ -0,0 +1,74 @@ | |||
1 | ## Process this file with automake to produce Makefile.in | ||
2 | |||
3 | VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t | ||
4 | |||
5 | INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl -I$(top_srcdir)/plugins | ||
6 | |||
7 | datadir = @datadir@ | ||
8 | localedir = $(datadir)/locale | ||
9 | DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ | ||
10 | LIBS = @LIBINTL@ @LIBS@ @SSLINCLUDE@ | ||
11 | |||
12 | EXTRA_PROGRAMS = check_dhcp check_icmp | ||
13 | |||
14 | BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a | ||
15 | NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) | ||
16 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) | ||
17 | |||
18 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) | ||
19 | |||
20 | TESTS = @PLUGIN_TEST@ | ||
21 | |||
22 | test: | ||
23 | perl -I $(top_builddir) -I $(top_srcdir) ../test.pl | ||
24 | |||
25 | all-local: $(EXTRA_PROGRAMS) | ||
26 | |||
27 | setuid_root_mode = 4550 | ||
28 | |||
29 | group = nagios | ||
30 | |||
31 | # /* Author Coreutils team - see ACKNOWLEDGEMENTS */ | ||
32 | |||
33 | INSTALL_SUID = \ | ||
34 | for f in $(EXTRA_PROGRAMS) ; do \ | ||
35 | p=$$f; \ | ||
36 | echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p"; \ | ||
37 | $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p; \ | ||
38 | echo " chown root $(DESTDIR)$(libexecdir)/$$p"; \ | ||
39 | chown root $(DESTDIR)$(libexecdir)/$$p; \ | ||
40 | echo " chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p"; \ | ||
41 | chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p; \ | ||
42 | done | ||
43 | |||
44 | install-root: $(EXTRA_PROGRAMS) | ||
45 | @$(INSTALL_SUID) | ||
46 | |||
47 | install-exec-local: $(EXTRA_PROGRAMS) | ||
48 | @TMPFILE=$(DESTDIR)$(libexecdir)/.setuid-$$$$; \ | ||
49 | rm -f $$TMPFILE; \ | ||
50 | echo > $$TMPFILE; \ | ||
51 | ## See if we can create a setuid root executable in $(libexecdir). | ||
52 | ## If not, then don't even try to install setuid plugins. | ||
53 | can_create_suid_root_executable=no; \ | ||
54 | chown root $$TMPFILE > /dev/null 2>&1 \ | ||
55 | && chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \ | ||
56 | && can_create_suid_root_executable=yes; \ | ||
57 | rm -f $$TMPFILE; \ | ||
58 | if test $$can_create_suid_root_executable = yes; then \ | ||
59 | $(INSTALL_SUID); \ | ||
60 | else \ | ||
61 | echo "WARNING: insufficient access; not installing setuid plugins"; \ | ||
62 | echo "NOTE: to install setuid plugins, run 'make install-root' as root"; \ | ||
63 | fi | ||
64 | |||
65 | # /* Author Coreutils team sub-citation */ | ||
66 | |||
67 | ############################################################################## | ||
68 | # the actual targets | ||
69 | check_dhcp_LDADD = $(NETLIBS) | ||
70 | check_icmp_LDADD = $(SOCKETLIBS) | ||
71 | |||
72 | check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS) | ||
73 | check_icmp_DEPENDENCIES = check_icmp.c | ||
74 | |||