#!/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') UPSTREAM_VERSION := $(shell echo $(TAR_VERSION) | sed -e 's/\.dfsg.*//g') NOGIT_VERSION := $(shell echo $(UPSTREAM_VERSION) | sed -e 's/+git[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]//g') MAJOR := $(shell echo $(VERSION) | sed -e 's/\..*//g') include /usr/share/dpkg/architecture.mk ifeq (,$(filter custom,$(DEB_BUILD_OPTIONS))) CUSTOM := VERSION := $(NOGIT_VERSION) else CUSTOM := .custom.$(shell date +'%Y%m%d') VERSION := $(NOEPOCH_VERSION)$(CUSTOM) endif 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 CFLAGS = -Wall -g -pipe -fno-strict-aliasing -no-pie -fno-PIE -fno-pie LDFLAGS = -no-pie ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) DEB_PARALLEL_JOBS ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) endif ifneq (,$(DEB_PARALLEL_JOBS)) MAKEFLAGS += -j$(DEB_PARALLEL_JOBS) endif drivers := common_configure := \ --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \ --prefix=/usr \ --exec-prefix=/ \ --disable-net-group \ --disable-pcmcia-group \ --disable-wireless-group debian/control: debian/control.stamp debian/control.stamp: debian/control.in ifneq (,$(filter custom,$(DEB_BUILD_OPTIONS))) @echo Building a custom kernel: "$(VERSION)" else @echo Building a stock kernel: "$(VERSION)" endif sed -e 's/@version@/$(VERSION)/g' < $< > debian/control touch $@ configure: configure.ac autoreconf -fi build/config.status: configure dh_testdir -mkdir build cd build && PACKAGE_VERSION_SUFFIX=$(CUSTOM)-486 ../configure $(drivers) \ CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ $(common_configure) build-xen/config.status: configure dh_testdir -mkdir build-xen cd build-xen && PACKAGE_VERSION_SUFFIX=$(CUSTOM)-xen-486 ../configure \ CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ $(common_configure) \ --enable-platform=xen build-dbg/config.status: configure dh_testdir -mkdir build-dbg cd build-dbg && PACKAGE_VERSION_SUFFIX=$(CUSTOM)-486-dbg ../configure --enable-kdb $(drivers) \ CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ $(common_configure) \ build-xen-dbg/config.status: configure dh_testdir -mkdir build-xen-dbg cd build-xen-dbg && PACKAGE_VERSION_SUFFIX=$(CUSTOM)-xen-486-dbg ../configure --enable-kdb \ CFLAGS="$(CFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ $(common_configure) \ --enable-platform=xen ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),) build-arch: build/stamp build-xen/stamp build-dbg/stamp build-xen-dbg/stamp else build-arch: build/config.status endif build-indep: build-arch build: build-arch build-indep doc/mach.info: build/config.status dh_testdir $(MAKE) -C build ../doc/mach.info build/stamp: build/config.status doc/mach.info dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build else $(MAKE) -C build check endif touch $@ build-xen/stamp: build-xen/config.status doc/mach.info dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build-xen else $(MAKE) -C build-xen check endif touch $@ build-dbg/stamp: build-dbg/config.status doc/mach.info dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build-dbg else $(MAKE) -C build-dbg check endif touch $@ build-xen-dbg/stamp: build-xen-dbg/config.status doc/mach.info dh_testdir ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) $(MAKE) -C build-xen-dbg else $(MAKE) -C build-xen-dbg check endif touch $@ clean: dh_testdir rm -f debian/control.stamp 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 rm -f doc/mach.info* doc/stamp-vti doc/version.texi 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 ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),) $(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 else $(MAKE) -C build install-data \ DESTDIR=$(D) endif binary: binary-indep binary-arch binary-indep: install debian/control.stamp dh_testdir dh_testroot dh_install -i --sourcedir=$(D) dh_installdocs -i dh_installchangelogs -i -k ChangeLog dh_installinfo -i dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary-arch: install debian/control.stamp 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) ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),) dh_install -p$(pkg) --sourcedir=$(D) boot dh_install -p$(pkg_xen) --sourcedir=$(D_XEN) boot ifeq ($(DEB_HOST_ARCH_OS),hurd) dh_install -p$(pkg_udeb) --sourcedir=$(D_UDEB) boot dh_install -p$(pkg_xen_udeb) --sourcedir=$(D_XEN_UDEB) boot endif dh_install -p$(pkg_dbg) --sourcedir=$(D_DBG) boot dh_install -p$(pkg_xen_dbg) --sourcedir=$(D_XEN_DBG) boot endif dh_installdocs -p$(pkg) README NEWS i386/README-Drivers dh_installdocs -p$(pkg_xen) README NEWS dh_installdocs -p$(pkg_dbg) README NEWS i386/README-Drivers dh_installdocs -p$(pkg_xen_dbg) README NEWS 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) ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),) dh_compress -p$(pkg) boot/gnumach-$(VERSION)-$(MACHINE) dh_compress -p$(pkg_xen) boot/gnumach-$(VERSION)-xen-$(MACHINE) ifeq ($(DEB_HOST_ARCH_OS),hurd) dh_compress -p$(pkg_udeb) boot/gnumach dh_compress -p$(pkg_xen_udeb) boot/gnumach endif dh_compress -p$(pkg_dbg) boot/gnumach-$(VERSION)-$(MACHINE)-dbg dh_compress -p$(pkg_xen_dbg) boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg endif dh_fixperms -a dh_installdeb -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a .PHONY: build build-arch build-indep clean .PHONY: install binary binary-indep binary-arch