Makefile.in 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. ###############################
  2. # Makefile for NRPE
  3. #
  4. # Last Modified: 03-14-2007
  5. ###############################
  6. # Source code directories
  7. SRC_BASE=./src/
  8. SRC_INCLUDE=./include/
  9. CC=@CC@
  10. CFLAGS=@CFLAGS@ @DEFS@
  11. LDFLAGS=@LDFLAGS@ @LIBS@
  12. prefix=@prefix@
  13. exec_prefix=@exec_prefix@
  14. CFGDIR=@pkgsysconfdir@
  15. BINDIR=@bindir@
  16. SBINDIR=@sbindir@
  17. LIBEXECDIR=@libexecdir@
  18. INSTALL=@INSTALL@
  19. NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@
  20. NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@
  21. OPSYS=@opsys@
  22. DIST=@dist_type@
  23. USERID=@nrpe_user@
  24. GRPID=@nrpe_group@
  25. INIT_TYPE=@init_type@
  26. INIT_DIR=@initdir@
  27. INIT_OPTS=-o root -g root
  28. INIT_FILE=@initname@
  29. INETD_TYPE=@inetd_type@
  30. INETD_DIR=@inetddir@
  31. INETD_FILE=@inetdname@
  32. SRC_INETD=@src_inetd@
  33. SRC_INIT=@src_init@
  34. default:
  35. @echo;\
  36. echo Please enter 'make [option]' where [option] is one of:;\
  37. echo;\
  38. echo " all builds nrpe and check_nrpe";\
  39. echo " nrpe builds nrpe only";\
  40. echo " check_nrpe builds check_nrpe only";\
  41. echo " install install nrpe and check_nrpe";\
  42. echo " install-plugin install the check_nrpe plugin";\
  43. echo " install-daemon install the nrpe daemon";\
  44. echo " install-group add the $GRPID group id if it does not exist";\
  45. echo " install-user add the $USERID user id if it does not exist";\
  46. echo " install-group-user add the $USERID user and $GRPID group";\
  47. echo " install-config install the nrpe configuration file";\
  48. echo " install-inetd install the startup files for inetd, launchd, etc.";\
  49. echo " install-init install the startup files for init, systemd, etc.";\
  50. echo " solaris-package create the solaris package";\
  51. echo
  52. all:
  53. cd $(SRC_BASE); $(MAKE)
  54. @echo "";\
  55. echo "*** Compile finished ***";\
  56. echo "";\
  57. echo "If the NRPE daemon and client compiled without any errors, you";\
  58. echo "can continue with the installation or upgrade process.";\
  59. echo "";\
  60. echo "Read the PDF documentation (NRPE.pdf) for information on the next";\
  61. echo "steps you should take to complete the installation or upgrade.";\
  62. echo ""
  63. nrpe:
  64. cd $(SRC_BASE); $(MAKE)
  65. check_nrpe:
  66. cd $(SRC_BASE); $(MAKE)
  67. install-plugin:
  68. cd $(SRC_BASE); $(MAKE) $@
  69. install-daemon:
  70. cd $(SRC_BASE); $(MAKE) $@
  71. install:
  72. cd $(SRC_BASE); $(MAKE) $@
  73. install-inetd:
  74. @if test $(SRC_INETD) = unknown; then \
  75. echo No inetd file to install; \
  76. exit 1; \
  77. fi
  78. @if test $(INETD_TYPE) = inetd; then \
  79. grep -E -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) || \
  80. cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \
  81. else \
  82. echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
  83. $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
  84. if test $(INETD_TYPE) = systemd; then \
  85. SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
  86. echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
  87. $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
  88. fi; \
  89. fi
  90. @grep -E -q "^nrpe[\t ]+5666/tcp" /etc/services || \
  91. echo "***** MAKE SURE 'nrpe 5666/tcp' IS IN YOUR /etc/services FILE"
  92. install-init:
  93. @if test $(SRC_INIT) = unknown; then \
  94. echo No init file to install; \
  95. exit 1; \
  96. fi
  97. @if test $(INIT_TYPE) = upstart; then\
  98. echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
  99. $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
  100. echo initctl reload-configuration; \
  101. initctl reload-configuration; \
  102. elif test $(INIT_TYPE) = systemd; then\
  103. echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
  104. $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
  105. else\
  106. echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
  107. $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
  108. fi
  109. install-config:
  110. $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(CFGDIR)
  111. $(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(CFGDIR)
  112. install-group:
  113. @if test $(OPSYS) = aix; then\
  114. mkgroup $(GRPID);\
  115. elif test $(OPSYS) = hpux -o $(OPSYS) = solaris; then\
  116. groupadd $(GRPID);\
  117. elif test $(OPSYS) = osx; then\
  118. newid=`dscl . -list /Groups gid | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`;\
  119. newid=`expr 1 + $newid`;\
  120. dscl . -create /Groups/$(GRPID) gid $$newid;\
  121. elif test $(OPSYS) = "bsd" -a $(DIST) = "freebsd"; then\
  122. pw add group $(GRPID);\
  123. else\
  124. groupadd -r $(GRPID);\
  125. fi
  126. install-user:
  127. @if test $(OPSYS) = aix; then\
  128. useradd -g $(GRPID) $(USERID);\
  129. elif test $(OPSYS) = hpux -o $(OPSYS) = solaris; then\
  130. useradd -g $(GRPID) $(USERID);\
  131. elif test $(OPSYS) = osx; then\
  132. newid=`dscl . -list /Users UniqueID | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`;\
  133. newid=`expr 1 + $newid`;\
  134. dscl . -create /Users/$(USERID);\
  135. dscl . -create /Users/$(USERID) UniqueID $$newid;\
  136. dscl . -append /Groups/$(GRPID) GroupMembership $(USERID);\
  137. elif test $(OPSYS) = "bsd" -a $(DIST) = "freebsd"; then\
  138. pw add user -g $(GRPID) $(USERID);\
  139. else\
  140. useradd -r -g $(GRPID) $(USERID);\
  141. fi
  142. install-group-user:
  143. $(MAKE) install-group
  144. $(MAKE) install-user
  145. solaris-package:
  146. @if [ `uname -s` != "SunOS" ] ; then \
  147. echo "It is recommended you be running on Solaris to build a Solaris package"; \
  148. else \
  149. cd package/solaris; $(MAKE) build ; $(MAKE) pkg ; cd ../..; \
  150. fi
  151. clean:
  152. cd $(SRC_BASE); $(MAKE) $@; cd ..
  153. cd package/solaris; $(MAKE) $@; cd ../..
  154. rm -f core
  155. rm -f *~ */*~
  156. distclean: clean
  157. cd $(SRC_BASE); $(MAKE) $@; cd ..
  158. cd package/solaris; $(MAKE) $@; cd ../..
  159. rm -rf autom4te.cache
  160. rm -f config.log config.status config.cache sample-config/nrpe.cfg $(SRC_INCLUDE)/config.h
  161. rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd
  162. rm -f startup/default-service startup/default-xinetd startup/mac-org.nagios.PKG_NAME.plist
  163. rm -f startup/openrc-conf startup/openrc-init startup/solaris-PKG_NAME.xml
  164. rm -f Makefile
  165. devclean: distclean