2017-05-19 22:22:40 +02:00
|
|
|
############################
|
|
|
|
# Makefile for Nagios
|
|
|
|
#
|
|
|
|
############################
|
|
|
|
|
|
|
|
|
|
|
|
# Source code directories
|
|
|
|
SRC_COMMON=../common
|
|
|
|
SRC_INCLUDE=../include
|
|
|
|
SRC_XDATA=../xdata
|
2017-05-19 23:37:19 +02:00
|
|
|
SRC_LIB=../lib
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
CC=@CC@
|
2017-05-19 23:37:19 +02:00
|
|
|
CFLAGS=-Wall -I.. @CFLAGS@ @DEFS@ -DNSCORE
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
# Compiler flags for use with gprof
|
2019-04-18 17:09:18 +02:00
|
|
|
#CFLAGS=-pg -I.. -DHAVE_CONFIG_H -DNSCORE
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
# Compiler flags for use with Valgrind
|
2019-04-18 17:09:18 +02:00
|
|
|
#CFLAGS=-O0 -I.. -g -DHAVE_CONFIG_H -DNSCORE
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
# Compiler flags for optimization (overrides default)
|
2019-04-18 17:09:18 +02:00
|
|
|
#CFLAGS=-O3 -Wall -I.. -fno-strict-aliasing -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -DHAVE_CONFIG_H -DNSCORE
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
# Compiler flags for optimization (complements default)
|
|
|
|
#CFLAGS_WARN=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
|
|
|
|
#CFLAGS_DEBUG=-ggdb3 -g3
|
|
|
|
#CFLAGS_GPROF=-pg
|
|
|
|
#CFLAGS+=$(CFLAGS_WARN) $(CFLAGS_DEBUG) $(CFLAGS_GPROF)
|
|
|
|
|
|
|
|
LDFLAGS=@LDFLAGS@
|
|
|
|
LIBS=@LIBS@
|
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
LOGDIR=@localstatedir@
|
|
|
|
CFGDIR=@sysconfdir@
|
|
|
|
BINDIR=@bindir@
|
2019-04-18 17:09:18 +02:00
|
|
|
CGIDIR=@cgibindir@
|
|
|
|
HTMLDIR=@webdir@
|
2017-05-19 22:22:40 +02:00
|
|
|
INSTALL=@INSTALL@
|
|
|
|
INSTALL_OPTS=@INSTALL_OPTS@
|
|
|
|
COMMAND_OPTS=@COMMAND_OPTS@
|
|
|
|
STRIP=@STRIP@
|
|
|
|
|
|
|
|
CGIURL=@cgiurl@
|
|
|
|
HTMURL=@htmurl@
|
|
|
|
|
|
|
|
MATHLIBS=-lm
|
|
|
|
SOCKETLIBS=@SOCKETLIBS@
|
|
|
|
BROKERLIBS=@BROKERLIBS@
|
|
|
|
|
|
|
|
BROKER_LDFLAGS=@BROKER_LDFLAGS@
|
|
|
|
|
|
|
|
CP=@CP@
|
|
|
|
|
|
|
|
# Extra base code
|
|
|
|
BASEEXTRALIBS=@BASEEXTRALIBS@
|
|
|
|
|
|
|
|
# Generated automatically from configure script
|
|
|
|
BROKER_O=@BROKER_O@
|
|
|
|
BROKER_H=@BROKER_H@
|
|
|
|
|
|
|
|
# Object data
|
|
|
|
ODATALIBS=objects-base.o xobjects-base.o
|
|
|
|
ODATAHDRS=
|
|
|
|
ODATADEPS=$(ODATALIBS)
|
|
|
|
|
|
|
|
# Retention data
|
|
|
|
RDATALIBS=retention-base.o xretention-base.o
|
|
|
|
RDATAHDRS=
|
|
|
|
RDATADEPS=$(RDATALIBS)
|
|
|
|
|
|
|
|
# Comment data
|
|
|
|
CDATALIBS=comments-base.o xcomments-base.o
|
|
|
|
CDATAHDRS=
|
|
|
|
CDATADEPS=$(CDATALIBS)
|
|
|
|
|
|
|
|
# Status data
|
|
|
|
SDATALIBS=statusdata-base.o xstatusdata-base.o
|
|
|
|
SDATAHDRS=
|
|
|
|
SDATADEPS=$(SDATALIBS)
|
|
|
|
|
|
|
|
# Performance data
|
|
|
|
PDATALIBS=perfdata-base.o xperfdata-base.o
|
|
|
|
PDATAHDRS=
|
|
|
|
PDATADEPS=$(PDATALIBS)
|
|
|
|
|
|
|
|
# Downtime data
|
2017-05-19 23:37:19 +02:00
|
|
|
DDATALIBS=downtime-base.o
|
2017-05-19 22:22:40 +02:00
|
|
|
DDATAHDRS=
|
|
|
|
DDATADEPS=$(DDATALIBS)
|
|
|
|
|
|
|
|
|
2019-04-18 17:09:18 +02:00
|
|
|
OBJS=$(BROKER_O) $(SRC_COMMON)/shared.o @NERD_O@ query-handler.o workers.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o utils.o $(RDATALIBS) $(CDATALIBS) $(ODATALIBS) $(SDATALIBS) $(PDATALIBS) $(DDATALIBS) $(BASEEXTRALIBS)
|
2017-05-19 22:22:40 +02:00
|
|
|
OBJDEPS=$(ODATADEPS) $(ODATADEPS) $(RDATADEPS) $(CDATADEPS) $(SDATADEPS) $(PDATADEPS) $(DDATADEPS) $(BROKER_H)
|
|
|
|
|
|
|
|
all: nagios nagiostats
|
|
|
|
|
|
|
|
|
|
|
|
######## REQUIRED FILES ##########
|
|
|
|
|
|
|
|
macros-base.o: $(SRC_COMMON)/macros.c $(SRC_INCLUDE)/macros.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_COMMON)/macros.c
|
|
|
|
|
|
|
|
objects-base.o: $(SRC_COMMON)/objects.c $(SRC_INCLUDE)/objects.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_COMMON)/objects.c
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
xobjects-base.o: $(SRC_XDATA)/xodtemplate.c $(SRC_XDATA)/xodtemplate.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_XDATA)/xodtemplate.c
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
statusdata-base.o: $(SRC_COMMON)/statusdata.c $(SRC_INCLUDE)/statusdata.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_COMMON)/statusdata.c
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
xstatusdata-base.o: $(SRC_XDATA)/xsddefault.c $(SRC_XDATA)/xsddefault.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_XDATA)/xsddefault.c
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
comments-base.o: $(SRC_COMMON)/comments.c $(SRC_INCLUDE)/comments.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_COMMON)/comments.c
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
xcomments-base.o: $(SRC_XDATA)/xcddefault.c $(SRC_XDATA)/xcddefault.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_XDATA)/xcddefault.c
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
downtime-base.o: $(SRC_COMMON)/downtime.c $(SRC_INCLUDE)/downtime.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_COMMON)/downtime.c
|
|
|
|
|
|
|
|
perfdata-base.o: perfdata.c $(SRC_INCLUDE)/perfdata.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ perfdata.c
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
xperfdata-base.o: $(SRC_XDATA)/xpddefault.c $(SRC_XDATA)/xpddefault.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_XDATA)/xpddefault.c
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
retention-base.o: sretention.c $(SRC_INCLUDE)/sretention.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ sretention.c
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
xretention-base.o: $(SRC_XDATA)/xrddefault.c $(SRC_XDATA)/xrddefault.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $(SRC_XDATA)/xrddefault.c
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
$(SRC_COMMON)/shared.o: $(SRC_COMMON)/shared.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
workers.o: workers.c wpres-phash.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
wpres-phash.h: wpres.gperf
|
|
|
|
gperf -S 1 -t -H wpres_key_phash -N wpres_get_key $< > $@
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
########## NAGIOS ##########
|
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
libnagios:
|
|
|
|
$(MAKE) -C $(SRC_LIB)
|
|
|
|
|
|
|
|
nagios.o: nagios.c $(SRC_INCLUDE)/nagios.h $(SRC_INCLUDE)/locations.h
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ nagios.c
|
2017-05-19 22:22:40 +02:00
|
|
|
|
2017-05-19 23:37:19 +02:00
|
|
|
nagios: nagios.o $(OBJS) $(OBJDEPS) libnagios
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< $(OBJS) $(BROKER_LDFLAGS) $(LDFLAGS) $(MATHLIBS) $(SOCKETLIBS) $(BROKERLIBS) $(LIBS) $(SRC_LIB)/libnagios.a
|
|
|
|
|
|
|
|
nagiostats: nagiostats.c $(SRC_INCLUDE)/locations.h libnagios
|
|
|
|
$(CC) $(CFLAGS) -o $@ nagiostats.c $(LDFLAGS) $(MATHLIBS) $(LIBS) $(SRC_LIB)/libnagios.a
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
$(OBJS): $(SRC_INCLUDE)/locations.h
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f nagios nagiostats core *.o gmon.out
|
|
|
|
rm -f *~ *.*~
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f perlxsi.c
|
|
|
|
rm -f Makefile
|
|
|
|
|
|
|
|
devclean: distclean
|
2017-05-19 23:37:19 +02:00
|
|
|
rm -f wpres-phash.h
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
install:
|
2019-08-03 18:28:19 +02:00
|
|
|
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL) -s -m 774 $(INSTALL_OPTS) @nagios_name@ $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL) -s -m 774 $(INSTALL_OPTS) @nagiostats_name@ $(DESTDIR)$(BINDIR)
|
2017-05-19 22:22:40 +02:00
|
|
|
|
|
|
|
install-unstripped:
|
|
|
|
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
|
2019-08-03 18:28:19 +02:00
|
|
|
$(INSTALL) -m 774 $(INSTALL_OPTS) nagios $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL) -m 774 $(INSTALL_OPTS) nagiostats $(DESTDIR)$(BINDIR)
|
2017-05-19 23:37:19 +02:00
|
|
|
|
|
|
|
.PHONY: libnagios
|