# Target build and script build_single_acct covers Steps 1 to 17
#	of README.PBSWeb
# Downloads and compiles various software packages needed for PBSWeb
build:
	./build_single_acct --with-ssl
	( cd apache/htdocs ; pwd; ln -s ../../PBSWebExport PBSWeb )
	# Now, edit apache/conf/httpd.conf

# Create initial (demo) version of the necessary PostgreSQL database
#	Covers Steps 18 to 21 of README.PBSWeb
setupdb:
	pgsql/bin/postmaster -i -D pgsql/data &
	sleep 5
	pgsql/bin/createdb pbsweb_release
	pgsql/bin/psql -d pbsweb_release -f createdb.psql

# (Re)starts the PostgreSQL database (i.e., postmaster) and Apache
#	Covers Step 24
startpbsweb:
	-killall -TERM postmaster
	sleep 3
	pgsql/bin/postmaster -i -D pgsql/data &
	apache/bin/apachectl startssl
	# Access the web site via:
	# https://<hostname>:8443/PBSWeb/

stoppbsweb:
	-killall -TERM postmaster
	-apache/bin/apachectl stop
clean:
	-/bin/rm -r -f apache*
	-/bin/rm -r -f php-* php
	-/bin/rm -r -f postgresql* pgsql*
	-/bin/rm -r -f openssl*
	-/bin/rm -r -f mod_ssl*
	-/bin/rm -r -f PrivateKeys
	-/bin/rm -r -f *key
	-/bin/rm -f .rnd
	-/bin/rm -f PBSWeb
	-grep 'I_HAVE_SET_VARIABLES=' build_single_acct
