prefix=@prefix@
exec_prefix=@exec_prefix@
LOGDIR=@localstatedir@
CACHEDIR=@web_cache_dir@
CFGDIR=@sysconfdir@
BINDIR=@bindir@
CGIDIR=@sbindir@
HTMLDIR=@datarootdir@
LOGFOLDER=@web_log_dir@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
INSTALL_OPTS_WEB=@INSTALL_OPTS_WEB@
INSTALL_OPTS_CACHE=@INSTALL_OPTS_CACHE@

install: installdirs
	@files=`find . -mindepth 1 -type f \
	! -name "*.in" \
	-and ! -name "Makefile" \
	-and ! -path "./cache/*" \
	-and ! -path "*/data/log*" \
	-and ! -path "*Reporting/data*"`; \
	for file in $$files; do \
		$(INSTALL) -m 644 $(INSTALL_OPTS) "$$file"  $(DESTDIR)$(prefix)/app/"$$file"; \
	done


installdirs:
	$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/app
	
	@dirs=`find . -mindepth 1 -type d \
	! -path "./cache/*" \
	-and ! -path "*/data/log*" \
	-and ! -path "*/data/tmp*" \
	-and ! -path "*Reporting/data*"`; \
	for dir in $$dirs; do \
		$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/app/"$$dir"; \
	done

	$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(CACHEDIR)
	$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(CACHEDIR)/config
	$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(LOGFOLDER)
	$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/app/data/tmp
	$(INSTALL) -m 755 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/app/modules/Reporting/data
