Newer
Older
Digital_Repository / Repositories / statistics / Makefile
  1. SHELL=/bin/sh
  2.  
  3. # Load in machine-specific environment settings from environment_config.make.
  4. # This include file MUST be created and MUST define the following variables:
  5. #
  6. # EPRINTSSTATS: /path/to/eprintsstats/installation
  7. # EPRINTS_USER: the user that owns the EPrints directory
  8. # EPRINTS_GROUP: the group that owns the EPrints directory
  9. #
  10. # EPRINTS_HOST: eprints host name
  11. # EPRINTS_PORT: appropriate HTTP port
  12. # EPRINTS_ADMIN_EMAIL: administrator email address (quote "@" with \)
  13. #
  14. # GEOIP_DATABASE:=/usr/local/share/GeoIP/GeoIP.dat
  15. #
  16. # APACHE_LOG_LOCATION:=/sw/var/apache2/logs/
  17. # APACHE_LOG_NAME:=access_log
  18. #
  19. # PHP_LIB:=/sw/lib/php4
  20. #
  21. include environment_config.make
  22.  
  23.  
  24. BINDIR:=$(EPRINTSSTATS)/scripts
  25.  
  26. GENERATED_FILES:=config/inc.vars.es.php scripts/eprints-usage.php \
  27. scripts/fix-countries.php vhost/apache.conf
  28.  
  29. CONFIG_SUBS:=EPRINTSSTATS EPRINTS_HOST EPRINTS_PORT EPRINTS_ADMIN_EMAIL
  30. USAGE_SUBS:=GEOIP_DATABASE APACHE_LOG_LOCATION APACHE_LOG_NAME
  31. FIX_SUBS:=GEOIP_DATABASE
  32. VHOST_SUBS:=EPRINTSSTATS PHP_LIB
  33.  
  34.  
  35. .PHONY: deploy stats
  36.  
  37.  
  38. deploy: $(GENERATED_FILES)
  39. @announce "Copying files..."
  40. @sudo -u $(EPRINTS_USER) rsync --verbose --cvs-exclude --exclude=Makefile \
  41. --exclude='*.make' --exclude='*_src.*' \
  42. --recursive --times . $(EPRINTSSTATS)
  43.  
  44.  
  45. config/inc.vars.es.php: config/inc.vars.es_src.php environment_config.make
  46. @announce "Generating $@"
  47. perl -p $(foreach SUB,$(CONFIG_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@
  48.  
  49.  
  50. scripts/eprints-usage.php: scripts/eprints-usage_src.php environment_config.make
  51. @announce "Generating $@"
  52. perl -p $(foreach SUB,$(USAGE_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@
  53.  
  54.  
  55. scripts/fix-countries.php: scripts/fix-countries_src.php environment_config.make
  56. @announce "Generating $@"
  57. perl -p $(foreach SUB,$(FIX_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@
  58.  
  59.  
  60. vhost/apache.conf: vhost/apache_src.conf environment_config.make
  61. @announce "Generating $@"
  62. perl -p $(foreach SUB,$(VHOST_SUBS),-e "s|##$(SUB)##|$($(SUB))|g;") $< > $@
  63.  
  64.  
  65. stats:
  66. @announce "Generating statistics..."
  67. @php $(BINDIR)/eprints-usage.php
  68.  
  69.  
  70. debug:
  71. @echo "EPRINTSSTATS = [$(EPRINTSSTATS)]"
  72. @echo "BINDIR = [$(BINDIR)]"