#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=gnome-objc
i=$(shell pwd)/debian/tmp
b=$(shell pwd)/debian/build

BFLAGS=CFLAGS='-g -O2 -Wall -fPIC -D_REENTRANT' LDFLAGS='-s'

configure: configure.in
	@echo "--- Making configure script and configuring"
	chmod +x autogen.sh
	./autogen.sh --prefix=/@PREFIX@ --with-gtk-prefix=/@GTKPREFIX@

Makefile: configure
	@echo "--- Configuring"
	./configure --prefix=/@PREFIX@ --with-gtk-prefix=/@GTKPREFIX@

build: configure Makefile build-debstamp
build-debstamp:
	@echo "--- Compiling"
	dh_testdir
	$(MAKE) all
	touch build-debstamp

clean: Makefile
	@echo "--- Cleaning"
	$(checkdir)
	-rm -rf static shared
	-rm -f build-debstamp install-debstamp
	-make distclean
	-rm -f `find . -name "*~"`
	-rm -rf `find . -name "\.deps"`
	-rm -rf `find . -name "\.libs"`
	-rm -rf `find . -name "*\.rej"`
	-rm -rf debian/tmp `find debian/* -type d ! -name CVS` debian/files* core
	-rm -f debian/*substvars

install: build install-debstamp
install-debstamp:
	@echo "--- Installing"
	dh_testdir
	dh_testroot
	dh_clean
	rm -rf $(b)
	$(MAKE) install prefix=$(i)/@PREFIX@ exec_prefix=$(i)/@PREFIX@
	touch install-debstamp

install-save: install
	rm -rf $(i).saved
	cp -a $(i) $(i).saved

install-saved:
	rm -rf $(i)
	cp -a $(i).saved $(i)
	rm -rf $(b)
	touch install-debstamp

binary-indep: build install

binary-arch: build install \
	libobgtk1@SUFFIX@ \
	libobgtk-dev@SUFFIX@ \
	libobgnome0@SUFFIX@ \
	libobgnome-dev@SUFFIX@

#
# libobgtk1@SUFFIX@
#

libobgtk1@SUFFIX@: install
	@echo "--- Building: $@"
	dh_installdocs       -p$@ -P$(b)/$@ README NEWS AUTHORS
	dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
	dh_movefiles         -p$@ -P$(b)/$@
	dh_strip             -p$@ -P$(b)/$@ 
	dh_compress          -p$@ -P$(b)/$@ 
	dh_fixperms          -p$@ -P$(b)/$@ 
	dh_installdeb        -p$@ -P$(b)/$@
	dh_shlibdeps         -p$@ -P$(b)/$@
	dh_gencontrol        -p$@ -P$(b)/$@
	dh_makeshlibs        -p$@ -P$(b)/$@ -V
	dh_md5sums           -p$@ -P$(b)/$@
	dh_builddeb          -p$@ -P$(b)/$@
 
#
# libobgtk-dev@SUFFIX@
#

libobgtk-dev@SUFFIX@: install
	@echo "--- Building: $@"
	dh_installdocs       -p$@ -P$(b)/$@ \
				 README NEWS AUTHORS
	dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
	dh_movefiles         -p$@ -P$(b)/$@
	dh_strip             -p$@ -P$(b)/$@ 
	dh_compress          -p$@ -P$(b)/$@ 
	dh_fixperms          -p$@ -P$(b)/$@ 
	dh_installdeb        -p$@ -P$(b)/$@
	dh_shlibdeps         -p$@ -P$(b)/$@
	dh_gencontrol        -p$@ -P$(b)/$@
	dh_makeshlibs        -p$@ -P$(b)/$@ -V
	dh_md5sums           -p$@ -P$(b)/$@
	dh_builddeb          -p$@ -P$(b)/$@

#
# libobgnome0@SUFFIX@
#

libobgnome0@SUFFIX@: install
	@echo "--- Building: $@"
	dh_installdocs       -p$@ -P$(b)/$@ README NEWS AUTHORS
	dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
	dh_movefiles         -p$@ -P$(b)/$@
	dh_strip             -p$@ -P$(b)/$@ 
	dh_compress          -p$@ -P$(b)/$@ 
	dh_fixperms          -p$@ -P$(b)/$@ 
	dh_installdeb        -p$@ -P$(b)/$@
	dh_shlibdeps         -p$@ -P$(b)/$@
	dh_gencontrol        -p$@ -P$(b)/$@
	dh_makeshlibs        -p$@ -P$(b)/$@ -V
	dh_md5sums           -p$@ -P$(b)/$@
	dh_builddeb          -p$@ -P$(b)/$@
 
#
# libobgnome-dev@SUFFIX@
#

libobgnome-dev@SUFFIX@: install
	@echo "--- Building: $@"
	dh_installdocs       -p$@ -P$(b)/$@ \
				 README NEWS AUTHORS
	dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
	dh_movefiles         -p$@ -P$(b)/$@
	dh_strip             -p$@ -P$(b)/$@ 
	dh_compress          -p$@ -P$(b)/$@ 
	dh_fixperms          -p$@ -P$(b)/$@ 
	dh_installdeb        -p$@ -P$(b)/$@
	dh_shlibdeps         -p$@ -P$(b)/$@
	dh_gencontrol        -p$@ -P$(b)/$@
	dh_makeshlibs        -p$@ -P$(b)/$@ -V
	dh_md5sums           -p$@ -P$(b)/$@
	dh_builddeb          -p$@ -P$(b)/$@


binary: binary-indep binary-arch

.PHONY: binary clean binary-indep binary-arch build install install-save install-saved


