Code

Avoid the use of .PHONY (target s created twice and I have no idea if it's right).
[nagiosplug.git] / plugins-root / Makefile.am
1 ## Process this file with automake to produce Makefile.in
3 NP-VERSION-FILE: .FORCE-NP-VERSION-FILE
4         @$(SHELL_PATH) $(top_srcdir)/NP-VERSION-GEN
5 .FORCE-NP-VERSION-FILE:
7 -include NP-VERSION-FILE
9 AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
11 VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t $(srcdir)
13 INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins @SSLINCLUDE@
15 localedir = $(datadir)/locale
16 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
17 # Don't add LTLIBINTL to all, as pst3 doesn't need it
18 #LIBS = @LTLIBINTL@ @LIBS@
20 noinst_PROGRAMS = check_dhcp check_icmp @EXTRAS_ROOT@
22 EXTRA_PROGRAMS = pst3
24 EXTRA_DIST = pst3.c
26 BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
27 NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
28 NETLIBS = $(NETOBJS) $(SOCKETLIBS)
30 TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir)
32 TESTS = @PLUGIN_TEST@
34 test:
35         perl -I $(top_builddir) -I $(top_srcdir) ../test.pl
37 setuid_root_mode = ug=rx,u+s
39 # /* Author Coreutils team - see ACKNOWLEDGEMENTS */
41 INSTALL_SUID = \
42         for f in $(noinst_PROGRAMS) ; do \
43         p=$$f; \
44         echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p"; \
45         $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$p; \
46         echo " chown root $(DESTDIR)$(libexecdir)/$$p"; \
47         chown root $(DESTDIR)$(libexecdir)/$$p; \
48         echo " chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p"; \
49         chmod $(setuid_root_mode) $(DESTDIR)$(libexecdir)/$$p; \
50         done
52 install-root: $(noinst_PROGRAMS)
53         @$(INSTALL_SUID)
55 install-exec-local: $(noinst_PROGRAMS)
56         @TMPFILE=$(DESTDIR)$(libexecdir)/.setuid-$$$$; \
57         rm -f $$TMPFILE; \
58         echo > $$TMPFILE; \
59         ## See if we can create a setuid root executable in $(libexecdir).
60         ## If not, then don't even try to install setuid plugins.
61         can_create_suid_root_executable=no; \
62         chown root $$TMPFILE > /dev/null 2>&1 \
63           && chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
64           && can_create_suid_root_executable=yes; \
65         rm -f $$TMPFILE; \
66         if test $$can_create_suid_root_executable = yes; then \
67           $(INSTALL_SUID); \
68         else \
69           echo "WARNING: insufficient access; not installing setuid plugins"; \
70           echo "NOTE: to install setuid plugins, run 'make install-root' as root"; \
71         fi
73 # /* Author Coreutils team sub-citation */
75 ##############################################################################
76 # the actual targets
77 check_dhcp_LDADD = @LTLIBINTL@ $(NETLIBS)
78 check_icmp_LDADD = @LTLIBINTL@ $(NETLIBS) $(SOCKETLIBS)
79 # -m64 needed at compiler and linker phase
80 pst3_CFLAGS = @PST3CFLAGS@
81 pst3_LDFLAGS = @PST3CFLAGS@
83 check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS) 
84 check_icmp_DEPENDENCIES = check_icmp.c $(NETOBJS)
86 all-local: .FORCE-NP-VERSION-FILE
88 clean-local:
89         rm -f NP-VERSION-FILE