| 1 |
#!/usr/bin/make -f
|
| 2 |
#
|
| 3 |
# debian/rules for kernel-image-*-sparc
|
| 4 |
#
|
| 5 |
# GNU copyright 1997 to 1999 by Joey Hess.
|
| 6 |
# Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
| 7 |
# Copyright (c) 2000 Ben Collins <bcollins@debian.org>
|
| 8 |
# Copyright (c) 2004 Joshua Kwan <joshk@triplehelix.org>
|
| 9 |
|
| 10 |
-include /etc/kernel-pkg.conf
|
| 11 |
|
| 12 |
KPKG_MAINTAINER := "Debian Kernel Team"
|
| 13 |
KPKG_EMAIL := "debian-kernel@lists.debian.org"
|
| 14 |
VERSION := 2.6.7
|
| 15 |
kdir := kernel-source-$(VERSION)
|
| 16 |
debver := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}' | sed 's/^[0-9]\+://')
|
| 17 |
SHELL := /bin/bash -e
|
| 18 |
do_clean := no
|
| 19 |
SMP_CPU_COUNT := 32
|
| 20 |
KPKG_ARCH := sparc
|
| 21 |
|
| 22 |
ifneq (root,$(shell whoami))
|
| 23 |
ROOT := --rootcmd fakeroot
|
| 24 |
endif
|
| 25 |
|
| 26 |
ifeq (,$(DEB_HOST_ARCH))
|
| 27 |
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
|
| 28 |
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
| 29 |
endif
|
| 30 |
|
| 31 |
ifneq ($(DEB_HOST_ARCH),$(KPKG_ARCH))
|
| 32 |
ifneq (,$(filter-out debian/control clean stamps/build-dummy-%-stamp stamps/patch-stamp stamps/unpack-stamp patch unpatch,$(MAKECMDGOALS)))
|
| 33 |
$(error Use dpkg-buildpackage -asparc! ($(DEB_HOST_ARCH) != $(KPKG_ARCH)))
|
| 34 |
endif
|
| 35 |
endif
|
| 36 |
|
| 37 |
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
|
| 38 |
CROSS_COMPILE := sparc-linux
|
| 39 |
endif
|
| 40 |
|
| 41 |
export KPKG_MAINTAINER KPKG_EMAIL KPKG_ARCH CROSS_COMPILE do_clean HEADER_CLEAN_HOOK
|
| 42 |
|
| 43 |
all_subarches := $(foreach subarch,$(shell ls config),stamps/build-$(subarch)-stamp stamps/build-$(subarch)-smp-stamp)
|
| 44 |
all_dummies := $(foreach subarch,sparc64,stamps/build-dummy-2.4-$(subarch)-stamp stamps/build-dummy-2.4-$(subarch)-smp-stamp)
|
| 45 |
|
| 46 |
stamps/unpack-stamp:
|
| 47 |
tar --bzip2 -xf /usr/src/$(kdir).tar.bz2
|
| 48 |
touch $@
|
| 49 |
|
| 50 |
patch: stamps/patch-stamp
|
| 51 |
stamps/patch-stamp: stamps/unpack-stamp
|
| 52 |
dpatch -d $(kdir) apply-all
|
| 53 |
dpatch cat-all > $@
|
| 54 |
|
| 55 |
unpatch:
|
| 56 |
ifneq (,$(wildcard stamps/patch-stamp))
|
| 57 |
dpatch -d $(kdir) deapply-all
|
| 58 |
endif
|
| 59 |
rm -f stamps/patch-stamp
|
| 60 |
|
| 61 |
debian/control: debian/control.in debian/rules
|
| 62 |
sed -e 's/=V/$(VERSION)/g' debian/control.in > debian/control
|
| 63 |
|
| 64 |
stamps/build-dummy-%-stamp:
|
| 65 |
dh_testdir
|
| 66 |
dh_testroot
|
| 67 |
|
| 68 |
dh_clean -k -pkernel-image-$*
|
| 69 |
dh_installdeb -pkernel-image-$*
|
| 70 |
dh_installdocs -pkernel-image-$*
|
| 71 |
dh_installchangelogs -pkernel-image-$*
|
| 72 |
dh_compress -pkernel-image-$*
|
| 73 |
dh_gencontrol -pkernel-image-$*
|
| 74 |
dh_builddeb -pkernel-image-$*
|
| 75 |
|
| 76 |
stamps/build-%-stamp: config/% stamps/patch-stamp
|
| 77 |
rm -f $@
|
| 78 |
|
| 79 |
mkdir -p $(kdir)/debian
|
| 80 |
cp debian/changelog debian/control $(kdir)/debian
|
| 81 |
echo official > $(kdir)/debian/official
|
| 82 |
cp config/$* $(kdir)/.config
|
| 83 |
$(SHELL) -c "( \
|
| 84 |
cd $(kdir); \
|
| 85 |
make-kpkg $(ROOT) --subarch $* clean; \
|
| 86 |
make-kpkg --subarch $* --append-to-version "-$*" build; \
|
| 87 |
$(CROSS_COMPILE)-strip -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux; \
|
| 88 |
make-kpkg $(ROOT) --subarch $* --append-to-version "-$*" kernel-image; \
|
| 89 |
cat debian/files >> ../debian/files; \
|
| 90 |
);"
|
| 91 |
mv -f kernel-image-$(VERSION)-$*_$(debver)_sparc.deb ../
|
| 92 |
touch $@
|
| 93 |
|
| 94 |
config/%-smp: config/%
|
| 95 |
sed -e 's/# CONFIG_SMP is not set/CONFIG_SMP=y/' $< > $@
|
| 96 |
echo "CONFIG_NR_CPUS=$(SMP_CPU_COUNT)" >> $@
|
| 97 |
|
| 98 |
clean: debian/control
|
| 99 |
rm -rf $(kdir) debian/patched
|
| 100 |
rm -f *.deb debian/files stamps/* config/*-smp
|
| 101 |
dh_clean
|
| 102 |
|
| 103 |
install: stamps/install-stamp
|
| 104 |
stamps/install-stamp: build stamps/patch-stamp debian/control
|
| 105 |
touch $@
|
| 106 |
|
| 107 |
binary-indep: build install
|
| 108 |
# Ye olde no-op.
|
| 109 |
|
| 110 |
# Build architecture-dependent files here.
|
| 111 |
binary-arch: $(all_dummies) build install
|
| 112 |
|
| 113 |
build: debian/control stamps/build-stamp
|
| 114 |
stamps/build-stamp: stamps/patch-stamp $(all_subarches)
|
| 115 |
touch $@
|
| 116 |
|
| 117 |
binary: binary-indep binary-arch
|
| 118 |
|
| 119 |
.PHONY: build clean binary-indep binary-arch binary install
|