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

DISABLE_UPDATE_UPLOADERS := 1
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/class/gnome.mk
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

LDFLAGS += -Wl,-z,defs

LDFLAGS += -Wl,--as-needed

LDFLAGS += -Wl,-O1

LDFLAGS += -ldl

GNOME_MODULE := libgda

SONAME := 4
DEB_DH_INSTALL_SOURCEDIR := debian/tmp
DEB_CONFIGURE_EXTRA_FLAGS += --with-postgres=$(shell pg_config --includedir) --without-bdb --without-mSQL --without-ibmdb2 --without-sybase --without-tds --without-oracle --without-firebird --without-xbase --without-mdb --without-ldap --without-mysql
DEB_DH_STRIP_ARGS += --dbg-package=libgda4-$(SONAME)
DEB_DH_MAKESHLIBS_ARGS_ALL += -X /usr/lib/libgda-4.0/providers

clean::
	sed -e 's#@SONAME@#$(SONAME)#g' \
		-e 's#@GNOME_TEAM@#$(UPLOADERS)#g' \
		debian/control.in >debian/control
	
	# remove generated files
	rm -f libsql/lexer.c
	rm -f libsql/parser.c

$(DEB_BUILDDIR)/config.status: DEB_CONFIGURE_EXTRA_FLAGS += $(shell if test -f /usr/share/pkgconfig/gtk-doc.pc; then echo "--enable-gtk-doc"; fi)

common-binary-post-install-arch::
	for i in libgda4-common libgda4-bin libgda4-dev libgda4-$(SONAME)-dbg \
	  libgda4-mysql libgda4-postgres libgda4-sqlite; \
	do \
		rm -rf debian/$$i/usr/share/doc; \
		dh_link -p$$i usr/share/doc/libgda4-$(SONAME) usr/share/doc/$$i; \
	done

.PHONY: clean common-binary-post-install-arch
