#!/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 ?= $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null) # The current code use type-punning and signed overflow ifneq (,$(filter $(DEB_HOST_ARCH), sparc mips mipsel)) CFLAGS_OPT = -O0 else CFLAGS_OPT = -O2 -fno-strict-aliasing -fno-strict-overflow 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) # Avoid embedding build paths for reproducible builds CFLAGS += -ffile-prefix-map=$(CURDIR)=. configure: $(MAKE) X-Configure name=$(system) sed "s%CFLAGS = .*%CFLAGS = $(CFLAGS)%" Makedefs > Makedefs.tmp echo "ASFLAGS = -Wa,--noexecstack" >> Makedefs.tmp mv Makedefs.tmp Makedefs touch $@ build-icont: configure $(MAKE) Icont touch $@ build-ipl: configure $(MAKE) Ilib touch $@ clean: rm -f configure build-icont build-ipl rm -rf debian/iconx debian/icont debian/icon-ipl debian/files debian/*~ rm -f bin/* debian/substvars $(MAKE) Pure binary-icont: build-icont rm -rf debian/icont # Create the directory hierarchy. install -d debian/icont/usr/bin install -d debian/icont/DEBIAN install -d debian/icont/usr/share/man/man1 install -d debian/icont/usr/share/doc/icont # Copy the executables and documentation... install -s -m 755 bin/icont debian/icont/usr/bin ln -s icont debian/icont/usr/bin/icon install -m 644 man/man1/icon.1 debian/icont/usr/share/man/man1/icon.1 install -m 644 man/man1/icont.1 debian/icont/usr/share/man/man1/icont.1 sed -e 's/icon-dir/icont/g' debian/copyright \ > debian/icont/usr/share/doc/icont/copyright install -m 644 debian/changelog \ debian/icont/usr/share/doc/icont/changelog.Debian # Patch icont... # bin/patchstr debian/icont/usr/bin/icont /usr/bin/iconx # Wrap icont to provide default for IPATH and LPATH # mv debian/icont/usr/bin/icont debian/icont/usr/bin/icont.real # install -o root -g root -m 755 debian/icont-wrapper debian/icont/usr/bin/icont # Compress documentation... gzip -9n debian/icont/usr/share/doc/icont/changelog.Debian gzip -9rn debian/icont/usr/share/man # cd debian/icont/usr/share/man/man1 && ln -sf icont.1.gz icont.real.1.gz # Fix permissions... chmod -R u=rwX,go=rX debian/icont # Make the debian control area. dpkg-shlibdeps -pshlibs-icont debian/icont/usr/bin/* dpkg-gencontrol -picont -Pdebian/icont # And finally, build the Debian package! dpkg-deb --root-owner-group --build debian/icont .. binary-iconx: build-icont rm -rf debian/iconx # Create the directory hierarchy. install -d debian/iconx/usr/bin install -d debian/iconx/DEBIAN install -d debian/iconx/usr/share/man/man1 install -d debian/iconx/usr/share/doc/iconx # Copy the executables and documentation... install -s -m 755 bin/iconx debian/iconx/usr/bin install -m 644 man/man1/icon.1 debian/iconx/usr/share/man/man1/iconx.1 sed -e 's/icon-dir/iconx/g' debian/copyright \ > debian/iconx/usr/share/doc/iconx/copyright install -m 644 debian/changelog \ debian/iconx/usr/share/doc/iconx/changelog.Debian # Compress documentation... gzip -9n debian/iconx/usr/share/doc/iconx/changelog.Debian gzip -9rn debian/iconx/usr/share/man # Fix permissions... chmod -R u=rwX,go=rX debian/iconx # Make the debian control area. dpkg-shlibdeps -pshlibs-iconx debian/iconx/usr/bin/* dpkg-gencontrol -piconx -Pdebian/iconx # And finally, build the Debian package! dpkg-deb --root-owner-group --build debian/iconx .. binary-ipl: build-ipl rm -rf debian/icon-ipl # Create the directory hierarchy. install -d debian/icon-ipl/DEBIAN install -d debian/icon-ipl/usr/share/doc/icon-ipl install -d debian/icon-ipl/usr/lib/icon-ipl # Copy Icon program library... cp -r lib/* ipl/procs/*.icn ipl/gprocs/*.icn debian/icon-ipl/usr/lib/icon-ipl # Copy copyright information. sed -e 's/icon-dir/icon-ipl/g' debian/copyright \ > debian/icon-ipl/usr/share/doc/icon-ipl/copyright install -m 644 debian/changelog \ debian/icon-ipl/usr/share/doc/icon-ipl/changelog.Debian # Compress documentation... gzip -9n debian/icon-ipl/usr/share/doc/icon-ipl/changelog.Debian find debian/icon-ipl/usr/share/doc/icon-ipl -type f -size +6k -print | \ xargs --no-run-if-empty gzip -9n # Fix permissions... chmod -R u=rwX,go=rX debian/icon-ipl # Make the debian control area. dpkg-gencontrol -picon-ipl -Pdebian/icon-ipl # And finally, build the Debian package! dpkg-deb --root-owner-group --build debian/icon-ipl .. test: build-icont build-ipl @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 benchmark: build-icont $(MAKE) Benchmark-icont build-arch: build build-indep: build build-iconx: build-icont build: build-icont build-ipl test binary-arch: binary-icont binary-iconx binary-indep: binary-ipl binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean build build-arch build-indep test benchmark