########################################################################### # # Makefile -- gsdl # A component of the Greenstone digital library software # from the New Zealand Digital Library Project at the # University of Waikato, New Zealand. # # Copyright (C) 1999 The New Zealand Digital Library Project # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ########################################################################### srcdir = @srcdir@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ @SET_MAKE@ CC = @CC@ CXX = @CXX@ CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ LIBS = @LIBS@ MDEFINES = GSDLOS = @gsdlos@ COMPILE = $(CC) -c SOURCES = OBJECTS = ALLFILES = $(OBJECTS) COMPILEDIRS = common-src build-src runtime-src INSTALLDIRS = common-src build-src runtime-src MODULEDIRS = @MODULEDIRS@ # we don't want to compile the jni stuff in indexers for gs2 all: for odir in $(COMPILEDIRS) $(MODULEDIRS); do \ echo making $@ in $$odir; \ (cd $$odir && $(MAKE) $(MDEFINES) $@) || exit 1; \ done install: all for idir in $(INSTALLDIRS); do \ echo installing $$idir; \ (cd $$idir && $(MAKE) install) || exit 1; \ done test-gsdlhome: @ if test -z "${GSDLHOME}" ; then \ echo "" ; \ echo "Environment variable GSDLHOME not set." ; \ echo " This needs to be set to run this Makefile target." ; \ echo " Have you run 'source setup.bash'?" ; \ echo "" ; \ exit 1; \ else \ echo "Using: " ; \ echo " GSDLHOME = ${GSDLHOME}" ; \ echo " GSDLOS = ${GSDLOS}" ; \ fi configure-cgi: test-gsdlhome @ echo "Configuring cgi-bin/gsdlsite.cfg" ; @ sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg ; configure-admin: test-gsdlhome @echo "" ; @echo "Configuring admin user password:" ; encrypted_password=`getpw` ; if [ $$? = "0" ] ; then \ echo -e "[admin]\ntrue\nadministrator,colbuilder,all-collections-editor\n$$encrypted_password\nadmin" \ | txt2db -append "${GSDLHOME}/etc/users.db" ; \ fi @echo "" configure-port: test-gsdlhome @ echo "Enter port number to use:" @ ( read port ; \ if test ! -z $$port ; then \ echo "Stopping web server (if running)" ; \ make web-stop-tested ; \ echo "Setting config file to use port $$port"; \ cat "${GSDLHOME}/apache-httpd/conf/httpd.conf.in" \ | sed "s@\*\*PORT\*\*@$$port@g" \ | sed "s@\*\*GSDLHOME\*\*@${GSDLHOME}@g" \ > "${GSDLHOME}/apache-httpd/conf/httpd.conf" ; \ echo "Type 'make web-start' to start the web server running on port $$port" ; \ fi ; \ echo "Done" ; ) MONITOR_SUCCESS="MAKE SUCCESSFUL" MONITOR_FAILED="MAKE FAILED" MONITOR_FINISHED="MAKE DONE" configure-apache: test-gsdlhome @ echo "Configuring the apache webserver..." ; @ ( port=`egrep "^apache.port" lib/java/build.properties | awk -F= '{print $$2}'` ; \ echo $$port | make configure-port ; ) @ echo $(MONITOR_SUCCESS) @ echo $(MONITOR_FINISHED) configure-web: configure-cgi configure-apache web-status: test-gsdlhome ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl status web-start: test-gsdlhome ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl start @ echo $(MONITOR_SUCCESS) @ echo $(MONITOR_FINISHED) web-restart: test-gsdlhome ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl restart @ echo $(MONITOR_SUCCESS) @ echo $(MONITOR_FINISHED) web-graceful: test-gsdlhome ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl graceful @ echo $(MONITOR_SUCCESS) @ echo $(MONITOR_FINISHED) web-stop-tested: @# This version runs without testing for GSDLHOME @# Useful to be run as a target when we know test-gsdlhome has already @# been done. This avoids a unnecessary repetition of printing @# out the values of GSDLHOME and GSDLOS @ if test -e "${GSDLHOME}/apache-httpd/conf/httpd.conf" ; then \ ${GSDLHOME}/apache-httpd/${GSDLOS}/bin/apachectl stop ; \ fi @ echo $(MONITOR_SUCCESS) @ echo $(MONITOR_FINISHED) web-stop: test-gsdlhome web-stop-tested distclean: clean rm -f Makefile config.cache config.h config.log stamp-h config.status for subdir in $(COMPILEDIRS); do \ echo cleaning $@ in $$subdir; \ (cd $$subdir && $(MAKE) distclean) || exit 1; \ done clean: for subdir in $(COMPILEDIRS); do \ echo cleaning $@ in $$subdir; \ (cd $$subdir && $(MAKE) clean) || exit 1; \ done # commented out - jrm21 Dec 2004 - can get confused by cvs timestamps # (and might run the wrong version of autoconf) # ## For an explanation of the following Makefile rules, see node ## `Automatic Remaking' in GNU Autoconf documentation. #Makefile: Makefile.in config.status # CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status #config.status: configure # ./config.status --recheck #configure: configure.in aclocal.m4 # cd $(srcdir) && autoconf # #config.h: stamp-h #stamp-h: config.h.in config.status # CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status #config.h.in: stamp-h.in #stamp-h.in: configure.in aclocal.m4 acconfig.h # cd $(srcdir) && autoheader # $(TOUCH) $(srcdir)/stamp-h.in