###############################
# Makefile for IDOUtils 
#
# Last Modified: 05-01-2009
###############################


# Source code directories
SRC_BASE=./src/
SRC_INCLUDE=./include/
SRC_CONFIG=./config/

prefix=@prefix@
exec_prefix=@exec_prefix@
LOGDIR=@localstatedir@
CFGDIR=@sysconfdir@
BINDIR=@bindir@
LIBEXECDIR=@libexecdir@
CGIDIR=@sbindir@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
USE_IDOUTILS=@USE_IDOUTILS@

all:
	if [ x$(USE_IDOUTILS) = xyes ]; then \
	    cd $(SRC_BASE) && $(MAKE); \
	fi;

clean:
	cd $(SRC_BASE) && $(MAKE) $@
	rm -f core
	rm -f *~ */*~

distclean: clean
	cd $(SRC_BASE) && $(MAKE) $@
	rm -f config.log config.status config.cache $(SRC_INCLUDE)/config.h
	rm -f Makefile
	rm -f init-script.suse subst
	rm -f db/prepsql db/installdb db/upgradedb
	rm -f config/ido2db.cfg-sample config/idomod.cfg-sample config/icinga.cfg

devclean: distclean

install-idoutils: install

install: 
	cd $(SRC_BASE) && $(MAKE) $@
	$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)
	$(INSTALL) -m 664 $(INSTALL_OPTS) config/ido2db.cfg-sample $(DESTDIR)$(CFGDIR)
	$(INSTALL) -m 664 $(INSTALL_OPTS) config/idomod.cfg-sample $(DESTDIR)$(CFGDIR)

