File: Makefile.in

package info (click to toggle)
icinga 1.11.6-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 40,100 kB
  • sloc: ansic: 108,534; sql: 9,538; sh: 5,337; perl: 3,358; makefile: 1,243
file content (642 lines) | stat: -rw-r--r-- 22,950 bytes parent folder | download | duplicates (2)
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
####################################################################
# Makefile for Icinga
####################################################################


###############################
# Source code directories
###############################
SRC_BASE=@srcdir@/base
SRC_CGI=@srcdir@/cgi
SRC_HTM=@srcdir@/html
SRC_DOCS=@srcdir@/html/docs
SRC_DOCS_IMAGES=@srcdir@/html/docs/images
SRC_MODULE=@srcdir@/module
SRC_INCLUDE=@srcdir@/include
SRC_COMMON=@srcdir@/common
SRC_XDATA=@srcdir@/xdata
SRC_CONTRIB=@srcdir@/contrib
SRC_IDOUTILS=@srcdir@/module/idoutils
SRC_T=@srcdir@/t
SRC_DOCBOOK=@srcdir@/docbook
SRC_DOCBOOK_IMAGES=@srcdir@/docbook/images
SRC_DOCBOOK_DE=@srcdir@/docbook/de
SRC_DOCBOOK_EN=@srcdir@/docbook/en

###############################
# Compiler Settings
###############################
CC=@CC@
CFLAGS=@CFLAGS@ @DEFS@
LDFLAGS=@LDFLAGS@ @LIBS@

prefix=@prefix@
exec_prefix=@exec_prefix@
LOGDIR=@LOGDIR@
CGILOGDIR=@CGILOGDIR@
CHECKRESULTDIR=@CHECKRESULTDIR@
EXTCMDFILEDIR=@EXTCMDFILEDIR@
EVENTHANDLERDIR=@EVENTHANDLERDIR@
P1FILELOC=@P1FILELOC@
CFGDIR=@sysconfdir@
BINDIR=@bindir@
LIBDIR=@libdir@
CGIDIR=@sbindir@
LIBEXECDIR=@libexecdir@
HTMLDIR=@datarootdir@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
INSTALL_OPTS_WEB=@INSTALL_OPTS_WEB@
COMMAND_OPTS=@COMMAND_OPTS@
HTTPD_CONF=@HTTPD_CONF@
APACHE24_DEBIAN=@APACHE24_DEBIAN@
HTTPDCONFFILE=@HTTPDCONFFILE@
HTTPAUTHFILE=@HTTPAUTHFILE@
INIT_DIR=@init_dir@
INIT_OPTS=@INIT_OPTS@
SYSTEMD_UNIT_DIR=@systemd_unit_dir@
SYSTEMD_SYSCONFIG_DIR=@systemd_sysconfig_dir@
CGICFGDIR=$(CGIDIR)
PERLDIR=@PERLDIR@
STATEDIR=@STATEDIR@

###############################
# Debug
###############################
ENABLE_DEBUG=@ENABLE_DEBUG@

###############################
# Modules
###############################
USE_EVENTBROKER=@USE_EVENTBROKER@
USE_IDOUTILS=@USE_IDOUTILS@

INSTALLPERLSTUFF=@INSTALLPERLSTUFF@

CGIEXTRAS=@CGIEXTRAS@

###############################
# snprintf (Solaris)
###############################
SNPRINTF_O=@SNPRINTF_O@

###############################
# Tools
###############################
MKDIR=/bin/mkdir

###############################
# Global
###############################
ICINGA_VERSION=1.11.6

CP=@CP@

@SET_MAKE@

