#!/usr/bin/make -f
# -*- makefile -*-

ROOT = $(CURDIR)/debian/tmp

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
#DEB_UPDATE_RCD_PARAMS := "defaults 30"

%:
	dh $@

override_dh_auto_configure:
	autoreconf -vfi
	dh_auto_configure
	#./configure --help
	#./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir="\${prefix}/lib/fred-db" --srcdir=. --disable-dependency-tracking --without-check

#override_dh_auto_install:
#	dh_auto_install
#	dh_installdebconf
#	dh_install debian/tmp/usr/share/fred-db/upgrades/* usr/share/fred-db/upgrades/
#
#	#dh_install -pfred-logger-db debian/tmp/usr/share/fred-db/upgrades/*logger* usr/share/fred-db/upgrades/
#	#rm debian/tmp/usr/share/fred-db/upgrades/*logger*
#	#dh_install -pfred-db debian/tmp/usr/share/fred-db/upgrades/* usr/share/fred-db/upgrades/
	
#	cd $(FRED_SQL_DIR)/upgrades && rm `ls -1 | grep -ve '^[0-9]\+[_.][0-9]\+[_.][0-9]\+-[0-9]\+[_.][0-9]\+[_.][0-9]\+-ddl.sql$$'`
#	( echo "create language plpgsql;" ; cat $(FRED_SQL_DIR)/structure.sql ) >$(DBC_DIR)/install/postgresql
#	# FIXME: this is incomplete and probably wrong, due to missing *-dml.sql and *logger*.sql files
#	for ufile in `ls -1 $(FRED_SQL_DIR)/upgrades/` ; do filever=`echo $${ufile} | cut -d- -f2 | tr _ .`; ln -s ../../../../../fred-db/upgrades/$${ufile} $(DBC_DIR)/upgrade/postgresql/$${filever} ; done
#
#	cd $(FRED_LOGGER_SQL_DIR)/upgrades && rm `ls -1 | grep -ve '^[0-9]\+[_.][0-9]\+[_.][0-9]\+-[0-9]\+[_.][0-9]\+[_.][0-9]\+logger-ddl.sql$$'`
#	cat sql/logger_* >$(CURDIR)/debian/fred-logger-db/usr/share/fred-db/logger-db.sql
#	ln -s ../../../../fred-db/logger-db.sql $(DBC_LOGGER_DIR)/install/postgresql
#	# FIXME: this is incomplete and probably wrong, due to missing *-dml.sql and *logger*.sql files
#	for ufile in `ls -1 $(FRED_LOGGER_SQL_DIR)/upgrades/` ; do filever=`echo $${ufile} | cut -d- -f2 | tr _ .`; ln -s ../../../../../fred-db/upgrades/$${ufile} $(DBC_LOGGER_DIR)/upgrade/postgresql/$${filever} ; done




#FRED_SQL_DIR = $(CURDIR)/debian/fred-db/usr/share/fred-db
#DBC_DIR = $(CURDIR)/debian/fred-db/usr/share/dbconfig-common/data/fred-db
#
#FRED_LOGGER_SQL_DIR = $(CURDIR)/debian/fred-logger-db/usr/share/fred-db
#DBC_LOGGER_DIR = $(CURDIR)/debian/fred-logger-db/usr/share/dbconfig-common/data/fred-logger-db

