-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile.in
214 lines (189 loc) · 7.34 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# Makefile for NDOUtils
#
# Copyright 2009-2014 Nagios Core Development Team and Community Contributors
# Copyright 2005-2009 Ethan Galstad
#
# This file is part of NDOUtils.
#
# NDOUtils is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# NDOUtils is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NDOUtils. If not, see <http://www.gnu.org/licenses/>.
# Source code directories
SRC_BASE=./src
SRC_INCLUDE=./include
SRC_CONFIG=./config
prefix=@prefix@
exec_prefix=@exec_prefix@
PIPEDIR=@localstatedir@
CFGDIR=@sysconfdir@
BINDIR=@bindir@
LIBEXECDIR=@libexecdir@
NDO2DB_USER=@ndo2db_user@
NDO2DB_GROUP=@ndo2db_group@
INSTALL=@INSTALL@
GREP=@GREP@
EGREP=@EGREP@
OPSYS=@opsys@
DIST=@dist_type@
INIT_TYPE=@init_type@
INIT_DIR=@initdir@
INIT_OPTS=-o root -g @root_grp@
INIT_FILE=@initname@
INETD_TYPE=@inetd_type@
INETD_DIR=@inetddir@
INETD_FILE=@inetdname@
SRC_INETD=@src_inetd@
SRC_INIT=@src_init@
default:
@echo;\
echo Please enter 'make [option]' where [option] is one of:;\
echo;\
echo " all builds the NDO Utilities";\
echo " ndo2db builds the ndo2db daemon";\
echo " ndomod builds the ndomod nagios module";\
echo " file2sock builds the file2sock utility";\
echo " log2ndo builds the log2ndo utility";\
echo " sockdebug builds the sockdebug utility";\
echo " install-groups-users add the user and group if they do not exist";\
echo " install installs the module and programs";\
echo " install-config installs the sample configuration files";\
echo " install-inetd install the startup files for inetd, launchd, etc.";\
echo " install-init install the startup files for init, systemd, etc.";\
echo " fullinstall runs install-groups-users, install,";\
echo " install-config and install-init";\
echo
all:
cd $(SRC_BASE) && $(MAKE)
ndo2db:
cd $(SRC_BASE); $(MAKE) $@
ndomod:
cd $(SRC_BASE); $(MAKE) $@
file2sock:
cd $(SRC_BASE); $(MAKE) $@
log2ndo:
cd $(SRC_BASE); $(MAKE) $@
sockdebug:
cd $(SRC_BASE); $(MAKE) $@
ctags:
ctags -R
install:
cd $(SRC_BASE) && $(MAKE) $@
@echo ""
@echo "Main NDOUtils components installed"
@echo ""
install-config:
$(INSTALL) -m 775 -d $(DESTDIR)$(CFGDIR)
$(INSTALL) -m 775 -d $(DESTDIR)$(PIPEDIR)
$(INSTALL) -m 644 config/ndo2db.cfg-sample $(DESTDIR)$(CFGDIR)
$(INSTALL) -m 644 config/ndomod.cfg-sample $(DESTDIR)$(CFGDIR)
@echo ""
@echo "*** Config files installed ***"
@echo ""
@echo "Remember, these are *SAMPLE* config files. You'll need to rename"
@echo "the files in order to use them."
@echo "Please read the documentation to know what they are doing."
@echo ""
install-groups-users:
@macros/add_group_user $(DIST) $(NDO2DB_USER) $(NDO2DB_GROUP)
install-init:
@if test $(SRC_INIT) = unknown; then \
echo No init file to install; \
exit 1; \
fi
@if test $(INIT_TYPE) = upstart; then\
echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
echo initctl reload-configuration; \
initctl reload-configuration; \
elif test $(INIT_TYPE) = systemd; then\
echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
elif test $(INIT_TYPE) = smf10 -o $(INIT_TYPE) = smf11; then \
echo $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
$(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
echo svccfg import $(INIT_DIR)/$(INIT_FILE); \
svccfg import $(INIT_DIR)/$(INIT_FILE); \
echo "*** Run 'svcadm enable ndo2db' to start it"; \
else\
echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
$(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
if test $(INIT_TYPE) = newbsd; then\
if test $(DIST) = openbsd; then\
echo "# ndo2db@bsd_enable@=NO" >> /etc/rc.conf;\
echo "ndo2db@bsd_enable@=\"-d -c $(CFGDIR)/ndo2db.cfg\"" >> /etc/rc.conf;\
echo "Make sure to enable the ndo2db daemon";\
else\
echo "ndo2db@bsd_enable@=YES" >> /etc/rc.conf;\
echo "ndo2db_configfile=$(CFGDIR)/ndo2db.cfg" >> /etc/rc.conf;\
fi;\
elif test $(INIT_TYPE) = launchd; then\
launchctl load $(INIT_DIR)/$(INIT_FILE); \
else\
if test -f /sbin/chkconfig ; then \
/sbin/chkconfig ndo2db on;\
else\
echo "Make sure to enable the ndo2db daemon";\
fi;\
fi;\
fi
install-inetd:
@if test $(SRC_INETD) = unknown; then \
echo No inetd file to install; \
exit 1; \
fi
@if test $(INETD_TYPE) = inetd; then \
$(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) 2>/dev/null || \
cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \
elif test $(INETD_TYPE) = systemd; then \
SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
$(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
$(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
$(INSTALL) -m 775 -d $(INETD_DIR);\
echo svccfg import $(INETD_DIR)/$(INETD_FILE); \
svccfg import $(INETD_DIR)/$(INETD_FILE); \
echo "*** Run 'svcadm enable nrpe' to start it"; \
elif test $(INIT_TYPE) = launchd; then\
$(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
launchctl load $(INETD_DIR)/$(INETD_FILE); \
else\
echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
$(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
fi
@$(EGREP) -q "^nrpe[\t ]+@ndo2db_port@/tcp" /etc/services || \
echo "***** MAKE SURE 'ndo2db @ndo2db_port@/tcp' IS IN YOUR /etc/services FILE"
fullinstall: install-groups-users install install-config install-init
clean:
cd $(SRC_BASE) && $(MAKE) $@
rm -f core
rm -f *~ */*~ include/nagios-*/*~
distclean: clean
cd $(SRC_BASE) && $(MAKE) $@; cd ..
cd docs/docbook/en-en/ && $(MAKE) $@
rm -f config.log config.status config.cache
rm -f $(SRC_INCLUDE)/dh.h $(SRC_INCLUDE)/config.h
rm -f $(SRC_CONFIG)/ndo2db.cfg-sample $(SRC_CONFIG)/ndomod.cfg-sample $(SRC_CONFIG)/nagios.cfg $(SRC_CONFIG)/misccommands.cfg
rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd
rm -f startup/default-service startup/default-socket startup/default-socket-svc
rm -f startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist
rm -f startup/newbsd-init startup/openbsd-init startup/openrc-conf
rm -f startup/openrc-init startup/rh-upstart-init startup/solaris-init.xml
rm -f startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init
rm -f Makefile
rm -f tags
rm -rf autom4te.cache/
devclean: distclean