none:
	@printf "Please supply a command line argument (i.e. 'make all').\n\n"
	@printf "Generic targets: all, fullinstall, clean\n\n"
	@printf "Other useful targets:\n"
	@printf "\t%-23s - %s\n" "distclean" "make source ready for commit or packaging"
	@printf "\t%-23s - %s\n" "create-tarball" "create tarball for packaging"
	@printf "\t%-23s - %s\n" "create-docs" "generate html docs from docbook"
	@printf "\t%-23s - %s\n" "submodule-init" "init git submodules"
	@printf "\t%-23s - %s\n" "submodule-update" "update git submodules"
	@printf "\t%-23s - %s\n" "submodule-update-latest" "update git submodules, pull latest master"

	@printf "\nCompile targets:\n"
	@printf "\t%-23s - %s\n" "icinga" "icinga core"
	@printf "\t%-23s - %s\n" "cgis" "classic ui"
	@printf "\t%-23s - %s\n" "contrib" "contrib dir"
	@printf "\t%-23s - %s\n" "modules" "icinga modules"
	@printf "\t%-23s - %s\n" "idoutils" "icinga idoutils"
	@printf "\t%-23s - %s\n" "classicui-standalone" "standalone classic ui"

	@printf "\nInstall targets:\n"
	@printf "\t%-23s - %s\n" "install" "install core, cgis, html"
	@printf "\t%-23s - %s\n" "install-base" "install core"
	@printf "\t%-23s - %s\n" "install-cgis" "install classical web"
	@printf "\t%-23s - %s\n" "install-html" "install html files"
	@printf "\t%-23s - %s\n" "install-config" "install sample config"
	@printf "\t%-23s - %s\n" "install-webconf" "install apache config and http auth file for Classic UI"
	@printf "\t%-23s - %s\n" "install-init" "install init script"
	@printf "\t%-23s - %s\n" "install-systemd" "install systemd init script"
	@printf "\t%-23s - %s\n" "install-commandmode" "install external command file"
	@printf "\t%-23s - %s\n" "install-idoutils" "install idoutils module"
	@printf "\t%-23s - %s\n" "install-eventhandlers" "install sample eventhandlers"
	@printf "\t%-23s - %s\n" "install-dev-docu" "install doxygen development documentation"
	@printf "\t%-23s - %s\n" "install-testconfig" "install test config"
	@printf "\t%-23s - %s\n" "install-classicui-standalone" "install standalone classic ui"
	@printf "\t%-23s - %s\n" "install-classicui-standalone-conf" "install standalone classic ui config"


# Solaris make does not support -C option, so we'll use the Apache style... (patch by Stanley Hopcroft 12/27/1999)

###############################
# Compile
###############################

all:
	cd $(SRC_BASE) && $(MAKE)
	cd $(SRC_CGI) && $(MAKE)
	cd $(SRC_HTM) && $(MAKE)

	if [ x$(USE_EVENTBROKER) = xyes ]; then \
		cd $(SRC_MODULE) && $(MAKE); \
	fi

	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		cd $(SRC_IDOUTILS) && $(MAKE); \
	fi

	@echo ""
	@echo "*** Compile finished ***"
	@echo ""
	@echo "If the main program and CGIs compiled without any errors, you"
	@echo "can continue with installing Icinga as follows (type 'make'"
	@echo "without any arguments for a list of all possible options):"
	@echo ""
	@echo "  make install"
	@echo "     - This installs the main program (Icinga Core), CGIs"
	@echo "       (Classical Web), and HTML files"
	@echo ""
	@echo "  make install-init"
	@echo "     - This installs the init script in $(DESTDIR)$(INIT_DIR)"
	@echo ""
	@echo "  make install-commandmode"
	@echo "     - This installs and configures permissions on the"
	@echo "       directory for holding the external command file"
	@echo ""
	@echo "  make install-idoutils"
	@echo "     - This installs the database addon IDOUtils into the"
	@echo "       destination directory"
	@echo ""
	@echo "  make install-config"
	@echo "     - This installs *SAMPLE* config files in $(DESTDIR)$(CFGDIR)"
	@echo "       You'll have to modify these sample files before you can"
	@echo "       use Icinga.  Read the HTML documentation for more info"
	@echo "       on doing this.  Pay particular attention to the docs on"
	@echo "       object configuration files, as they determine what/how"
	@echo "       things get monitored!"
	@echo ""
	@echo "  make install-webconf"
	@echo "     - This installs the Apache config file and http auth file for"
	@echo "       the Icinga Classic UI"
	@echo ""
	@echo ""
	@echo "*** Support Notes *******************************************"
	@echo ""
	@echo "If you have questions about configuring or running Icinga,"
	@echo "please make sure that you:"
	@echo ""
	@echo "     - Look at the sample config files"
	@echo "     - Read the HTML documentation in html/docs/"
	@echo ""
	@echo "before you post a question to one of the mailing lists at"
	@echo "http://www.icinga.org/support/ or at Icinga Portal:"
	@echo "http://www.icinga-portal.org"
	@echo ""
	@echo "Also make sure to include pertinent information that could"
	@echo "help others help you.  This might include:"
	@echo ""
	@echo "     - What version of Icinga you are using"
	@echo "     - What version of the plugins you are using"
	@echo "     - Relevant snippets from your config files"
	@echo "     - Relevant error messages from the Icinga log file"
	@echo ""
	@echo "For more information on obtaining support for Icinga, visit:"
	@echo ""
	@echo "       http://www.icinga.org/support/"
	@echo ""
	@echo "*************************************************************"
	@echo ""
	@echo "Enjoy."
	@echo ""

