Newer
Older
Digital_Repository / Repositories / jainslee_private / Makefile
nstanger on 26 Nov 2005 2 KB - Fixed phony targets.
  1. SHELL=/bin/sh
  2.  
  3. ARCHIVE_NAME:=jainslee_private
  4.  
  5. EPRINTS:=/usr/local/eprints
  6. BINDIR:=$(EPRINTS)/bin
  7.  
  8. ARCHIVE_ROOT:=$(EPRINTS)/archives/$(ARCHIVE_NAME)
  9. ARCHIVE_CONFIG:=$(EPRINTS)/archives/$(ARCHIVE_NAME).xml
  10.  
  11.  
  12. .PHONY: deploy generate_apacheconf import_subjects generate_static \
  13. generate_abstracts generate_views restart_apache index stats
  14.  
  15.  
  16. deploy:
  17. @announce "Copying files..."
  18. @sudo rsync --verbose --cvs-exclude --exclude=Makefile \
  19. --recursive --times . $(EPRINTS)/archives > .del-rsync-output
  20. @-grep $(ARCHIVE_NAME) .del-rsync-output
  21. @announce "Correcting ownership..."
  22. sudo chown -R www:www $(ARCHIVE_CONFIG) $(ARCHIVE_ROOT)
  23. @-grep --quiet "$(ARCHIVE_NAME)\\.xml" .del-rsync-output && $(MAKE) generate_apacheconf
  24. @-grep --quiet "$(ARCHIVE_NAME)/cfg/subjects" .del-rsync-output && $(MAKE) import_subjects
  25. @-grep --quiet "\\(otago_eprints/cfg/static/\\)\\|\\(\\.xml\\)" .del-rsync-output && $(MAKE) generate_static
  26. @-grep --quiet "\\(\\.pm\\)\\|\\(\\.xml\\)\|\($(ARCHIVE_NAME)/cfg/subjects\)" .del-rsync-output && $(MAKE) generate_views
  27. @-grep --quiet "\\($(ARCHIVE_NAME)/cfg/ArchiveRenderConfig.pm\\)\\|\\(\\.xml\\)" .del-rsync-output && $(MAKE) generate_abstracts
  28. @-grep --quiet "\\(\\.conf\\)\\|\\(\\.pm\\)\\|\\(\\.xml\\)" .del-rsync-output && $(MAKE) restart_apache
  29. @rm -f .del-rsync-output
  30.  
  31.  
  32. generate_apacheconf:
  33. @announce "generate_apacheconf"
  34. @sudo -u www $(BINDIR)/$@
  35.  
  36. import_subjects generate_static generate_abstracts generate_views:
  37. @announce "$@ $(ARCHIVE_NAME)"
  38. @sudo -u www $(BINDIR)/$@ $(ARCHIVE_NAME)
  39.  
  40. restart_apache:
  41. @announce "Waiting for Apache to shut down..."
  42. # @sudo /usr/sbin/apachectl stop
  43. # @while [ -f /var/run/httpd.pid ]; do echo > /dev/null; done
  44. @sudo /sw/sbin/apachectl stop
  45. @sleep 7
  46. @announce "Waiting for Apache to start up..."
  47. # @sudo /usr/sbin/apachectl start
  48. # @while [ ! -f /var/run/httpd.pid ]; do echo > /dev/null; done
  49. @sudo /sw/sbin/apachectl start
  50. @while [ ! -f /sw/var/apache2/logs/httpd.pid ]; do echo > /dev/null; done
  51.  
  52. index:
  53. @announce "Rebuilding indexes..."
  54. @sudo -u www $(BINDIR)/indexer start --once --notdaemon
  55.  
  56. stats:
  57. @announce "Generating statistics..."
  58. @sudo -u www php $(EPRINTS)/ePrintsStats/scripts/eprints-usage.php
  59. @sudo -u www perl $(EPRINTS)/ePrintsStats/scripts/add_country.pl
  60.  
  61.  
  62. debug:
  63. @echo "ARCHIVE_NAME = [$(ARCHIVE_NAME)]"
  64. @echo "EPRINTS = [$(EPRINTS)]"
  65. @echo "ARCHIVE_ROOT = [$(ARCHIVE_ROOT)]"
  66. @echo "ARCHIVE_CONFIG = [$(ARCHIVE_CONFIG)]"