srcdir=@srcdir@

CC=@CC@
CFLAGS=@CFLAGS@ @DEFS@
LDFLAGS=@LDFLAGS@ @LIBS@

prefix=@prefix@
exec_prefix=@exec_prefix@
LOGDIR=@localstatedir@
CFGDIR=@sysconfdir@
BINDIR=@bindir@
CGIDIR=@cgibindir@
HTMLDIR=@webdir@
datarootdir=@datarootdir@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
COMMAND_OPTS=@COMMAND_OPTS@

CP=@CP@

clean:
	rm -f *.cfg *.sub core
	rm -f *~
	rm -f images/*.jbf
	rm -f images/logos/*.jbf
	rm -f contexthelp/*~
	rm -f docs/*~
	rm -f docs/images/*.jbf
	rm -f stylesheets/*~
	rm -f js/*~

distclean: clean
	rm -f Makefile config.inc.php

devclean: distclean

install:
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/media
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/stylesheets
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/contexthelp
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/docs
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/docs/images
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/js
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/images
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/images/logos
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/includes
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/ssi
	$(INSTALL) -m 664 $(INSTALL_OPTS) $(srcdir)/robots.txt $(DESTDIR)$(HTMLDIR)
#	$(INSTALL) -m 664 $(INSTALL_OPTS) $(srcdir)/docs/robots.txt $(DESTDIR)$(HTMLDIR)/docs
	$(INSTALL) -m 664 $(INSTALL_OPTS) $(srcdir)/jsonquery.html $(DESTDIR)$(HTMLDIR)
# Remove old files
	rm -f $(DESTDIR)$(HTMLDIR)/index.html
	rm -f $(DESTDIR)$(HTMLDIR)/main.html
	rm -f $(DESTDIR)$(HTMLDIR)/side.html
	rm -f $(DESTDIR)$(HTMLDIR)/map.html
	rm -f $(DESTDIR)$(HTMLDIR)/rss-*
	rm -f $(DESTDIR)$(HTMLDIR)/graph-header.html
	rm -f $(DESTDIR)$(HTMLDIR)/histogram.html
	rm -f $(DESTDIR)$(HTMLDIR)/histogram-form.html
	rm -f $(DESTDIR)$(HTMLDIR)/histogram-graph.html
	rm -f $(DESTDIR)$(HTMLDIR)/histogram-links.html
	rm -f $(DESTDIR)$(HTMLDIR)/infobox.html
	rm -f $(DESTDIR)$(HTMLDIR)/map.php
	rm -f $(DESTDIR)$(HTMLDIR)/map-directive.html
	rm -f $(DESTDIR)$(HTMLDIR)/map-form.html
	rm -f $(DESTDIR)$(HTMLDIR)/map-links.html
	rm -f $(DESTDIR)$(HTMLDIR)/map-popup.html
	rm -f $(DESTDIR)$(HTMLDIR)/trends.html
	rm -f $(DESTDIR)$(HTMLDIR)/trends-form.html
	rm -f $(DESTDIR)$(HTMLDIR)/trends-graph.html
	rm -f $(DESTDIR)$(HTMLDIR)/trends-host-yaxis.html
	rm -f $(DESTDIR)$(HTMLDIR)/trends-links.html
	rm -f $(DESTDIR)$(HTMLDIR)/trends-service-yaxis.html
	rm -f $(DESTDIR)$(HTMLDIR)/js/histogram-events.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/histogram-form.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/histogram-graph.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/histogram.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/map-directive.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/map-form.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/map.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/nagios-decorations.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/nagios-time.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/trends-form.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/trends-graph.js
	rm -f $(DESTDIR)$(HTMLDIR)/js/trends.js
	rm -rf $(DESTDIR)$(HTMLDIR)/include/rss
	rm -rf $(DESTDIR)$(HTMLDIR)/angularjs
	rm -rf $(DESTDIR)$(HTMLDIR)/angularjs/angular-1.3.9
	rm -rf $(DESTDIR)$(HTMLDIR)/angularjs/ui-utils-0.2.3
	rm -rf $(DESTDIR)$(HTMLDIR)/bootstrap-3.3.7
	rm -rf $(DESTDIR)$(HTMLDIR)/bootstrap-3.3.7/css
	rm -rf $(DESTDIR)$(HTMLDIR)/d3
	rm -rf $(DESTDIR)$(HTMLDIR)/spin

	for file in *.php; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR); done
	for file in js/*.js; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/js; done

	for file in $(srcdir)/*.php; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR); done
#	for file in media/*.wav; \
#	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/media; done
	for file in $(srcdir)/stylesheets/*.css; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/stylesheets; done
	for file in $(srcdir)/contexthelp/*.html; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/contexthelp; done
	for file in $(srcdir)/js/*.js; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/js; done
#	for file in docs/*.html; \
#	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/docs; done
#	for file in docs/images/*.*; \
#	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/docs/images; done
	for file in $(srcdir)/images/*.gif; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
	for file in $(srcdir)/images/*.jpg; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
	for file in $(srcdir)/images/*.png; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
	for file in $(srcdir)/images/*.ico; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
	for file in $(srcdir)/images/*.avif; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
	for file in $(srcdir)/images/logos/*.*; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images/logos; done
	for file in $(srcdir)/includes/*.*; \
	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes; done

install-unstripped:
	$(MAKE) install