icinga:
	cd $(SRC_BASE) && $(MAKE)

config:
	@echo "Sample config files are automatically generated once you run the"
	@echo "configure script.  You can install the sample config files on your"
	@echo "system by using the 'make install-config' command."

cgis:
	cd $(SRC_CGI) && $(MAKE)

idoutils:
	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		cd $(SRC_IDOUTILS) && $(MAKE); \
        else \
                echo "" ;\
                echo "Sorry, IDOUtils not enabled!" ;\
                echo "Try again with ./configure --enable-idoutils" ;\
                echo "" ;\
        fi

html:
	cd $(SRC_HTM) && $(MAKE)

contrib:
	cd $(SRC_CONTRIB) && $(MAKE)

modules:
	cd $(SRC_MODULE) && $(MAKE)

classicui-standalone: cgis

	@echo ""
	@echo "Standalone Classic UI CGIs built."
	@echo "Proceed with 'make install-classicui-standalone'."
	@echo ""

###############################
# Clean
###############################

clean:
	cd $(SRC_BASE) && $(MAKE) $@
	cd $(SRC_CGI) && $(MAKE) $@
	cd $(SRC_COMMON) && $(MAKE) $@
	cd $(SRC_XDATA) && $(MAKE) $@
	cd $(SRC_HTM) && $(MAKE) $@
	cd $(SRC_INCLUDE) && $(MAKE) $@
	cd $(SRC_CONTRIB) && $(MAKE) $@
	cd $(SRC_MODULE) && $(MAKE) $@
	cd $(SRC_IDOUTILS) && $(MAKE) $@
	cd $(SRC_T) && $(MAKE) $@

	rm -f *.cfg core
	rm -f *~ *.*~ */*~ */*.*~ */*/*.*~

distclean: clean
	cd $(SRC_BASE) && $(MAKE) $@
	cd $(SRC_CGI) && $(MAKE) $@
	cd $(SRC_COMMON) && $(MAKE) $@
	cd $(SRC_XDATA) && $(MAKE) $@
	cd $(SRC_HTM) && $(MAKE) $@
	cd $(SRC_INCLUDE) && $(MAKE) $@
	cd $(SRC_CONTRIB) && $(MAKE) $@
	cd $(SRC_MODULE) && $(MAKE) $@
	cd $(SRC_IDOUTILS) && $(MAKE) $@
	cd $(SRC_T) && $(MAKE) $@

	rm -f sample-config/*.cfg sample-config/*.conf sample-config/template-object/*.cfg
	rm -f daemon-init pkginfo rc.ido2db ido2db-systemd icinga-systemd sysconfig-env
	rm -f include/dh.h
	rm -f Makefile subst p1.pl
	rm -f config.log config.status config.cache
	rm -f t/var/objects.precache.generated t/var/objects.precache
	rm -f solaris/icinga.xml

devclean: distclean

###############################
# Test
###############################

test:
	$(MAKE) test-perl

test-perl: icinga cgis
	cd t && $(MAKE) test

###############################
# Package
###############################

copy-docs-style:
	cp ${SRC_DOCBOOK}/stylesheets/icinga-docs.css ${SRC_DOCS}/stylesheets/icinga-docs.css
	cp ${SRC_DOCBOOK}/js/icinga-docs.js ${SRC_DOCS}/js/icinga-docs.js

create-docs: copy-docs-style
	#${MAKE} submodule-init
	#${MAKE} submodule-update
	#${MAKE} submodule-update-latest
	cd ${SRC_DOCBOOK_EN} && make en
	cd ${SRC_DOCBOOK_DE} && make de
	cp ${SRC_DOCBOOK_IMAGES}/*.png ${SRC_DOCS_IMAGES}/
	@echo "updated docs :)"

create-tarball:
	$(eval version := $(shell git describe --tags HEAD | sed 's/^v//'))
	git archive -o "../${TARBALL_NAME}-$(version).tar.gz" --prefix="${TARBALL_NAME}-$(version)/" HEAD
	@echo "You find your tarball here: ../${TARBALL_NAME}-$(version).tar.gz"

create-doxygen:
	doxygen

###############################
# GIT
###############################

submodule-init:
	git submodule init docbook

submodule-update:
	git submodule update

submodule-update-latest:
	cd ${SRC_DOCBOOK} && git checkout master && git pull origin master
	@echo "pulled latest docbook :)"


###############################
# Install
###############################


install-html:
	cd $(SRC_HTM) && $(MAKE) install

install-dev-docu:
	cd $(SRC_HTM) && $(MAKE) install-dev-docu

install-base:
	cd $(SRC_BASE) && $(MAKE) install

install-cgis:
	cd $(SRC_CGI) && $(MAKE) install

install:
	cd $(SRC_BASE) && $(MAKE) $@
	cd $(SRC_CGI) && $(MAKE) $@
	cd $(SRC_HTM) && $(MAKE) $@

	$(MAKE) install-basic

install-unstripped:
	cd $(SRC_BASE) && $(MAKE) $@
	cd $(SRC_CGI) && $(MAKE) $@
	cd $(SRC_HTM) && $(MAKE) $@

	$(MAKE) install-basic

install-basic:
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(STATEDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBEXECDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CHECKRESULTDIR)
	if [ $(INSTALLPERLSTUFF) = yes ]; then \
		$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(P1FILELOC); \
		$(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(P1FILELOC); \
	fi;

	@echo ""
	@echo "*** Main program, CGIs and HTML files installed ***"
	@echo ""
	@echo "You can continue with installing Icinga as follows (type 'make'"
	@echo "without any arguments for a list of all possible options):"
	@echo ""
	@echo "  make install-init"
	@echo "     - This installs the init script in $(DESTDIR)$(INIT_DIR)"
	@echo ""
	@echo "  make install-commandmode"
	@echo "     - This installs and configures permissions on the"
	@echo "       directory for holding the external command file"
	@echo ""
	@echo "  make install-eventhandlers"
	@echo "     - This installs the sample eventhandlers in $(DESTDIR)$(EVENTHANDLERDIR)"
	@echo ""
	@echo "  make install-idoutils"
	@echo "     - This installs the database addon IDOUtils into the"
	@echo "       destination directory"
	@echo ""
	@echo "  make install-config"
	@echo "     - This installs sample config files in $(DESTDIR)$(CFGDIR)"
	@echo ""
	@echo "  make install-webconf"
	@echo "     - This installs the Apache config file for the Classic UI"
	@echo ""
	@echo "  make install-webconf-auth"
	@echo "     - This installs the Apache http auth file for the Classic UI"
	@echo ""
	@echo ""
	@echo "*** Make sure to check Changelog for introduced changes! ***"
	@echo "*** In case of an upgrade, don't forget to read the upgrade guides! ***"
	@echo "    http://docs.icinga.org/latest/en/upgrading.html"
	@echo ""

install-cgiconf:
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/cgi.cfg $(DESTDIR)$(CFGDIR)/cgi.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/cgiauth.cfg $(DESTDIR)$(CFGDIR)/cgiauth.cfg


install-config: install-cgiconf
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/objects
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/conf.d
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/modules
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/icinga.cfg $(DESTDIR)$(CFGDIR)/icinga.cfg
	$(INSTALL) -b -m 660 $(INSTALL_OPTS) sample-config/resource.cfg $(DESTDIR)$(CFGDIR)/resource.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/templates.cfg $(DESTDIR)$(CFGDIR)/objects/templates.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/commands.cfg $(DESTDIR)$(CFGDIR)/objects/commands.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/contacts.cfg $(DESTDIR)$(CFGDIR)/objects/contacts.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/notifications.cfg $(DESTDIR)$(CFGDIR)/objects/notifications.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/timeperiods.cfg $(DESTDIR)$(CFGDIR)/objects/timeperiods.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/localhost.cfg $(DESTDIR)$(CFGDIR)/objects/localhost.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/windows.cfg $(DESTDIR)$(CFGDIR)/objects/windows.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/printer.cfg $(DESTDIR)$(CFGDIR)/objects/printer.cfg
	$(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/switch.cfg $(DESTDIR)$(CFGDIR)/objects/switch.cfg

	@echo ""
	@echo "*** Config files installed ***"
	@echo ""
	@echo "Remember, these are *SAMPLE* config files.  You'll need to read"
	@echo "the documentation for more information on how to actually define"
	@echo "services, hosts, etc. to fit your particular needs."
	@echo ""

install-testconfig:
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/tests
	for file in tests/etc/*.cfg; \
	do $(INSTALL) -b -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(CFGDIR)/tests; done


install-webconf:
	$(MKDIR) -p -m 775 $(DESTDIR)$(HTTPD_CONF)
	$(INSTALL) -b -m 644 $(INSTALL_OPTS) sample-config/httpd.conf $(DESTDIR)$(HTTPDCONFFILE)
	@if [ x$(APACHE24_DEBIAN) = xyes ]; then \
		echo " Debian Apache 2.4 detected. " ;\
		echo " Run 'a2enconf icinga' and 'service apache2 reload'" ;\
	fi

	@echo ""
	@echo "*** Icinga/Apache conf file installed ***"
	@echo ""

install-webconf-auth:

	$(MKDIR) -p -m 775 $(DESTDIR)$(HTTPD_CONF)
	$(INSTALL) -b -m 644 $(INSTALL_OPTS) icinga.htpasswd $(DESTDIR)$(HTTPAUTHFILE)

	@echo ""
	@echo "*** Icinga http auth file installed ***"
	@echo ""


install-idoutils:
	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		cd $(SRC_IDOUTILS) && $(MAKE) $@ ;\
	fi
	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		echo "" ;\
		echo "*** IDOUtils installed ***" ;\
		echo "" ;\
		echo "Please check Changelog - CHANGES for more information!" ;\
		echo "Upgrade docs available at http://docs.icinga.org/latest/en/upgrading_idoutils.html " ;\
		echo "" ;\
	else \
		echo "" ;\
		echo "Sorry, IDOUtils not enabled!" ;\
		echo "Try again with ./configure --enable-idoutils" ;\
		echo "" ;\
	fi

install-init: install-daemoninit

install-daemoninit:
	$(INSTALL) -m 755 -d $(INIT_OPTS) $(DESTDIR)$(INIT_DIR)
	$(INSTALL) -m 755 $(INIT_OPTS) daemon-init $(DESTDIR)$(INIT_DIR)/icinga

	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		$(INSTALL) -m 755 $(INIT_OPTS) rc.ido2db $(DESTDIR)$(INIT_DIR)/ido2db ;\
	fi

	@echo ""
	@echo "*** Init script installed ***"
	@echo ""

install-systemd:
	$(INSTALL) -m 755 -d $(INIT_OPTS) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
	$(INSTALL) -m 755 -d $(INIT_OPTS) $(DESTDIR)$(SYSTEMD_SYSCONFIG_DIR)
	$(INSTALL) -m 644 $(INIT_OPTS) icinga-systemd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/icinga.service
	$(INSTALL) -m 644 $(INIT_OPTS) sysconfig-env $(DESTDIR)$(SYSTEMD_SYSCONFIG_DIR)/icinga

	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		$(INSTALL) -m 644 $(INIT_OPTS) ido2db-systemd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ido2db.service ;\
	fi

install-commandmode:
	$(INSTALL) -m 775 $(COMMAND_OPTS) -d $(DESTDIR)$(EXTCMDFILEDIR)
	chmod g+s $(DESTDIR)$(EXTCMDFILEDIR)

	@echo ""
	@echo "*** External command directory configured ***"
	@echo ""

install-eventhandlers:
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(EVENTHANDLERDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(EVENTHANDLERDIR)/distributed-monitoring
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(EVENTHANDLERDIR)/redundancy-scenario1
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/submit_check_result $(DESTDIR)$(EVENTHANDLERDIR)/submit_check_result
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/disable_active_service_checks $(DESTDIR)$(EVENTHANDLERDIR)/disable_active_service_checks
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/enable_active_service_checks $(DESTDIR)$(EVENTHANDLERDIR)/enable_active_service_checks
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/disable_notifications $(DESTDIR)$(EVENTHANDLERDIR)/disable_notifications
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/enable_notifications $(DESTDIR)$(EVENTHANDLERDIR)/enable_notifications
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/distributed-monitoring/obsessive_svc_handler $(DESTDIR)$(EVENTHANDLERDIR)/distributed-monitoring/obsessive_svc_handler
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/distributed-monitoring/submit_check_result_via_nsca $(DESTDIR)$(EVENTHANDLERDIR)/distributed-monitoring/submit_check_result_via_nsca
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/redundancy-scenario1/handle-master-host-event $(DESTDIR)$(EVENTHANDLERDIR)/redundancy-scenario1/handle-master-host-event
	$(INSTALL) -b -m 774 $(INSTALL_OPTS) contrib/eventhandlers/redundancy-scenario1/handle-master-proc-event $(DESTDIR)$(EVENTHANDLERDIR)/redundancy-scenario1/handle-master-proc-event

	@echo ""
	@echo "*** Sample Eventhandlers installed ***"
	@echo ""

install-classicui-standalone-conf: install-cgiconf install-webconf

	@echo ""
	@echo "*** Icinga Classic UI Standalone configuration installed. ***"
	@echo ""

install-classicui-standalone: install-cgis install-html

	# make sure we keep all the needed dirs for data
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(STATEDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
	$(INSTALL) -m 775 $(COMMAND_OPTS) -d $(DESTDIR)$(EXTCMDFILEDIR)

	@echo ""
	@echo "*** Icinga Classic UI Standalone installed. ***"
	@echo ""
	@echo "*** Now use 'make install-classicui-standalone-conf to install the configuration ***"
	@echo ""

fullinstall:
	@if [ x$(USE_IDOUTILS) = xyes ]; then \
		${MAKE} install install-init install-commandmode install-webconf install-idoutils install-eventhandlers;\
		echo "Run make install-config for installing/overwriting the configs..." ;\
        else \
		${MAKE} install install-init install-commandmode install-webconf ;\
		echo "Run make install-config for installing/overwriting the configs..." ;\
        fi

# Uninstall is too destructive if base install directory is /usr, etc.
#uninstall:
#	rm -rf $(DESTDIR)$(BINDIR)/icinga $(DESTDIR)$(CGIDIR)/*.cgi $(DESTDIR)$(CFGDIR)/*.cfg $(DESTDIR)$(HTMLDIR)

#
# Targets for creating packages on various architectures
#

# Solaris pkgmk
PACKDIR=@PACKDIR@
VERSION=@VERSION@
SOL_PKG_NAME=@SOL_PKG_NAME@
SUN_OS_RELEASE=$(shell uname -r | cut -f2 -d. )
SUN_PLATFORM=$(shell uname -p)

Prototype:
	rm -rf $(PACKDIR)
	mkdir -p $(PACKDIR)
	mkdir -p $(PACKDIR)/$(CFGDIR)/objects
	$(MAKE) all
	$(MAKE) DESTDIR=$(PACKDIR) INIT_OPTS='' INSTALL_OPTS='' COMMAND_OPTS='' icinga_grp='' icinga_usr='' \
	    install install-commandmode install-webconf install-idoutils
	cd sample-config; \
	for file in *.cfg; \
	do \
	    ../$(INSTALL) -m 644 $$file $(PACKDIR)/$(CFGDIR)/$$file.$(VERSION); \
	done
	chmod 640 $(PACKDIR)/$(CFGDIR)/resource.cfg.$(VERSION)
	cd sample-config/template-object; \
	for file in *.cfg; \
	do \
	    ../../$(INSTALL) -m 644 $$file $(PACKDIR)/$(CFGDIR)/objects/$$file.$(VERSION); \
	done
	mkdir -p $(PACKDIR)/lib/svc/method/
	$(INSTALL) -o root -g bin -m 555 daemon-init $(PACKDIR)/lib/svc/method/icinga
	mkdir -p $(PACKDIR)/var/svc/manifest/application/
	sed 's%!CFGPREFIX!%$(CFGDIR)%g' solaris/icinga.xml.tpl > solaris/icinga.xml
	$(INSTALL) -m 444 -o root -g root solaris/icinga.xml $(PACKDIR)/var/svc/manifest/application/
	#cd contrib; $(MAKE) all; $(MAKE) DESTDIR=$(PACKDIR) INIT_OPTS='' INSTALL_OPTS='' COMMAND_OPTS='' icinga_grp='' icinga_usr='' install
	echo i pkginfo > solaris/Prototype
	if [ -f solaris/checkinstall.in ] ; then cat solaris/checkinstall.in | sed 's/!SUN_PLATFORM!/$(SUN_PLATFORM)/g' > solaris/checkinstall; fi
	cd solaris; \
	for file in checkinstall preinstall postinstall preremove postremove depend i.manifest r.manifest; \
	do \
	    if [ -f $$file ] ; then echo i $$file >> Prototype; fi ; \
	done
	pkgproto $(PACKDIR)=/ | egrep -v "(s|d) none (/|/var|/usr|/etc|/lib) " >> solaris/Prototype

pkg/icinga/pkgmap: Prototype
	mkdir $(PACKDIR)/$(SOL_PKG_NAME)
	cd solaris; pkgmk -o -r / -f Prototype -d $(PACKDIR) $(SOL_PKG_NAME)

icinga.sun.pkg.tar.gz: pkg/icinga/pkgmap
	cd $(PACKDIR) && tar -cf - icinga | gzip -9 -c > ../icinga-$(VERSION)-Sol$(SUN_OS_RELEASE)-$(SUN_PLATFORM).pkg.tar.gz

icinga.sun.pkg: pkg/icinga/pkgmap
	pkgtrans -s $(PACKDIR) ../icinga-$(VERSION)-Sol$(SUN_OS_RELEASE)-$(SUN_PLATFORM).pkg $(SOL_PKG_NAME)

pkgsettar: icinga.sun.pkg.tar.gz

pkgset: icinga.sun.pkg

pkgclean:
	rm -rf solaris_pkg solaris/Prototype icinga-$(VERSION)-$(SUN_PLATFORM).pkg.tar.gz icinga-$(VERSION)-$(SUN_PLATFORM).pkg