--- /dev/null
+#!/usr/bin/make -f
+# 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.
+# 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 = nesc
+
+CFLAGS = -g -O2
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS = -g -O0
+endif
+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
+
+
+# At the current time (20080824) nesc will not build from a separate build
+# directory. At least two problems exist. More may be present beyone these
+# two:
+# 1 - The include path when desiring to include libcpp/config.h includes
+# the @srcdir@/libcpp directory where config.in exists, but not the
+# @blddir@ (?) where config.h is actually generated.
+# 2 - The java Makefiles assume that .java is in the same directory where
+# the .class is to be compiled and placed.
+#
+# 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
+ : # Replace this line:
+ : # mkdir builddir
+ : # With the next 3 lines:
+ rm -f $(tempdir)
+ cp -a . $(tempdir)
+ mv -f $(tempdir) builddir
+ cd builddir && env CC="$(CC)" ./configure --prefix=/usr
+ touch $@
+
+
+build: build-stamp
+build-stamp: configure-stamp
+ $(checkdir)
+ $(MAKE) -C builddir $(NJOBS) CFLAGS="$(CFLAGS)"
+ 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
+ifeq ($(with_strip),yes)
+ find debian/tmp -type f | xargs file | grep "ELF.*executable" | \
+ cut -f 1 -d : | xargs $(STRIP)
+endif
+ touch $@
+
+
+binary-indep: checkroot build install
+ : # Nothing to do
+
+
+binary-arch: checkroot build install
+ $(checkdir)
+ : # install maintainer scripts
+ $(install_dir) debian/tmp/DEBIAN
+ : # $(install_script) debian/nesc.postinst debian/tmp/DEBIAN/postinst
+ : # $(install_script) debian/nesc.postrm debian/tmp/DEBIAN/postrm
+ : # $(install_file) debian/nesc.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) COPYING COPYRIGHT INSTALL INTEL-LICENSE README \
+ debian/README.Debian debian/tmp/usr/share/doc/$(package)/
+ : # Remove unnecessary files installed
+ : # 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 ..
+
+
+binary: binary-indep binary-arch
+
+
+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
+
+
+define checkdir
+ test -f src/nesc-c.c -a -f debian/rules
+endef
+
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+
+.PHONY: binary clean checkroot