#!/usr/bin/make -f # # Based on the work by Marcus Brinkmann # Rewritten by Guillem Jover # FULL_VERSION := $(shell dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g') NOEPOCH_VERSION := $(shell echo $(FULL_VERSION) | sed -e 's/.*://g') TAR_VERSION := $(shell echo $(NOEPOCH_VERSION) | sed -e 's/-.*//g') VERSION := $(shell echo $(TAR_VERSION) | sed -e 's/\.dfsg.*//g') MAJOR := $(shell echo $(VERSION) | sed -e 's/\..*//g') DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) MACHINE := 486 pkg := gnumach-image-$(VERSION)-$(MACHINE) pkg_xen := gnumach-image-$(VERSION)-xen-$(MACHINE) pkg_udeb := kernel-image-$(VERSION)-$(MACHINE)-di pkg_xen_udeb := kernel-image-$(VERSION)-xen-$(MACHINE)-di pkg_dbg := gnumach-image-$(VERSION)-$(MACHINE)-dbg pkg_xen_dbg := gnumach-image-$(VERSION)-xen-$(MACHINE)-dbg pkg_common := gnumach-common pkg_dev := gnumach-dev D := $(CURDIR)/debian/tmp D_UDEB := $(D)-udeb D_XEN := $(D)-xen D_XEN_UDEB := $(D)-xen-udeb D_DBG := $(D)-dbg D_XEN_DBG := $(D)-xen-dbg DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) CFLAGS = -Wall -g -pipe -fno-strict-aliasing ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif drivers := common_configure := \ CFLAGS="$(CFLAGS)" \ --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \ --prefix=/usr \ --exec-prefix=/ configure: configure.ac autoreconf -fi build/config.status: configure dh_testdir -mkdir build cd build && ../configure $(drivers) \ $(common_configure) build-xen/config.status: configure dh_testdir -mkdir build-xen cd build-xen && ../configure \ $(common_configure) \ --enable-platform=xen build-dbg/config.status: configure dh_testdir -mkdir build-dbg cd build-dbg && ../configure --enable-kdb $(drivers) \ $(common_configure) \ build-xen-dbg/config.status: configure dh_testdir -mkdir build-xen-dbg cd build-xen-dbg && ../configure --enable-kdb \ $(common_configure) \ --enable-platform=xen build: build-gnumach-std build-gnumach-xen build-gnumach-dbg build-gnumach-xen-dbg build-gnumach-std: build/config.status dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build else $(MAKE) -C build check endif build-gnumach-xen: build-xen/config.status dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build-xen else $(MAKE) -C build-xen check endif build-gnumach-dbg: build-dbg/config.status dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build-dbg else $(MAKE) -C build-dbg check endif build-gnumach-xen-dbg: build-xen-dbg/config.status dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build-xen-dbg else $(MAKE) -C build-xen-dbg check endif clean: dh_testdir rm -f machine rm -rf build build-xen build-dbg build-xen-dbg $(D_UDEB) $(D_XEN_UDEB) $(D_XEN) $(D_DBG) $(D_XEN_DBG) # Clean up autogenerated cruft rm -rf autom4te.cache build-aux rm -f aclocal.m4 config.h.in configure INSTALL Makefile.in find -name '*~' -o -name '*.rej' -o -name '*.orig' | xargs rm -f rm -f debian/gnumach-image-*.preinst rm -f debian/gnumach-image-*.prerm rm -f debian/gnumach-image-*.postinst rm -f debian/gnumach-image-*.postrm dh_clean install: build dh_testdir dh_testroot dh_prep -a -rm -rf $(D_DBG) dh_installdirs -a $(MAKE) -C build install \ DESTDIR=$(D) $(MAKE) -C build-xen install \ DESTDIR=$(D_XEN) $(MAKE) -C build-dbg install-exec \ DESTDIR=$(D_DBG) \ $(MAKE) -C build-xen-dbg install-exec \ DESTDIR=$(D_XEN_DBG) \ mkdir -p $(D_UDEB)/boot cp $(D)/boot/gnumach $(D_UDEB)/boot/ mv $(D)/boot/gnumach $(D)/boot/gnumach-$(VERSION)-$(MACHINE) mkdir -p $(D_XEN_UDEB)/boot cp $(D_XEN)/boot/gnumach $(D_XEN_UDEB)/boot/ mv $(D_XEN)/boot/gnumach $(D_XEN)/boot/gnumach-$(VERSION)-xen-$(MACHINE) mv $(D_DBG)/boot/gnumach $(D_DBG)/boot/gnumach-$(VERSION)-$(MACHINE)-dbg mv $(D_XEN_DBG)/boot/gnumach $(D_XEN_DBG)/boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg ifeq ($(DEB_HOST_ARCH_OS),hurd) for script in preinst prerm postinst postrm ; do \ for prefix in "" -xen ; do \ for suffix in "" -dbg ; do \ sed -e "s/@VERSION@/$(VERSION)/g" \ -e "s/@RELEASE@/$(VERSION)$$prefix-$(MACHINE)$$suffix/g" \ debian/gnumach-image.$$script.in \ > debian/gnumach-image-$(VERSION)$$prefix-$(MACHINE)$$suffix.$$script ; \ done ; \ done ; \ done endif binary: binary-indep binary-arch binary-indep: install dh_testdir dh_testroot dh_install -i --sourcedir=$(D) dh_installdocs -i dh_installchangelogs -i -k ChangeLog # dh_installinfo -a dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary-arch: install dh_testdir dh_testroot dh_install -a -N$(pkg_udeb) -N$(pkg_xen) -N$(pkg_xen_udeb) -N$(pkg_dbg) -N$(pkg_xen_dbg) --sourcedir=$(D) dh_install -p$(pkg_udeb) --sourcedir=$(D_UDEB) dh_install -p$(pkg_xen) --sourcedir=$(D_XEN) dh_install -p$(pkg_xen_udeb) --sourcedir=$(D_XEN_UDEB) dh_install -p$(pkg_dbg) --sourcedir=$(D_DBG) dh_install -p$(pkg_xen_dbg) --sourcedir=$(D_XEN_DBG) dh_installdocs -a dh_installchangelogs -a -k ChangeLog dh_link -a dh_strip -a -N$(pkg_dbg) -N$(pkg_xen_dbg) dh_compress -a -N$(pkg) -N$(pkg_udeb) -N$(pkg_xen) -N$(pkg_xen_udeb) -N$(pkg_dbg) -N$(pkg_xen_dbg) dh_compress -p$(pkg) boot/gnumach-$(VERSION)-$(MACHINE) dh_compress -p$(pkg_udeb) boot/gnumach dh_compress -p$(pkg_xen) boot/gnumach-$(VERSION)-xen-$(MACHINE) dh_compress -p$(pkg_xen_udeb) boot/gnumach dh_compress -p$(pkg_dbg) boot/gnumach-$(VERSION)-$(MACHINE)-dbg dh_compress -p$(pkg_xen_dbg) boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg dh_fixperms -a dh_installdeb -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a .PHONY: build build-gnumach-std build-gnumach-xen build-gnumach-dbg build-gnumach-xen-dbg clean .PHONY: install binary binary-indep binary-arch