#!/usr/bin/make -f

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
endif

build: build-stamp

build-stamp: 
	dh_testdir
	gcc -Wall -O2 -g -o readahead readahead.c 
	gcc -O0 -g `pkg-config --cflags glib-2.0` -o fileordering fileordering.c `pkg-config --libs glib-2.0`
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp readahead fileordering
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	install -o root -g root -m 0755 readahead \
		debian/readahead/usr/sbin/readahead
	install -o root -g root -m 0755 fileordering \
		debian/readahead/usr/sbin/readahead-fileordering
#	install -o root -g root -m 0755 debian/readahead_early.init.d \
#		debian/readahead/etc/init.d/readahead_early
	install -o root -g root -m 0755 debian/readahead.init.d \
		debian/readahead/etc/init.d/readahead
	install -o root -g root -m 0755 readahead.files \
		debian/readahead/etc/readahead/readahead
	
	
binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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