summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules250
1 files changed, 250 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ba6dc79
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,250 @@
+#!/usr/bin/make -f
+#
+# Do we make rt.a into an ELF library?
+# Do we make iconx link with xpm.so?
+
+DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null)
+
+# Take account of old dpkg-architecture output.
+
+ifeq ($(DEB_HOST_ARCH_CPU),)
+ DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
+ ifeq ($(DEB_HOST_ARCH_CPU),x86_64)
+ DEB_HOST_ARCH_CPU := amd64
+ endif
+endif
+ifeq ($(DEB_HOST_ARCH_OS),)
+ DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM))
+ ifeq ($(DEB_HOST_ARCH_OS),gnu)
+ DEB_HOST_ARCH_OS := hurd
+ endif
+endif
+
+CFLAGS_OPT = -O2
+
+ifneq (, $(filter $(DEB_HOST_ARCH_CPU), alpha hppa ia64 mips mipsel \
+ powerpc s390 sparc amd64 i386 \
+ arm armel armeb ppc64 ))
+ CFLAGS_OPT = -O0
+endif
+
+ifneq (, $(filter $(DEB_HOST_ARCH_OS), linux kfreebsd knetbsd))
+ system = linux
+else
+ ifeq ($(DEB_HOST_ARCH_OS),hurd)
+ system = gnu
+ else
+ system = $(DEB_HOST_ARCH_OS)
+ endif
+endif
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS_OPT = -O0
+endif
+
+CFLAGS = -Wall -g $(CFLAGS_OPT)
+
+configure:
+ $(checkdir)
+ $(MAKE) X-Configure name=$(system)
+ sed "s/CFLAGS = .*/CFLAGS = $(CFLAGS)/" Makedefs > Makedefs.tmp
+ mv Makedefs.tmp Makedefs
+ touch configure
+
+build-icont: configure
+ $(checkdir)
+ $(MAKE) Icont
+ touch build-icont
+
+build-iconc: configure
+ $(checkdir)
+ $(MAKE) Iconc
+ (cd src/common && make patchstr && cp patchstr ../../bin)
+ touch build-iconc
+
+build-ipl: configure
+ $(checkdir)
+ $(MAKE) Ilib
+
+clean:
+ $(checkdir)
+ -rm -f configure build-icont build-iconc build-ipl
+ -rm -rf debian/tmp-iconx debian/tmp-icont debian/tmp-iconc debian/tmp-ipl debian/files debian/*~
+ -rm -f bin/* debian/substvars
+ $(MAKE) Pure
+
+binary-icont: checkroot build-icont test-icont
+ $(checkdir)
+ -rm -rf debian/tmp-icont
+# Create the directory hierarchy.
+ install -d debian/tmp-icont/usr/bin
+ install -d debian/tmp-icont/DEBIAN
+ install -d debian/tmp-icont/usr/share/man/man1
+ install -d debian/tmp-icont/usr/share/doc/icont
+# Copy the executables and documentation...
+ install -s -m 755 bin/icont debian/tmp-icont/usr/bin
+ install -m 644 debian/icon.1 debian/tmp-icont/usr/share/man/man1/icont.1
+ sed -e 's/icon-dir/icont/g' debian/copyright \
+ >debian/tmp-icont/usr/share/doc/icont/copyright
+ install -m 644 debian/changelog \
+ debian/tmp-icont/usr/share/doc/icont/changelog.Debian
+# Patch icont...
+# bin/patchstr debian/tmp-icont/usr/bin/icont /usr/bin/iconx
+# Wrap icont to provide default for IPATH and LPATH
+# mv debian/tmp-icont/usr/bin/icont debian/tmp-icont/usr/bin/icont.real
+# install -o root -g root -m 755 debian/icont-wrapper debian/tmp-icont/usr/bin/icont
+# Compress documentation...
+ test -f debian/tmp-icont/usr/share/doc/icont/changelog.Debian.gz || \
+ gzip -9 debian/tmp-icont/usr/share/doc/icont/changelog.Debian
+ -gzip -9rq debian/tmp-icont/usr/share/man
+# (cd debian/tmp-icont/usr/share/man/man1 && ln -sf icont.1.gz icont.real.1.gz)
+# Fix permissions...
+ chmod -R u=rwX,go=rX debian/tmp-icont
+ chown -R root.root debian/tmp-icont
+# Make the debian control area.
+ dpkg-shlibdeps -pshlibs-icont debian/tmp-icont/usr/bin/*
+ dpkg-gencontrol -isp -picont -Pdebian/tmp-icont
+# And finally, build the Debian package!
+ dpkg --build debian/tmp-icont ..
+
+binary-iconx: checkroot build-icont
+ $(checkdir)
+ -rm -rf debian/tmp-iconx
+# Create the directory hierarchy.
+ install -d debian/tmp-iconx/usr/bin
+ install -d debian/tmp-iconx/DEBIAN
+ install -d debian/tmp-iconx/usr/share/man/man1
+ install -d debian/tmp-iconx/usr/share/doc/iconx
+# Copy the executables and documentation...
+ install -s -m 755 bin/iconx debian/tmp-iconx/usr/bin
+ install -m 644 debian/icon.1 debian/tmp-iconx/usr/share/man/man1/iconx.1
+ sed -e 's/icon-dir/iconx/g' debian/copyright \
+ >debian/tmp-iconx/usr/share/doc/iconx/copyright
+ install -m 644 debian/changelog \
+ debian/tmp-iconx/usr/share/doc/iconx/changelog.Debian
+# Compress documentation...
+ test -f debian/tmp-iconx/usr/share/doc/iconx/changelog.Debian.gz || \
+ gzip -9 debian/tmp-iconx/usr/share/doc/iconx/changelog.Debian
+ -gzip -9rq debian/tmp-iconx/usr/share/man
+# Fix permissions...
+ chmod -R u=rwX,go=rX debian/tmp-iconx
+ chown -R root.root debian/tmp-iconx
+# Make the debian control area.
+ dpkg-shlibdeps -pshlibs-iconx debian/tmp-iconx/usr/bin/*
+ dpkg-gencontrol -isp -piconx -Pdebian/tmp-iconx
+# And finally, build the Debian package!
+ dpkg --build debian/tmp-iconx ..
+
+binary-iconc: checkroot build-iconc
+ $(checkdir)
+ -rm -rf debian/tmp-iconc
+# Create the directory hierarchy.
+ install -d debian/tmp-iconc/usr/bin
+ install -d debian/tmp-iconc/DEBIAN
+ install -d debian/tmp-iconc/usr/share/man/man1
+ install -d debian/tmp-iconc/usr/share/doc/iconc
+ install -d debian/tmp-iconc/usr/lib/iconc
+# Copy the executables and library files...
+ install -s -m 755 bin/iconc debian/tmp-iconc/usr/bin
+ install -m 644 bin/dlrgint.o bin/rt.* bin/libIgpx.a debian/tmp-iconc/usr/lib/iconc
+# Patch iconc...
+ bin/patchstr debian/tmp-iconc/usr/bin/iconc /usr/lib/iconc/
+# Copy documentation...
+ install -m 644 debian/icon.1 debian/tmp-iconc/usr/share/man/man1/iconc.1
+ sed -e 's/icon-dir/iconc/g' debian/copyright \
+ >debian/tmp-iconc/usr/share/doc/iconc/copyright
+ install -m 644 debian/changelog \
+ debian/tmp-iconc/usr/share/doc/iconc/changelog.Debian
+# Compress documentation...
+ test -f debian/tmp-iconc/usr/share/doc/iconc/changelog.Debian.gz || \
+ gzip -9 debian/tmp-iconc/usr/share/doc/iconc/changelog.Debian
+ -gzip -9rq debian/tmp-iconc/usr/share/man
+# Fix permissions...
+ chmod -R u=rwX,go=rX debian/tmp-iconc
+ chown -R root.root debian/tmp-iconc
+# Make the debian control area.
+ dpkg-shlibdeps -pshlibs-iconc debian/tmp-iconc/usr/bin/*
+ dpkg-gencontrol -isp -piconc -Pdebian/tmp-iconc
+# And finally, build the Debian package!
+ dpkg --build debian/tmp-iconc ..
+
+binary-ipl: checkroot build-ipl
+ $(checkdir)
+ -rm -rf debian/tmp-ipl
+# Create the directory hierarchy.
+ install -d debian/tmp-ipl/DEBIAN
+ install -d debian/tmp-ipl/usr/share/doc/icon-ipl
+ install -d debian/tmp-ipl/usr/lib/icon-ipl
+# Copy Icon program library...
+ cp -r lib/* ipl/procs/*.icn ipl/gprocs/*.icn debian/tmp-ipl/usr/lib/icon-ipl
+# Copy copyright information.
+ sed -e 's/icon-dir/icon-ipl/g' debian/copyright \
+ >debian/tmp-ipl/usr/share/doc/icon-ipl/copyright
+ install -m 644 debian/changelog \
+ debian/tmp-ipl/usr/share/doc/icon-ipl/changelog.Debian
+# Compress documentation...
+ find debian/tmp-ipl/usr/share/doc/icon-ipl -type f -size +6k -print | \
+ xargs --no-run-if-empty gzip -9
+ test -f debian/tmp-ipl/usr/share/doc/icon-ipl/changelog.Debian.gz || \
+ gzip -9 debian/tmp-ipl/usr/share/doc/icon-ipl/changelog.Debian
+# Fix permissions...
+ chmod -R u=rwX,go=rX debian/tmp-ipl
+ chown -R root.root debian/tmp-ipl
+# Make the debian control area.
+ dpkg-gencontrol -isp -picon-ipl -Pdebian/tmp-ipl
+# And finally, build the Debian package!
+ dpkg --build debian/tmp-ipl ..
+
+test-icont: build-icont
+ $(checkdir)
+ @echo Tests for the Icon interpreter.
+ @echo First some simple tests to be sure Icon works.
+ $(MAKE) Samples-icont
+ @echo More exhaustive tests of various features of Icon and larger programs.
+ @echo 1. Basic tests. Should show only insignificant differences.
+ $(MAKE) Test-icont
+
+test-iconc: build-iconc
+ $(checkdir)
+ @echo Tests for the Icon compiler.
+ @echo First some simple tests to be sure Icon works.
+ $(MAKE) Samples-iconc
+ @echo More exhaustive tests of various features of Icon and larger programs.
+ @echo 1. Basic tests. Should show only insignificant differences.
+ $(MAKE) Test-iconc Test-opt Test-noopt
+
+benchmark-icont: build-icont
+ $(checkdir)
+ $(MAKE) Benchmark-icont
+
+benchmark-iconc: build-iconc
+ $(checkdir)
+ $(MAKE) Benchmark-icont
+
+build-iconx: build-icont
+build: build-icont build-iconc build-ipl
+
+binary-arch: binary-icont binary-iconx binary-iconc
+
+binary-indep: binary-ipl
+ $(checkroot)
+
+binary: binary-indep binary-arch
+
+test: test-icont test-iconc
+
+benchmark: benchmark-icont behchmark-iconc
+
+define checkdir
+ test -f src/icont/tmem.c -a -f debian/rules
+endef
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+checkroot:
+ $(checkdir)
+ test "`whoami`" = root
+
+.PHONY: binary binary-arch binary-indep clean checkroot