## Process this file with automake to produce Makefile.in
EXTRA_SCRIPTS = refdbjade runbib runbib-missing db2ris refdb-bug refdbxml refdbrtf marc2ris med2ris en2ris refdbsru refdb-sruserver refdbnd refdb_dos2unix refdbctl refdb-ms refdb-backup refdb-restore refdb-init bib2ris-utf8 refdb_latex2utf8txt rtfcitations refdb-pubmed
bin_SCRIPTS = @server_scripts@ @client_scripts@

EXTRA_DIST=refdb.in refdbjade.in runbib.in runbib-missing db2ris.in refdb-bug.in refdbxml.in refdbrtf.in refdbctl.in refdb-upgrade.sql marc2ris.in med2ris.in en2ris.in refdbsru.in refdb-sruserver.in refdbnd.in vargen.pl libgen.pl statgen.pl xslns.pl refdb_dos2unix.in migrate_mysql_0.9.5 refdb.2.dump.mysql41.in refdb.2.dump.pgsql.in refdb.2.dump.sqlite.in refdb.3.dump.mysql41.in refdb.3.dump.pgsql.in refdb.3.dump.sqlite.in empty.2.dump.mysql41.in empty.2.dump.pgsql.in empty.2.dump.sqlite3.in refdb-ms dtdparseweave refdb-backup refdb-restore refdb-init.in bib2ris-utf8.in refdb_latex2utf8txt rtfcitations refdb-pubmed

MOSTLYCLEANFILES=refdb refdbjade runbib db2ris refdbxml refdbrtf refdbctl refdb-bug refdbnd marc2ris med2ris en2ris refdbsru refdb-sruserver refdb_dos2unix refdb.2.dump.mysql41 refdb.2.dump.pgsql refdb.2.dump.sqlite refdb.3.dump.mysql41 refdb.3.dump.pgsql refdb.3.dump.sqlite empty.2.dump.mysql41 empty.2.dump.pgsql empty.2.dump.sqlite3 refdb-init bib2ris-utf8

sqlscripts=refdb.2.dump.mysql41 refdb.2.dump.pgsql refdb.2.dump.sqlite refdb.3.dump.mysql41 refdb.3.dump.pgsql refdb.3.dump.sqlite empty.2.dump.mysql41 empty.2.dump.pgsql empty.2.dump.sqlite3

utctimestamp=$(shell date -u "+%Y-%m-%d %H:%M:%S")

all: refdb refdb.2.dump.mysql41 refdb.2.dump.pgsql refdb.2.dump.sqlite refdb.3.dump.mysql41 refdb.3.dump.pgsql refdb.3.dump.sqlite empty.2.dump.mysql41 empty.2.dump.pgsql empty.2.dump.sqlite3 refdb-init bib2ris-utf8

refdb: refdb.in
	sed 's%<prefix>%$(prefix)%' < $(srcdir)/refdb.in | \
	sed 's%<program_prefix>%$(program_prefix)%' | \
	sed 's%<program_suffix>%$(program_suffix)%' > refdb
	chmod a+x refdb

refdbjade: refdbjade.in
	sed 's%<myjade>%$(myjade)%' < $(srcdir)/refdbjade.in | \
	sed 's%<refdbcat>%$(pkgdatadir)/refdb.cat%' | \
	sed 's%<myshell>%$(myshell)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' | \
	sed 's%<sgml_decl>%$(sgml_decl)%' > refdbjade
	chmod a+x refdbjade

runbib: runbib.in
	sed 's%<myrefdblib>%$(pkgdatadir)%g' < $(srcdir)/runbib.in | \
	sed 's%<myjade>%$(myjade)%' | \
	sed 's%<myxsltproc>%$(myxsltproc)%' | \
	sed 's%<sgml_decl>%$(sgml_decl)%' | \
	sed 's%<myshell>%$(myshell)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' | \
	sed 's%<program_prefix>%$(program_prefix)%' | \
	sed 's%<program_suffix>%$(program_suffix)%' | \
	sed 's%<xml_decl>%$(xml_decl)%' > runbib
	chmod a+x runbib

db2ris: db2ris.in
	sed 's%<myrefdblib>%$(pkgdatadir)%' < $(srcdir)/db2ris.in | \
	sed 's%<myjade>%$(myjade)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' | \
	sed 's%<sgml_decl>%$(sgml_decl)%' > db2ris
	chmod a+x db2ris

refdbxml: refdbxml.in
	sed 's%<docbk_root>%$(docbk_xsl)%g' < $(srcdir)/refdbxml.in | \
	sed 's%<tei_root>%$(tei_xsl)%g' | \
	sed 's%<docbk_root_ns>%$(docbk_xsl_ns)%g' | \
	sed 's%<tei_root_ns>%$(tei_xsl_ns)%g' | \
	sed 's%<myshell>%$(myshell)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' | \
	sed 's%<classpath_root>%$(classpath_root)%' > refdbxml
	chmod a+x refdbxml

refdbrtf: refdbrtf.in
	sed 's%<myshell>%$(myshell)%' < $(srcdir)/refdbrtf.in | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' > refdbrtf
	chmod a+x refdbrtf

refdbctl: refdbctl.in
	sed 's%<refdbd>%$(bindir)/$(program_prefix)refdbd$(program_suffix)%' < $(srcdir)/refdbctl.in | \
	sed 's%<myrefdblib>%$(pkgdatadir)%' | \
	sed 's%<myshell>%$(myshell)%' | \
	sed 's%<psarg>%$(psarg)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%g' | \
	sed 's%<piddir>%$(var_dir)%' > refdbctl
	chmod a+x refdbctl

