#!/usr/bin/make -f
# Based heavily on Ian Jackson's sample rules file for GNU hello
# Copyright 1994,1995 by Ian Jackson.
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)

package=atsar

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS = -g -I../include -Wall -O0 -fno-strict-aliasing
else
CFLAGS = -g -I../include -Wall -O2 -fno-strict-aliasing
endif
LDFLAGS = 

build: stamp-build

stamp-build: 
	dh_testdir
	$(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
	touch stamp-build

clean:
	dh_testdir
	make clean
	rm -f stamp-build
	dh_clean

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

binary-arch:    stamp-build
	dh_testdir
	dh_testroot
	dh_clean -k

	mkdir -p debian/atsar/usr/bin
	cp atsar/atsar debian/atsar/usr/bin
	mkdir -p debian/atsar/usr/lib/atsar
	cp atsadc/atsadc debian/atsar/usr/lib/atsar
	cp scripts/atsa1 debian/atsar/usr/lib/atsar
	mkdir -p debian/atsar/usr/share/man/man1
	cp man/atsar.1 debian/atsar/usr/share/man/man1
	mkdir -p debian/atsar/usr/share/man/man8
	cp man/atsadc.1 debian/atsar/usr/share/man/man8/atsadc.8
	ln -s atsadc.8 debian/atsar/usr/share/man/man8/atsa1.8
	mkdir -p debian/atsar/var/log/atsar

	dh_installdocs README
	
	dh_installcron

	dh_installchangelogs
	
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Below here is fairly generic really

binary:         binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

.PHONY: binary binary-arch binary-indep clean



