#!/usr/bin/make -f
# debian/rules build file for eject copyright Martin Mitchell 2001.
# this file is placed under the GNU GPL.
# debhelperized by Frank Lichtenheld 2004
#export DH_VERBOSE=1

package=eject

CFLAGS = -Wall -g
INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

deb_dir		=	debian/eject
udeb_dir	=	debian/eject-udeb
build_dirs	=	$(deb_dir) $(udeb_dir)

build:
	dh_testdir
	./configure --prefix=/usr
	$(MAKE) AM_CFLAGS= CFLAGS="$(CFLAGS)"
	touch build

clean:
	dh_testdir
	dh_testroot
	-rm -f build

	-$(MAKE) distclean

	dh_clean

binary-indep:	build
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch:	build
	dh_testdir
	dh_testroot
	dh_clean -k -a
	dh_installdirs -a

	make install mandir=/usr/share/man DESTDIR=$(CURDIR)/$(deb_dir)
	cp -a $(deb_dir)/usr $(udeb_dir)/
	rm -fr $(udeb_dir)/usr/share/man

	dh_installchangelogs ChangeLog
	dh_installdocs README NEWS AUTHORS TODO
	dh_installdebconf -peject-udeb

	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a

	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums
	dh_builddeb -a

# Below here is fairly generic really

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean checkroot