refdb-init: refdb-init.in
	sed 's%/var/log%$(log_dir)%' < $(srcdir)/refdb-init.in | \
	sed 's%/var/run%$(var_dir)%' | \
	sed 's%<pkgdatadir>%$(pkgdatadir)%' | \
	sed 's%<db_path>%$(db_dir)%' | \
	sed 's%<myshell>%$(myshell)%' | \
	sed 's%<psarg>%$(psarg)%' | \
	sed 's%<prefix>%$(prefix)%g' | \
	sed 's%<program_prefix>%$(program_prefix)%' | \
	sed 's%<program_suffix>%$(program_suffix)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%g' | \
	sed 's%<piddir>%$(var_dir)%' > refdb-init
	chmod a+x refdb-init

refdb-bug: refdb-bug.in
	sed 's%<refdblib>%$(pkgdatadir)%' < $(srcdir)/refdb-bug.in | \
	sed 's%<program_prefix>%$(program_prefix)%' | \
	sed 's%<program_suffix>%$(program_suffix)%' | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' > refdb-bug
	chmod a+x refdb-bug

refdbnd: refdbnd.in
	sed 's%<refdblib>%$(pkgdatadir)%' < $(srcdir)/refdbnd.in > refdbnd
	chmod a+x refdbnd

refdb_dos2unix: refdb_dos2unix.in
	sed 's%<myshell>%$(myshell)%' < $(srcdir)/refdb_dos2unix.in > refdb_dos2unix
	chmod a+x refdb_dos2unix

bib2ris-utf8: bib2ris-utf8.in
	sed 's%<prefix>%$(prefix)%g' < $(srcdir)/bib2ris-utf8.in | \
	sed 's%<program_prefix>%$(program_prefix)%g' | \
	sed 's%<program_suffix>%$(program_suffix)%g' > bib2ris-utf8
	chmod a+x bib2ris-utf8

marc2ris: marc2ris.in
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' < $(srcdir)/marc2ris.in | \
	sed 's%<refdblib>%$(pkgdatadir)%'  > marc2ris
	chmod a+x marc2ris

med2ris: med2ris.in
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' < $(srcdir)/med2ris.in | \
	sed 's%<refdblib>%$(pkgdatadir)%'  > med2ris
	chmod a+x med2ris

en2ris: en2ris.in
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' < $(srcdir)/en2ris.in   > en2ris
	chmod a+x en2ris

refdbsru: refdbsru.in
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' < $(srcdir)/refdbsru.in   > refdbsru
	chmod a+x refdbsru

refdb-sruserver: refdb-sruserver.in
	sed 's%<refdblib>%$(pkgdatadir)%' < $(srcdir)/refdb-sruserver.in | \
	sed 's%<sysconfdir>%$(sysconfdir)/@PACKAGE@%' > refdb-sruserver
	chmod a+x refdb-sruserver

refdb.2.dump.mysql41: refdb.2.dump.mysql41.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/refdb.2.dump.mysql41.in |\
	sed 's%<version>%@VERSION@%' > refdb.2.dump.mysql41

refdb.2.dump.pgsql: refdb.2.dump.pgsql.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/refdb.2.dump.pgsql.in |\
	sed 's%<version>%@VERSION@%' > refdb.2.dump.pgsql

refdb.2.dump.sqlite: refdb.2.dump.sqlite.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/refdb.2.dump.sqlite.in |\
	sed 's%<version>%@VERSION@%' |\
	sed 's%CURRENT_TIMESTAMP%$(utctimestamp)%g' > refdb.2.dump.sqlite

refdb.3.dump.mysql41: refdb.3.dump.mysql41.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/refdb.3.dump.mysql41.in |\
	sed 's%<version>%@VERSION@%' > refdb.3.dump.mysql41

refdb.3.dump.pgsql: refdb.3.dump.pgsql.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/refdb.3.dump.pgsql.in |\
	sed 's%<version>%@VERSION@%' > refdb.3.dump.pgsql

refdb.3.dump.sqlite: refdb.3.dump.sqlite.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/refdb.3.dump.sqlite.in |\
	sed 's%<version>%@VERSION@%' |\
	sed 's%CURRENT_TIMESTAMP%$(utctimestamp)%g' > refdb.3.dump.sqlite

empty.2.dump.mysql41: empty.2.dump.mysql41.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/empty.2.dump.mysql41.in |\
	sed 's%<version>%@VERSION@%' > empty.2.dump.mysql41

empty.2.dump.pgsql: empty.2.dump.pgsql.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/empty.2.dump.pgsql.in |\
	sed 's%<version>%@VERSION@%' > empty.2.dump.pgsql

empty.2.dump.sqlite3: empty.2.dump.sqlite3.in
	sed 's%<package>%@PACKAGE@%' < $(srcdir)/empty.2.dump.sqlite3.in |\
	sed 's%<version>%@VERSION@%' |\
	sed 's%CURRENT_TIMESTAMP%$(utctimestamp)%g' > empty.2.dump.sqlite3

if HAVESERVER
install-data-local:
	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/sql
	@for f in $(sqlscripts); do \
		$(INSTALL_DATA) $$f $(DESTDIR)$(pkgdatadir)/sql/$$f; \
	done
endif
