## Process this file with automake to produce Makefile.in

objects = @client_etc_objects@ @server_etc_objects@

distobjects = @client_etc_distobjects@ @server_etc_distobjects@

EXTRA_DIST = $(distobjects)

MOSTLYCLEANFILES=$(objects)

all: $(objects)

$(objects): %.example: %
	sed 's%/var/log%$(log_dir)%' < $< | \
	sed 's%/var/run%$(var_dir)%' | \
	sed 's%<pkgdatadir>%$(pkgdatadir)%' | \
	sed 's%<db_path>%$(db_dir)%' | \
	sed 's%<classpath_root>%$(classpath_root)%' > $@

refdbdrc.mysql: refdbdrc
	sed 's%<dbs_port>%3306%' < refdbdrc | \
	sed 's%<pkgdatadir>%$(pkgdatadir)%' | \
	sed 's%<main_db>%$(main_db)%g' | \
	sed 's%<db_path>%$(db_dir)%' | \
	sed 's%<engine>%MySQL%' | \
	sed 's%<db_server>%mysql%' > $@

refdbdrc.pgsql: refdbdrc
	sed 's%<dbs_port>%5432%' < refdbdrc | \
	sed 's%<pkgdatadir>%$(pkgdatadir)%' | \
	sed 's%<main_db>%$(main_db)%g' | \
	sed 's%<db_path>%$(db_dir)%' | \
	sed 's%<engine>%PostgreSQL%' | \
	sed 's%<db_server>%pgsql%' > $@

refdbdrc.sqlite: refdbdrc
	sed 's%<dbs_port>%%' < refdbdrc | \
	sed 's%<pkgdatadir>%$(pkgdatadir)%' | \
	sed 's%<main_db>%$(main_db)%g' | \
	sed 's%<db_path>%$(db_dir)%' | \
	sed 's%<engine>%SQLite%' | \
	sed 's%<db_server>%sqlite%' > $@

refdbdrc.sqlite3: refdbdrc
	sed 's%<dbs_port>%%' < refdbdrc | \
	sed 's%<pkgdatadir>%$(pkgdatadir)%' | \
	sed 's%<main_db>%$(main_db)%g' | \
	sed 's%<db_path>%$(db_dir)%' | \
	sed 's%<engine>%SQLite3%' | \
	sed 's%<db_server>%sqlite3%' > $@

install-data-local:
	$(mkinstalldirs) $(DESTDIR)$(log_dir)
	$(mkinstalldirs) $(DESTDIR)$(var_dir)
	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/db
	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)/@PACKAGE@
	@for f in $(objects); do \
		$(INSTALL_DATA) $$f $(DESTDIR)$(sysconfdir)/@PACKAGE@/$$f; \
	done
