-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
392 lines (333 loc) · 12.5 KB
/
Makefile
File metadata and controls
392 lines (333 loc) · 12.5 KB
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# -*- makefile -*-
#
# Gnu make only. Seriously.
#
# $Id$
# Defaults/paths from this file
include Makefile.config
RELEASE = $(shell cat RELEASE)
INSTALL_PLUGINS ?= "auto manual contrib snmpauto"
INSTALL = ./install-sh
DIR = $(shell /bin/pwd | sed 's/^.*\///')
INFILES = $(shell find . -name '*.in')
PLUGINS = $(wildcard node/node.d.$(OSTYPE)/* node/node.d/*)
MANCENTER = "Munin Documentation"
MAN8 = node/munin-node node/munin-run \
node/munin-node-configure-snmp \
node/munin-node-configure \
server/munin-graph server/munin-update \
server/munin-limits server/munin-html \
server/munin-gather
PODMAN8 = server/munin-cron
PODMAN5 = server/munin.conf node/munin-node.conf
default: build
install: install-main install-node install-node-plugins install-man
uninstall: uninstall-main
# This removes the installed config so that the next install-pass installs
# a new config. Target suitable for maintainers
unconfig:
rm -f $(HTMLDIR)/.htaccess
rm -f $(CONFDIR)/munin.conf
install-main: build
$(CHECKUSER)
mkdir -p $(CONFDIR)/templates
mkdir -p $(LIBDIR)
mkdir -p $(BINDIR)
mkdir -p $(PERLLIB)
mkdir -p $(LOGDIR)
mkdir -p $(STATEDIR)
mkdir -p $(HTMLDIR)
mkdir -p $(DBDIR)
mkdir -p $(CGIDIR)
$(CHOWN) $(USER) $(LOGDIR) $(STATEDIR) $(RUNDIR) $(HTMLDIR) $(DBDIR)
for p in build/server/*.tmpl; do \
$(INSTALL) -m 0644 "$$p" $(CONFDIR)/templates/ ; \
done
$(INSTALL) -m 0644 server/logo.png $(CONFDIR)/templates/
$(INSTALL) -m 0644 server/style.css $(CONFDIR)/templates/
$(INSTALL) -m 0644 server/definitions.html $(CONFDIR)/templates/
$(INSTALL) -m 0755 server/VeraMono.ttf $(LIBDIR)/
$(INSTALL) -m 0644 resources/favicon.ico $(HTMLDIR)/
test -f $(HTMLDIR)/.htaccess || $(INSTALL) -m 0644 build/server/munin-htaccess $(HTMLDIR)/.htaccess
test -f "$(CONFDIR)/munin.conf" || $(INSTALL) -m 0644 build/server/munin.conf $(CONFDIR)/
$(INSTALL) -m 0755 build/server/munin-cron $(BINDIR)/
$(INSTALL) -m 0755 build/server/munin-check $(BINDIR)/
$(INSTALL) -m 0755 build/server/munin-update $(LIBDIR)/
$(INSTALL) -m 0755 build/server/munin-graph $(LIBDIR)/
$(INSTALL) -m 0755 build/server/munin-html $(LIBDIR)/
$(INSTALL) -m 0755 build/server/munin-limits $(LIBDIR)/
$(INSTALL) -m 0755 build/server/munin-gather $(LIBDIR)/
$(INSTALL) -m 0755 build/server/munin-cgi-graph $(CGIDIR)/
$(INSTALL) -m 0644 build/server/Munin.pm $(PERLLIB)/
uninstall-main: build
for p in build/server/*.tmpl; do \
rm -f $(CONFDIR)/templates/"$$p" ; \
done
rm -f $(CONFDIR)/templates/logo.png
rm -f $(CONFDIR)/templates/style.css
rm -f $(CONFDIR)/templates/definitions.html
rm -f $(HTMLDIR)/.htaccess
rm -f $(CONFDIR)/munin.conf
rm -f $(BINDIR)/munin-cron
rm -f $(BINDIR)/munin-check
rm -f $(LIBDIR)/munin-update
rm -f $(LIBDIR)/munin-graph
rm -f $(LIBDIR)/munin-html
rm -f $(LIBDIR)/munin-limits
rm -f $(CGIDIR)/munin-cgi-graph
rm -f $(PERLLIB)/Munin.pm
-rmdir $(CONFDIR)/templates
-rmdir $(CONFDIR)
-rmdir $(LIBDIR)
-rmdir $(BINDIR)
-rmdir $(LOGDIR)
-rmdir $(STATEDIR)
-rmdir $(HTMLDIR)
-rmdir $(DBDIR)
-rmdir $(CGIDIR)
install-node: build install-node-non-snmp install-node-snmp install-munindoc
echo Done.
uninstall-node: uninstall-node-non-snmp uninstall-node-snmp
echo Undone.
install-node-snmp: build
$(INSTALL) -m 0755 build/node/munin-node-configure-snmp $(LIBDIR)/
install-munindoc: build
$(INSTALL) -m 0755 build/node/munindoc $(BINDIR)/
uninstall-node-snmp: build
rm -f $(LIBDIR)/munin-node-configure-snmp
-rmdir $(LIBDIR)
install-node-non-snmp: build
$(CHECKGROUP)
mkdir -p $(CONFDIR)/plugins
mkdir -p $(CONFDIR)/plugin-conf.d
mkdir -p $(LIBDIR)/plugins
mkdir -p $(SBINDIR)
mkdir -p $(PERLLIB)/Munin/Plugin
mkdir -p $(LOGDIR)
mkdir -p $(STATEDIR)
mkdir -p $(PLUGSTATE)
$(CHOWN) $(PLUGINUSER):$(GROUP) $(PLUGSTATE)
$(CHMOD) 0775 $(PLUGSTATE)
$(CHMOD) 0755 $(CONFDIR)/plugin-conf.d
$(INSTALL) -m 0755 build/node/munin-node $(SBINDIR)/
$(INSTALL) -m 0755 build/node/munin-node-configure $(SBINDIR)/
test -f "$(CONFDIR)/munin-node.conf" || $(INSTALL) -m 0644 build/node/munin-node.conf $(CONFDIR)/
$(INSTALL) -m 0755 build/node/munin-run $(SBINDIR)/
uninstall-node-non-snmp: build
rm -f $(SBINDIR)/munin-node
rm -f $(SBINDIR)/munin-node-configure
rm -f $(CONFDIR)/munin-node.conf
rm -f $(SBINDIR)/munin-run
-rmdir $(CONFDIR)/plugin-conf.d
-rmdir $(CONFDIR)
-rmdir $(SBINDIR)
# ALWAYS DO THE OS SPECIFIC PLUGINS LAST! THAT WAY THEY OVERWRITE THE
# GENERIC ONES
# Some HP-UX plugins needs *.adv support files in LIBDIR
install-node-plugins: build $(PLUGINS) Makefile Makefile.config
for p in build/node/node.d/* build/node/node.d.$(OSTYPE)/* ; do \
if test -f "$$p" ; then \
family=`sed -n 's/^[[:space:]]*#%# family=\(.*\)$$/\1/p' $$p`;\
test "$$family" || family=contrib; \
if echo $(INSTALL_PLUGINS) | \
grep $$family >/dev/null; then \
echo Installing $$p; \
$(INSTALL) -m 0755 $$p $(LIBDIR)/plugins/; \
fi; \
fi \
done
-mv $(LIBDIR)/plugins/*.adv $(LIBDIR)
-mkdir -p $(PLUGSTATE)
$(CHOWN) $(PLUGINUSER):$(GROUP) $(PLUGSTATE)
$(CHMOD) 0775 $(PLUGSTATE)
$(INSTALL) -m 0644 build/node/plugins.history $(LIBDIR)/plugins/
$(INSTALL) -m 0644 build/node/plugin.sh $(LIBDIR)/plugins/
mkdir -p $(PERLLIB)/Munin/Plugin
$(INSTALL) -m 0644 build/node/Plugin.pm $(PERLLIB)/Munin/
$(INSTALL) -m 0644 build/node/SNMP.pm $(PERLLIB)/Munin/Plugin/
uninstall-node-plugins: build $(PLUGINS)
for p in build/node/node.d.$(OSTYPE)/* build/node/node.d/*; do \
rm -f $(LIBDIR)/plugins/`basename $$p` \
done
rm -f $(LIBDIR)/plugins/plugins.history
rm -f $(LIBDIR)/plugins/plugin.sh
-rm -f $(LIBDIR)/*.adv
#TODO:
# configure plugins. Or not. Better done under the direction of the installer
# or the packager.
install-man: build-man Makefile Makefile.config
mkdir -p $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man8
$(INSTALL) -m 0644 build/doc/munin-node.conf.5 $(MANDIR)/man5/
$(INSTALL) -m 0644 build/doc/munin.conf.5 $(MANDIR)/man5/
$(INSTALL) -m 0644 build/doc/munin-node.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-node-configure.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-node-configure-snmp.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-run.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-graph.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-update.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-limits.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-html.8 $(MANDIR)/man8/
$(INSTALL) -m 0644 build/doc/munin-cron.8 $(MANDIR)/man8/
uninstall-man: build-man
rm -f $(MANDIR)/man5/munin-node.conf.5
rm -f $(MANDIR)/man5/munin.conf.5
rm -f $(MANDIR)/man8/munin-node.8
rm -f $(MANDIR)/man8/munin-node-configure.8
rm -f $(MANDIR)/man8/munin-node-configure-snmp.8
rm -f $(MANDIR)/man8/munin-run.8
rm -f $(MANDIR)/man8/munin-graph.8
rm -f $(MANDIR)/man8/munin-update.8
rm -f $(MANDIR)/man8/munin-limits.8
rm -f $(MANDIR)/man8/munin-html.8
rm -f $(MANDIR)/man8/munin-cron.8
-rmdir $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man8 $(MANDIR)
install-doc: build-doc
mkdir -p $(DOCDIR)/resources
$(INSTALL) -m 0644 README $(DOCDIR)/
$(INSTALL) -m 0644 COPYING $(DOCDIR)/
$(INSTALL) -m 0644 build/resources/* $(DOCDIR)/resources
uninstall-doc: build-doc
rm -rf $(DOCDIR)
build: build-stamp
# Recursive pattern rule needed.
# %: %.in Makefile Makefile.config
build-stamp: $(INFILES) Makefile Makefile.config
touch build-stamp
rm -rf build
@for file in $(INFILES); do \
destname=`echo $$file | sed 's/.in$$//'`; \
echo Generating build/$$destname..; \
mkdir -p build/`dirname $$file`; \
sed -e 's|@@PREFIX@@|$(PREFIX)|g' \
-e 's|@@CONFDIR@@|$(CONFDIR)|g' \
-e 's|@@BINDIR@@|$(BINDIR)|g' \
-e 's|@@SBINDIR@@|$(SBINDIR)|g' \
-e 's|@@DOCDIR@@|$(DOCDIR)|g' \
-e 's|@@LIBDIR@@|$(LIBDIR)|g' \
-e 's|@@MANDIR@@|$(MANDIR)|g' \
-e 's|@@LOGDIR@@|$(LOGDIR)|g' \
-e 's|@@HTMLDIR@@|$(HTMLDIR)|g' \
-e 's|@@DBDIR@@|$(DBDIR)|g' \
-e 's|@@STATEDIR@@|$(STATEDIR)|g' \
-e 's|@@PERL@@|$(PERL)|g' \
-e 's|@@PERLLIB@@|$(PERLLIB)|g' \
-e 's|@@PYTHON@@|$(PYTHON)|g' \
-e 's|@@OSTYPE@@|$(OSTYPE)|g' \
-e 's|@@HOSTNAME@@|$(HOSTNAME)|g' \
-e 's|@@MKTEMP@@|$(MKTEMP)|g' \
-e 's|@@VERSION@@|$(VERSION)|g' \
-e 's|@@PLUGSTATE@@|$(PLUGSTATE)|g' \
-e 's|@@CGIDIR@@|$(CGIDIR)|g' \
-e 's|@@USER@@|$(USER)|g' \
-e 's|@@GROUP@@|$(GROUP)|g' \
-e 's|@@PLUGINUSER@@|$(PLUGINUSER)|g' \
-e 's|@@GOODSH@@|$(GOODSH)|g' \
-e 's|@@BASH@@|$(BASH)|g' \
-e 's|@@HASSETR@@|$(HASSETR)|g' \
-e 's|@@SSPOOLDIR@@|$(SSPOOLDIR)|g' \
$$file > build/$$destname; \
done
build-doc: build-doc-stamp Makefile Makefile.config
build-doc-stamp:
touch build-doc-stamp
mkdir -p build/doc
build-man: build-man-stamp
build-man-stamp: build Makefile Makefile.config
touch build-man-stamp
mkdir -p build/doc
for f in $(MAN8); do \
pod2man --section=8 --release=$(RELEASE) --center=$(MANCENTER) build/"$$f" > build/doc/`basename $$f`.8; \
done
for f in $(PODMAN8); do \
pod2man --section=8 --release=$(RELEASE) --center=$(MANCENTER) "$$f".pod > build/doc/`basename $$f .pod`.8; \
done
for f in $(PODMAN5); do \
pod2man --section=5 --release=$(RELEASE) --center=$(MANCENTER) "$$f".pod > build/doc/`basename $$f .pod`.5; \
done
deb:
(! grep MAINTAINER Makefile.config)
-rm debian
-ln -s dists/debian
fakeroot debian/rules binary
tar-pre:
(! grep MAINTAINER Makefile.config)
find . -name '*~' -exec rm -fv {} \;
PWD=`pwd`
-rm -f ../munin-$(VERSION)
(cd ..; ln -s $(PWD) munin-$(VERSION))
tar: tar-pre
GZIP=-9 tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/
rpm-pre:
(! grep MAINTAINER Makefile.config)
@for file in `find dists/redhat/ -type f -name '*.in'`; do \
destname=`echo $$file | sed 's/.in$$//'`; \
echo Generating $$destname..; \
sed -e 's|@@VERSION@@|$(VERSION)|g' \
$$file > $$destname; \
done
-cp dists/tarball/plugins.conf .
# (cd ..; ln -s munin munin-$(VERSION))
rpm: rpm-pre
tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/
(cd ..; rpmbuild -tb munin_$(RELEASE).tar.gz)
rpm-src: rpm-pre
tar -C .. --dereference --exclude .svn -cvzf ../munin-$(RELEASE).tar.gz munin-$(VERSION)/
(cd ..; rpmbuild -ts munin-$(RELEASE).tar.gz)
suse-pre:
(! grep MAINTAINER Makefile.config)
@for file in `find dists/suse/ -type f -name '*.in'`; do \
destname=`echo $$file | sed 's/.in$$//'`; \
echo Generating $$destname..; \
sed -e 's|@@VERSION@@|$(VERSION)|g' \
$$file > $$destname; \
done
-cp dists/tarball/plugins.conf .
# (cd ..; ln -s munin munin-$(VERSION))
suse: suse-pre
tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/
(cd ..; rpmbuild -tb munin-$(RELEASE).tar.gz)
suse-src: suse-pre
tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/
(cd ..; rpmbuild -ts munin-$(RELEASE).tar.gz)
clean:
ifeq ($(MAKELEVEL),0)
-rm -f debian
-ln -sf dists/debian
-fakeroot debian/rules clean
-rm -f debian
endif
-rm -rf build
-rm -f build-stamp
-rm -f build-doc-stamp
-rm -f build-man-stamp
-rm -rf t/install
-rm -f dists/redhat/munin.spec
-rm -f dists/suse/munin.spec
source_dist: clean
(! grep MAINTAINER Makefile.config)
(cd .. && ln -s $(DIR) munin-$(VERSION))
tar -C .. --dereference --exclude .svn -cvzf ../munin_$(RELEASE).tar.gz munin-$(VERSION)/
(cd .. && rm munin-$(VERSION))
ifeq ($(MAKELEVEL),0)
# Re-exec make with the test config
test: t/*.t
$(MAKE) $@ CONFIG=t/Makefile.config
else
test_plugins = id_default id_root env
test: t/*.t t/install $(addprefix $(CONFDIR)/plugins/,$(test_plugins))
@for test in t/*.t; do \
echo -n "$$test: "; \
PERL5LIB=$(PERLLIB) $(PERL) $$test;\
done
endif
node-monkeywrench: install-node
rm -rf $(CONFDIR)/plugins
rm -rf $(LIBDIR)/plugins
mkdir -p $(LIBDIR)/plugins
mkdir -p $(CONFDIR)/plugins
cp monkeywrench/plugin-break*_ $(LIBDIR)/plugins/
$(SBINDIR)/munin-node-configure --suggest
echo 'Done?'
t/install:
$(MAKE) clean install-node install-node-plugins CONFIG=t/Makefile.config INSTALL_PLUGINS=test
.PHONY: install install-main install-node install-doc install-man build build-doc deb clean source_dist test