2017-05-19 22:22:40 +02:00
|
|
|
###############################
|
|
|
|
# Makefile for contrib software
|
|
|
|
#
|
|
|
|
# Last Modified: 05-19-2008
|
|
|
|
###############################
|
|
|
|
|
|
|
|
CC=@CC@
|
2017-05-19 23:37:19 +02:00
|
|
|
CFLAGS=-I.. @CFLAGS@ @DEFS@
|
2017-05-19 22:22:40 +02:00
|
|
|
LDFLAGS=@LDFLAGS@ @LIBS@
|
|
|
|
|
|
|
|
# Source code directories
|
|
|
|
SRC_INCLUDE=../include
|
|
|
|
SRC_COMMON=../common
|
|
|
|
SRC_CGI=../cgi
|
2017-05-19 23:37:19 +02:00
|
|
|
SRC_LIB=../lib
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
# Generated automatically from configure script
|
|
|
|
SNPRINTF_O=@SNPRINTF_O@
|
|
|
|
INSTALL=@INSTALL@
|
|
|
|
INSTALL_OPTS=@INSTALL_OPTS@
|
|
|
|
|
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
2019-04-18 17:09:18 +02:00
|
|
|
CGIDIR=@cgibindir@
|
2017-05-19 22:22:40 +02:00
|
|
|
BINDIR=@bindir@
|
|
|
|
|
|
|
|
CGIS=traceroute.cgi daemonchk.cgi
|
2017-05-19 23:37:19 +02:00
|
|
|
UTILS=convertcfg
|
2017-05-19 22:22:40 +02:00
|
|
|
ALL=$(CGIS) $(UTILS)
|
|
|
|
|
|
|
|
|
|
|
|
CGI_C=$(SRC_CGI)/getcgi.c
|
|
|
|
CGI_O=$(SRC_CGI)/getcgi.o $(SNPRINTF_O)
|
|
|
|
CGI_H=$(SRC_INCLUDE)/getcgi.h
|
|
|
|
COMMON_H=$(SRC_INCLUDE)/config.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/locations.h
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# standard targets (all, clean, distclean, devclean, install)
|
|
|
|
|
|
|
|
all: $(ALL)
|
|
|
|
|
|
|
|
clean:
|
2017-05-19 23:37:19 +02:00
|
|
|
rm -f convertcfg daemonchk.cgi core *.o
|
2017-05-19 22:22:40 +02:00
|
|
|
rm -f */*/*~
|
|
|
|
rm -f */*~
|
|
|
|
rm -f *~
|
2017-05-19 23:37:19 +02:00
|
|
|
rm -rf rpmbuild *.rpm
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f Makefile
|
|
|
|
|
|
|
|
devclean: distclean
|
|
|
|
|
|
|
|
install:
|
|
|
|
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CGIDIR)
|
|
|
|
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
|
|
|
|
for f in $(CGIS); do $(INSTALL) -m 775 $(INSTALL_OPTS) $$f $(DESTDIR)$(CGIDIR); done
|
|
|
|
for f in $(UTILS); do $(INSTALL) -m 775 $(INSTALL_OPTS) $$f $(DESTDIR)$(BINDIR); done
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# rules and dependencies for actual target programs
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
$(SRC_LIB)/libnagios.a:
|
|
|
|
make -C $(SRC_LIB) libnagios.a
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
daemonchk.cgi: daemonchk.o $(CGI_O) $(CGI_H) $(COMMON_H) $(SRC_LIB)/libnagios.a
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(CGI_O) $(SRC_LIB)/libnagios.a
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
daemonchk.o: daemonchk.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $< -I$(SRC_INCLUDE)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
nagios-worker: nagios-worker.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBS) $(SRC_LIB)/libnagios.a
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# dependencies
|
|
|
|
|
|
|
|
$(CGI_O): $(CGI_C)
|
|
|
|
cd $(SRC_CGI) && make $(CGI_O)
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# implicit rules
|
|
|
|
|
|
|
|
%.cgi : %.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $< $(CGI_O) -o $@
|
2017-05-19 23:37:19 +02:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# rpm making automation for CentOS/RHEL.
|
|
|
|
|
2019-04-18 17:09:18 +02:00
|
|
|
ARCH ?= $(shell uname -m)
|
2017-05-19 23:37:19 +02:00
|
|
|
ifeq ($(ARCH),x86_64)
|
|
|
|
RPM_ARCH := x86_64
|
|
|
|
else
|
|
|
|
ifeq ($(ARCH),i686)
|
|
|
|
RPM_ARCH := i386
|
|
|
|
else
|
2019-04-18 17:09:18 +02:00
|
|
|
ifeq ($(ARCH),aarch64)
|
|
|
|
RPM_ARCH := aarch64
|
|
|
|
else
|
2017-05-19 23:37:19 +02:00
|
|
|
$(error Unknown arch "$(ARCH)".)
|
2019-04-18 17:09:18 +02:00
|
|
|
endif
|
2017-05-19 23:37:19 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
rpm:
|
|
|
|
# create nagios tar ball.
|
|
|
|
@(cd ..;rm -f nagios-@VERSION@)
|
|
|
|
@(cd ..;ln -s . nagios-@VERSION@)
|
|
|
|
@(cd ..;tar zhcf nagios-@VERSION@.tar.gz --exclude nagios-@VERSION@/nagios-@VERSION@.tar.gz --exclude nagios-@VERSION@/nagios-@VERSION@ --exclude RCS --exclude CVS --exclude build-* --exclude *~ --exclude .git* nagios-@VERSION@/)
|
|
|
|
@(cd ..;rm -f nagios-@VERSION@)
|
|
|
|
# build the rpm using rpmbuild from ./rmbuild as topdir
|
|
|
|
@rm -rf rpmbuild && mkdir -p rpmbuild/SOURCES
|
|
|
|
@cp ../nagios-@VERSION@.tar.gz rpmbuild/SOURCES/nagios-@VERSION@.tar.gz
|
|
|
|
@rpmbuild -ba --define "_topdir ${PWD}/rpmbuild" ../nagios.spec
|
|
|
|
@mv rpmbuild/RPMS/$(RPM_ARCH)/*.rpm .
|
|
|
|
@ls -l *.rpm
|
|
|
|
|