Newer
Older
Digital_Repository / Repositories / statistics / Makefile
SHELL=/bin/sh

# Load in machine-specific environment settings from environment_config.make.
# This include file MUST be created and MUST define the following variables:
#
# EPRINTSSTATS: /path/to/eprintsstats/installation
# EPRINTS_USER: the user that owns the EPrints directory
# EPRINTS_GROUP: the group that owns the EPrints directory
#
# EPRINTS_HOST: eprints host name
# EPRINTS_PORT: appropriate HTTP port
# EPRINTS_ADMIN_EMAIL: administrator email address (quote "@" with \)
#
# GEOIP_DATABASE:=/usr/local/share/GeoIP/GeoIP.dat
# 
# APACHE_LOG_LOCATION:=/sw/var/apache2/logs/
# APACHE_LOG_NAME:=access_log
# 
# PHP_LIB:=/sw/lib/php4
#
include environment_config.make


BINDIR:=$(EPRINTSSTATS)/scripts

GENERATED_FILES:=config/inc.vars.es.php scripts/eprints-usage.php \
	scripts/fix-countries.php vhost/apache.conf

CONFIG_SUBS:=EPRINTSSTATS EPRINTS_HOST EPRINTS_PORT EPRINTS_ADMIN_EMAIL
USAGE_SUBS:=GEOIP_DATABASE APACHE_LOG_LOCATION APACHE_LOG_NAME_1 APACHE_LOG_NAME_2
FIX_SUBS:=GEOIP_DATABASE
VHOST_SUBS:=EPRINTSSTATS PHP_LIB


.PHONY: deploy stats


deploy: $(GENERATED_FILES)
	@announce "Copying files..."
	@sudo -u $(EPRINTS_USER) rsync --verbose --cvs-exclude --exclude=Makefile \
		--exclude='*.make' --exclude='*_src.*' \
		--recursive --times . $(EPRINTSSTATS)


config/inc.vars.es.php: config/inc.vars.es_src.php environment_config.make
	@announce "Generating $@"
	perl -p $(foreach SUB,$(CONFIG_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@


scripts/eprints-usage.php: scripts/eprints-usage_src.php environment_config.make
	@announce "Generating $@"
	perl -p $(foreach SUB,$(USAGE_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@


scripts/fix-countries.php: scripts/fix-countries_src.php environment_config.make
	@announce "Generating $@"
	perl -p $(foreach SUB,$(FIX_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@


vhost/apache.conf: vhost/apache_src.conf environment_config.make
	@announce "Generating $@"
	perl -p $(foreach SUB,$(VHOST_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@


stats:
	@announce "Generating statistics..."
	@php $(BINDIR)/eprints-usage.php


debug:
	@echo "EPRINTSSTATS = [$(EPRINTSSTATS)]"
	@echo "BINDIR = [$(BINDIR)]"