#!/usr/bin/make -f
# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
+# debian/rules file - for gcc 3.2.3 with mspgcc patches
+# Based on sample debian/rules file - for GNU Hello (1.3).
+# 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.)
+# This file may have to be extensively modified
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+include /usr/share/dpatch/dpatch.make
+package = deputy-tinyos
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
else
CFLAGS += -O2
endif
-
-config.status: configure
- dh_testdir
- # Add here commands to configure the package.
- ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+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)
+NJOBS =
+# Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
+ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
+ COMMA = ,
+ NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
+endif
-build: build-stamp
+# At the current time (20080827) deputy-tinyos 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))
+
+
+configure-stamp: patch-stamp
+ $(checkdir)
+ rm -rf configure-stamp builddir
+ rm -f $(tempdir)
+ cp -a . $(tempdir)
+ rm -rf $(tempdir)/debian
+ mv -f $(tempdir) builddir
+ cd builddir && ./configure --host=$(DEB_HOST_GNU_TYPE) \
+ --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
+ --mandir=/usr/share/man --infodir=/usr/share/info \
+ CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+ touch $@
-build-stamp: config.status
- dh_testdir
- # Add here commands to compile the package.
- $(MAKE)
+build: build-stamp
+build-stamp: configure-stamp
+ $(checkdir)
+ $(MAKE) -C builddir
#docbook-to-man debian/deputy.sgml > deputy.1
+ touch $@
+
+install: install-stamp
+install-stamp: checkroot build-stamp
+ $(checkdir)
+ rm -rf debian/tmp
+ $(install_dir) debian/tmp
+ $(MAKE) -C builddir prefix=$$(pwd)/debian/tmp/usr \
+ mandir=$$(pwd)/debian/tmp/usr/share/man install
+ : # upstream Makefile doesn't understand mandir
+ $(install_dir) debian/tmp/usr/share
+ mv $$(pwd)/debian/tmp/usr/man \
+ $$(pwd)/debian/tmp/usr/share/man
touch $@
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
- # Add here commands to clean up after the build process.
- -$(MAKE) realclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
- cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
- cp -f /usr/share/misc/config.guess config.guess
-endif
+# Build architecture-independent files here.
+binary-indep: checkroot build install
+# We have nothing to do by default.
+# Build architecture-dependent files here.
+binary-arch: checkroot build install
+ $(checkdir)
+ : # install maintainer scripts
+ $(install_dir) debian/tmp/DEBIAN
+ : # install post scripts
+ : # $(install_script) debian/deputy-tinyos.postinst debian/tmp/DEBIAN/postinst
+ : # $(install_script) debian/deputy-tinyos.postrm debian/tmp/DEBIAN/postrm
+ : # $(install_file) debian/deputy-tinyos.shlibs debian/tmp/DEBIAN/shlibs
+ : # install docs
+ $(install_dir) debian/tmp/usr/share/doc/$(package)/
+ $(install_file) debian/changelog \
+ debian/tmp/usr/share/doc/$(package)/changelog.Debian
+ $(install_file) debian/copyright debian/tmp/usr/share/doc/$(package)/
+ $(install_file) LICENSE debian/README.Debian \
+ debian/tmp/usr/share/doc/$(package)/
+ : # Remove unnecessary files installed
+ rm debian/tmp/usr/lib/deputy/bin/deputy.byte.exe
+ : # Create links
+ : # Compress stuff that needs it
+ gzip -9 debian/tmp/usr/share/man/man1/*
+ find debian/tmp/usr/share/doc/$(package)/ -type f ! -name copyright | \
+ xargs gzip -9
+ : # Finish it all up
+ find debian/tmp -type f | xargs file | grep ELF | cut -d: -f 1 | \
+ xargs dpkg-shlibdeps
+ dpkg-gencontrol -isp $(CONFLICTS)
+ chown -R root:root debian/tmp
+ chmod -R go=rX debian/tmp
+ dpkg --build debian/tmp ..
- dh_clean
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
+binary: binary-indep binary-arch
- # Add here commands to install the package into debian/deputy.
- $(MAKE) prefix=$(CURDIR)/debian/deputy/usr install-base
+clean: unpatch
+ $(checkdir)
+ -rm -rf debian/tmp builddir
+ -find . -name \*.gmo -o -name \*~ -o -name \*.info | xargs rm -f
+ -rm -fr debian/patched debian/files* debian/substvars
+ -rm -f *-stamp
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
-# dh_install
-# dh_installmenu
-# dh_installdebconf
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_python
-# dh_installinit
-# dh_installcron
-# dh_installinfo
- dh_installman doc/deputy.1
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
-# dh_perl
-# dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
+define checkdir
+ test -f cil/config.h.in -a -f debian/rules
+endef
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+
+.PHONY: build clean binary-indep binary-arch binary install checkroot