#!/usr/bin/make -f # debian/rules file - for tinyos-tools # Based on sample debian/rules file - for GNU Hello (1.3). # Copyright 1994,1995 by Ian Jackson. # Copyright 1998-2007 James Troup # 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.) # This file may have to be extensively modified include /usr/share/dpatch/dpatch.make package = tinyos toolspkg = $(package)-tools srcpkg = $(package)-source msppkg = tinyos-msp430 avrpkg = tinyos-avr STRIP = strip --strip-unneeded --remove-section=.comment --remove-section=.note install_dir = install -d -m 755 install_file = install -m 644 install_script = install -m 755 install_binary = install -m 755 -s DISTRIBUTION := $(shell lsb_release -is) # At the current time (20080827) tinyos-tools will not build from a separate # build directory. # # For now, the solution is quite hackish: copy the source directory to the # build directory before running configure. tempdir := $(shell tempfile $(PACKAGE)) version := $(shell head -1 debian/changelog | sed -e s'|^.*(\([^-)]*\).*$$|\1|') configure-stamp: patch-stamp $(checkdir) rm -rf configure-stamp builddir $(tempdir) cp -a . $(tempdir) rm -rf $(tempdir)/debian mv -f $(tempdir) builddir cd builddir/tools && ./Bootstrap && ./configure --prefix=/usr touch $@ build: build-stamp build-stamp: configure-stamp $(checkdir) $(MAKE) -C builddir/tools touch $@ install: install-stamp install-stamp: checkroot build-stamp $(checkdir) rm -rf debian/$(toolspkg) $(install_dir) debian/$(toolspkg) $(MAKE) -C builddir/tools prefix=$$(pwd)/debian/$(toolspkg)/usr \ mandir=$$(pwd)/debian/$(toolspkg)/usr/share/man install touch $@ binary-indep: checkroot build install : # Nothing to do binary-arch: checkroot build install $(checkdir) : # install maintainer scripts $(install_dir) debian/$(toolspkg)/DEBIAN : # install docs $(install_dir) debian/$(toolspkg)/usr/share/doc/$(toolspkg)/ $(install_file) debian/changelog \ debian/$(toolspkg)/usr/share/doc/$(toolspkg)/changelog.Debian $(install_file) debian/copyright \ debian/$(toolspkg)/usr/share/doc/$(toolspkg)/ $(install_file) tools/README debian/README.Debian \ debian/$(toolspkg)/usr/share/doc/$(toolspkg)/ : # Remove unnecessary files installed : # Create links : # Compress stuff that needs it gzip -9 debian/$(toolspkg)/usr/share/man/man1/* find debian/$(toolspkg)/usr/share/doc/$(toolspkg) -type f \ ! -name copyright | xargs gzip -9 : # Finish it all up find debian/$(toolspkg) -type f | xargs file | grep ELF | \ cut -d: -f 1 | xargs dpkg-shlibdeps dpkg-gencontrol -isp -Pdebian/$(toolspkg) -p$(toolspkg) chown -R root:root debian/$(toolspkg) chmod -R go=rX debian/$(toolspkg) dpkg --build debian/$(toolspkg) .. : # Build the tinyos-source package rm -rf debian/$(srcpkg) $(install_dir) debian/$(srcpkg)/DEBIAN $(install_dir) debian/$(srcpkg)/opt/tinyos chmod u+x tools/release/extractor tools/release/extractor debian/$(srcpkg)/opt/tinyos/$(version) < \ tools/release/tinyos.files >/dev/null dpkg-gencontrol -isp -Pdebian/$(srcpkg) -p$(srcpkg) chown -R root:root debian/$(srcpkg) chmod -R go=rX debian/$(srcpkg) dpkg --build debian/$(srcpkg) .. : # Build the tinyos package too rm -rf debian/$(package) $(install_dir) debian/$(package)/DEBIAN $(install_dir) debian/$(package)/opt/tinyos $(install_file) tinyos.sh debian/$(package)/opt/tinyos dpkg-gencontrol -isp -Pdebian/$(package) -p$(package) chown -R root:root debian/$(package) chmod -R go=rX debian/$(package) dpkg --build debian/$(package) .. : # Build tinyos-msp430 dummy package rm -rf debian/tmp $(install_dir) debian/tmp/DEBIAN dpkg-gencontrol -isp -Pdebian/tmp -p$(msppkg) chown -R root:root debian/tmp chmod -R go=rX debian/tmp dpkg --build debian/tmp .. : # Build tinyos-avr dummy package rm -rf debian/tmp $(install_dir) debian/tmp/DEBIAN dpkg-gencontrol -isp -Pdebian/tmp -p$(avrpkg) chown -R root:root debian/tmp chmod -R go=rX debian/tmp dpkg --build debian/tmp .. binary: binary-indep binary-arch clean: unpatch $(checkdir) -rm -rf debian/tmp debian/$(package) debian/$(toolspkg) debian/$(srcpkg) builddir -rm -fr debian/patched debian/files* debian/substvars -rm -f *-stamp define checkdir test -d tos/chips -a -f debian/rules endef checkroot: $(checkdir) test root = "`whoami`" .PHONY: binary clean checkroot