[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Extraneous endif on make-kpkg



Here's a patch for the kernel-package 6.30
/usr/share/kernel-package/rules file:

<cut here>
--- rules.orig	Thu Jan 27 07:14:24 2000
+++ rules	Thu Feb  3 22:01:34 2000
@@ -427,7 +427,6 @@
 debian := 1.00
 endif
 endif
-endif
 
 
 
@@ -633,7 +632,7 @@
 	test -f .config || (test -f .config.save && \
 		            cp -pf .config.save .config) || \
 			true
-fi
+endif
 	test -f .config || cp -pf $(CONFIG_FILE) .config
 
 
<cut here>

I've attached the fixed file for your convenience.

HTH,
Remco


On Thu, Feb 03, 2000 at 14:53, Kent West wrote:

> Okay, thanks. Looks like I just need to be patient until the
> gurus fix the bug (wish I could contribute here, but like I
> said, I'm no programmer).


-- 
nuclear spy semtex Kosto Beatrix abuse terrorist MI5 alarm
genetic World Trade Center confession CAST GSM CIA Noriega CP86
#! /usr/bin/make -f
############################ -*- Mode: Makefile -*- ###########################
## debian.rules ---
## Author	    : Manoj Srivastava ( srivasta@pilgrim.umass.edu )
## Created On	    : Sat Apr 27 06:36:31 1996
## Created On Node  : melkor.pilgrim.umass.edu
## Last Modified By : Manoj Srivastava
## Last Modified On : Wed Jan 26 10:57:40 2000
## Last Machine Used: glaurung.green-gryphon.com
## Update Count	    : 420
## Status	    : Unknown, Use with caution!
## HISTORY	    :
## Description	    :
## $Id: rules,v 1.85 2000/01/27 06:13:30 srivasta Exp $
###############################################################################

#
# VERSION=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | \
#                          sed 's/^Version: *//')
#

# The version of kernel-package this belongs to
kpkg_version := 6.30

# The maintainer information.
maintainer = Herbert Xu
email= herbert@greathan.apana.org.au

pgp=$(maintainer)


#  Package specific stuff
# decide if image is meant to be in /boot rather than /
image_in_boot :=
# Can we use symlinks?
no_symlink :=
# If so, where is the real file (usually, vmlinuz-X.X.X is real, and
# vmlinuz is the link, this variable reverses it.
reverse_symlink :=

# The version numbers for kernel-image, kernel-headers and
# kernel-source are deduced from the Makefile (see below,
# and footnote 1 for details)

# Whether to look for and install kernel patches by default.
# Be very careful if you do this.
patch_the_kernel := NO

# do not create libc headers by default
make_libc_headers := NO

# run make clean after build
do_clean := YES


# The default architecture (all if architecture independent)
ifdef ARCH
  architecture:=$(ARCH)
  ifndef CROSS_COMPILE
    KERNEL_CROSS:=$(ARCH)-linux-
  else
    KERNEL_CROSS:=$(CROSS_COMPILE)-
  endif
else
  architecture:=$(shell CC=$(HOSTCC) dpkg --print-architecture)
endif

KERNEL_ARCH:=$(architecture)
DEBCONFIG = $(CONFDIR)/config
IMAGE_DESTDIR=/boot
INT_IMAGE_DESTDIR=debian/tmp-image$(IMAGE_DESTDIR)

######################################################################
###          Architecture specific stuff                           ###
######################################################################
# Each architecture has the following specified for it
# (a) The kernel image type (i.e. zImage or bzImage)
# (b) The dependency on a loader, if any
# (c) The name of the loader
# (d) The name of the documentation file for the loader
# (e) The build target
# (f) The location of the kernelimage source
# (g) The location of the kernelimage destination
# (h) The name of the arch specific configuration file
# Some architectures has sub architectures

### m68k
ifeq ($(strip $(architecture)),m68k)
# m68k doesn't use lilo (atari lilo is alpha software; amiga lilo is
# stable but unpackaged; mac lilo, who knows?).
# sub archs can be Amiga, Atari, Mac
GUESS_SUBARCH:=$(shell awk '/Model/ { print $$2}' /proc/hardware)

ifeq (,$(findstring $(SUBARCH),Amiga Atari Mac Macintosh))
SUBARCH:=$(GUESS_SUBARCH)
endif

NEED_DIRECT_GZIP_IMAGE=YES
kimage := zImage
loaderdep=
loader=lilo
loaderdoc=
target = $(kimage)
kimagesrc = vmlinux
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
ifeq ($(strip $(GUESS_SUBARCH)),Amiga)
        DEBCONFIG= $(CONFDIR)/config.amiga
else
ifeq ($(strip $(GUESS_SUBARCH)),Atari)
        DEBCONFIG= $(CONFDIR)/config.atari
else
ifeq ($(strip $(GUESS_SUBARCH)),Mac)
        DEBCONFIG= $(CONFDIR)/config.mac
endif
ifeq ($(strip $(GUESS_SUBARCH)),Macintosh)
        DEBCONFIG= $(CONFDIR)/config.mac
endif
endif
endif
endif

### ARM
ifeq ($(strip $(architecture)),arm)
GUESS_SUBARCH:='netwinder'

ifeq (,$(findstring $(SUBARCH),netwinder))
SUBARCH:=$(GUESS_SUBARCH)
endif

kimage := Image
loaderdep=
loader=nettrom
loaderdoc=
target = Image
NEED_DIRECT_GZIP_IMAGE=NO
kimagesrc = arch/$(KERNEL_ARCH)/boot/Image
kimagedest = $(INT_IMAGE_DESTDIR)/Image-$(version)
DEBCONFIG = $(CONFDIR)/config.arm
ifeq ($(strip $(GUESS_SUBARCH)),netwinder)
        DEBCONFIG= $(CONFDIR)/config.netwinder
endif
endif

### PowerPC
ifneq ($(strip $(filter ppc powerpc,$(architecture))),)
GUESS_SUBARCH:=$(shell awk '/machine/ { print $$3}' /proc/cpuinfo)

ifeq (,$(findstring $(SUBARCH),apus bbox chrp mbx pmac prep APUs BBOX CHRP MBX Power PReP ))
SUBARCH:=$(GUESS_SUBARCH)
endif

KERNEL_ARCH:=ppc
kimage := zImage
target = $(kimage)

ifneq (,$(findstring $(SUBARCH),APUs apus Amiga)))
SUBARCH:=apus
kimagesrc = arch/$(KERNEL_ARCH)/boot/$(kimage)
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.apus
endif

ifneq (,$(findstring $(SUBARCH),BBOX bbox))
SUBARCH:=bbox
kimagesrc = arch/$(KERNEL_ARCH)/boot/$(kimage))
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.bbox
endif

ifneq (,$(findstring $(SUBARCH),CHRP chrp))
SUBARCH:=chrp
loaderdep=quik
loader=quik
loaderdoc=QuikDefault
kimagesrc = arch/$(KERNEL_ARCH)/chrpboot/$(kimage)
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.chrp
endif

ifneq (,$(findstring $(SUBARCH),MBX mbx))
SUBARCH:=mbx
kimagesrc = arch/$(KERNEL_ARCH)/boot/$(kimage))
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.mbx
endif

ifneq (,$(findstring $(SUBARCH),Power pmac))
SUBARCH:=pmac
loaderdep=quik
loader=quik
loaderdoc=QuikDefault
kimagesrc=vmlinux
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinux-$(version)
HAVE_COFF_IMAGE = YES
coffsrc=arch/$(KERNEL_ARCH)/coffboot/$(kimage)
coffdest=$(INT_IMAGE_DESTDIR)/vmlinux.coff-$(version)
DEBCONFIG = $(CONFDIR)/config.pmac
endif

ifneq (,$(findstring $(SUBARCH),PReP prep))
SUBARCH:=prep
kimagesrc = arch/$(KERNEL_ARCH)/boot/$(kimage)
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.prep
endif

endif


##### Alpha
ifeq ($(strip $(architecture)),alpha)
kimage := vmlinuz
loaderdep=
loader=milo
loaderdoc=
target = boot
kimagesrc = arch/$(KERNEL_ARCH)/boot/vmlinux.gz
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.alpha
endif

ifeq ($(strip $(architecture)),sparc)
kimage := vmlinuz
loaderdep=silo
loader=silo
loaderdoc=SiloDefault
target = vmlinux
NEED_DIRECT_GZIP_IMAGE=YES
kimagesrc = vmlinux
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG = $(CONFDIR)/config.sparc
# make-kpkg --subarch=sun4u binary-arch
# to generate UltraSparc kernel packages.
ifeq ($(SUBARCH),sun4u)
KERNEL_ARCH=sparc64
ARCH_IN_NAME=yes
else
machine = $(shell uname -m)
ifeq ($(strip $(machine)),sparc64)
SUBARCH=sun4u
KERNEL_ARCH=sparc64
ARCH_IN_NAME=yes
endif
endif
endif


ifeq ($(strip $(architecture)),i386)
# sub archs can be i386 i486 i586 i686
GUESS_SUBARCH:=$(shell if test -f .config; then \
                        perl -nle '/^CONFIG_M(.86)=y/ && print "i$$1"' .config;\
                       else \
                         uname -m;\
                       fi)

ifeq (,$(findstring $(SUBARCH),i386 i486 i586 i686))
SUBARCH:=$(GUESS_SUBARCH)
endif

kimage := bzImage
loaderdep=lilo (>= 19.1)
loader=lilo
loaderdoc=LiloDefault
target = $(kimage)
kimagesrc = $(strip arch/$(KERNEL_ARCH)/boot/$(kimage))
kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(version)
DEBCONFIG= $(CONFDIR)/config.$(SUBARCH)
endif

######################################################################
######################################################################

ifneq ($(strip $(loaderdep)),)
int_loaderdep := $(loaderdep),
else
int_loaderdep :=
endif



# The following variable is used to simplify the process of making
# diffs and orig targets, Please set it if AND ONLY IF no patches
# have been applied to the upstream source, in other words, we have
# just added debian* files.  If any patches were applied, please
# leave it empty

# NO_SRC_CHANGES =
NO_SRC_CHANGES = yes

VERSION:=$(shell egrep '^VERSION +=' Makefile 2>/dev/null | \
                 sed -e 's/[^0-9]*\([0-9]*\)/\1/')
PATCHLEVEL:=$(shell egrep '^PATCHLEVEL +=' Makefile 2>/dev/null | \
                    sed -e 's/[^0-9]*\([0-9]*\)/\1/')
SUBLEVEL:=$(shell egrep '^SUBLEVEL +=' Makefile 2>/dev/null | \
                  sed -e 's/[^0-9]*\([0-9]*\)/\1/')
EXTRA_VERSION:=$(shell egrep '^EXTRAVERSION +=' Makefile 2>/dev/null | \
                 sed -e 's/EXTRAVERSION[\t ]*=[\t ]*\(.*\)/\1/')
EXTRAVERSION:=$(strip $(EXTRA_VERSION))
HAVE_NEW_MODLIB:=$(shell egrep '\(INSTALL_MOD_PATH)\' Makefile 2>/dev/null )

# If you want to have more than one kernel configuration per kernel
# version, set FLAVOUR in the top level kernel Makefile *before*
# invoking make-kpkg -- it will be appended to UTS_RELEASE in
# version.h (separated by a hyphen). This affects everything -- the
# names and versions of the image, source, headers, and doc packages,
# and where the modules are searched for in /lib/modules.

ifdef FLAVOUR
# uhm - should check if we really have a Makefile capable of Flavours?
endif

FLAVOUR:=$(shell grep ^FLAVOUR Makefile 2>/dev/null | \
                  perl -ple 's/FLAVOUR[\s:=]+//g')

ifneq ($(strip $(FLAVOUR)),)
INT_FLAV := -$(FLAVOUR)
FLAV_ARG := FLAVOUR=$(FLAVOUR)
else
INT_FLAV :=
FLAV_ARG :=
endif

version = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(INT_FLAV)

# SUBARCH is used to distinguish Amiga, Atari, Macintosh, etc. kernels
# for Debian/m68k.  INT_SUBARCH is used in the names of the image file
# produced. It only affects the naming of the kernel-image as the
# source and doc packages are architecture independent and the
# kernel-headers do not vary from one sub-architecture to the next.

# This is the default
INT_SUBARCH :=

ifneq ($(strip $(ARCH_IN_NAME)),)
ifneq ($(strip $(SUBARCH)),)
INT_SUBARCH := -$(SUBARCH)
endif
endif



# The name of the package (for example, `emacs').
package   := kernel-source-$(version)
h_package := kernel-headers-$(version)
i_package := kernel-image-$(version)$(INT_SUBARCH)
d_package := kernel-doc-$(version)
l_package := libc-kheaders

FILES_TO_CLEAN  = modules/modversions.h modules/ksyms.ver debian/files
STAMPS_TO_CLEAN = stamp-build stamp-configure stamp-source stamp-image \
                  stamp-headers stamp-src stamp-diff stamp-doc \
                  stamp-buildpackage stamp-libc-kheaders stamp-debian
DIRS_TO_CLEAN   = debian/tmp-source debian/tmp-headers debian/tmp-image

CONFLOC    :=/etc/kernel-pkg.conf
LIBLOC     :=/usr/share/kernel-package

ifeq ($(strip $(MODULE_LOC)),)
MODULE_LOC =/usr/src/modules
endif

DEBDIR      = $(LIBLOC)
DEBDIR_NAME = $(shell basename $(DEBDIR))

ifeq ($(strip $(PATCH_DIR)),)
PATCH_DIR         = $(shell if [ -d \
/usr/src/kernel-patches/$(architecture)/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL) \
			       ]; then echo \
/usr/src/kernel-patches/$(architecture)/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
				  else echo \
/usr/src/kernel-patches/$(architecture); \
			    fi)
endif

ifeq ($(strip $(ALL_PATCH_DIR)),)
ALL_PATCH_DIR         = /usr/src/kernel-patches/all
endif

ALL_PATCH_APPLY   = $(ALL_PATCH_DIR)/apply
ALL_PATCH_UNPATCH = $(ALL_PATCH_DIR)/unpatch

DIR_PATCH_APPLY   = $(PATCH_DIR)/apply
DIR_PATCH_UNPATCH = $(PATCH_DIR)/unpatch

# The destination of all .deb files
# (suggested by Rob Browning <osiris@cs.utexas.edu>)
DEB_DEST := ..
SRCTOP := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
INSTALL_MOD_PATH=$(SRCTOP)/debian/tmp-image


install_file=    install -p    -o root -g root -m 644
install_program= install -p    -o root -g root -m 755
make_directory=  install -p -d -o root -g root -m 755
deb_rule = $(MAKE) -f $(DEBDIR)/rules

# Include any site specific overrides here.
-include $(CONFLOC)

# Over ride the config file from the environment/command line
ifneq ($(strip $(KPKG_MAINTAINER)),)
maintainer=$(KPKG_MAINTAINER)
endif

ifneq ($(strip $(KPKG_EMAIL)),)
email=$(KPKG_EMAIL)
endif

ifneq ($(strip $(PGP_SIGNATURE)),)
pgp=$(PGP_SIGNATURE)
endif


# The Debian revision
HAS_CHANGELOG := $(shell if test -f debian/changelog; then echo YES;\
                          else echo NO; fi; )
# If there is a changelog file, it overrides. Else, use the
# commandline or env var setting. Or else default to 1.00
ifeq ($(strip $(HAS_CHANGELOG)),YES)
debian := $(shell if test -f debian/changelog; then \
                     perl -nle 'print /\((\S+)\)/; exit 0' debian/changelog;\
                  fi; )
else
ifneq ($(strip $(DEBIAN_REVISION)),)
debian := $(DEBIAN_REVISION)
else
debian := 1.00
endif
endif



ifneq ($(strip $(IMAGE_IN_BOOT)),)
image_in_boot := $(IMAGE_IN_BOOT)
endif

ifneq ($(strip $(NO_SYMLINK)),)
no_symlink := $(NO_SYMLINK)
endif

ifneq ($(strip $(REVERSE_SYMLINK)),)
reverse_symlink := $(REVERSE_SYMLINK)
endif

ifneq ($(strip $(IMAGE_TYPE)),)
kimage = $(IMAGE_TYPE)
endif

ifneq ($(strip $(PATCH_THE_KERNEL)),)
patch_the_kernel = $(PATCH_THE_KERNEL)
endif

ifneq ($(strip $(USE_SAVED_CONFIG)),)
use_saved_config = $(USE_SAVED_CONFIG)
endif

ifneq ($(strip $(ROOT_CMD)),)
root_cmd := $(root_cmd) $(ROOT_CMD)
endif

ifneq ($(strip $(UNSIGN_SOURCE)),)
root_cmd := $(root_cmd) -us
endif

ifneq ($(strip $(UNSIGN_CHANGELOG)),)
root_cmd := $(root_cmd) -uc
endif

ifneq ($(strip $(CLEAN_SOURCE)),)
do_clean = $(CLEAN_SOURCE)
endif

ifneq ($(strip $(CONCURRENCY_LEVEL)),)
do_parallel = -j$(CONCURRENCY_LEVEL)
endif

ifeq ($(strip $(CONFDIR)),)
ifeq ($(strip $(patch_the_kernel)),YES)
CONFDIR     = $(PATCH_DIR)
else
CONFDIR     = $(DEBDIR)/Config
endif
endif

# The file which has local configuration
CONFIG_FILE := $(shell if test -e .config ; then \
                           echo .config; \
                       elif test -e $(DEBCONFIG) ; then \
                           echo $(DEBCONFIG); \
                       elif test -e $(CONFDIR)/config ; then \
                           echo $(CONFDIR)/config ; \
                       elif test -e $(DEBDIR)/config ; then \
                           echo $(DEBDIR)/config ; \
                       else echo /dev/null ; \
                       fi)

# define MODULES_ENABLED if appropriate
ifneq ($(strip $(shell egrep ^[^\#]*CONFIG_MODULES $(CONFIG_FILE))),)
MODULES_ENABLED := yes
endif


# See if we are being run in the kernel directory
IN_KERNEL_DIR := $(shell if test -d drivers -a -d kernel -a -d fs -a \
                                 -d include/linux ; then \
                            echo YES; \
                         fi )
# See if the version numbers are valid
HAVE_VALID_PACKAGE_VERSION := $(shell \
      if test -x $(DEBDIR)/kpkg-vercheck; then \
	$(DEBDIR)/kpkg-vercheck $(debian) ; \
      else \
        echo "Could not find $(DEBDIR)/kpkg-vercheck" ; \
      fi )

TAR_COMPRESSION := $(shell \
      if tar --help | grep -- \-\-bzip2 >/dev/null; then  \
         echo --bzip2; \
      else \
         echo --gzip; \
      fi )
TAR_SUFFIX := $(shell \
      if tar --help | grep -- \-\-bzip2 >/dev/null; then  \
         echo bz2; \
      else \
         echo gz; \
      fi )

ifeq ($(strip $(IN_KERNEL_DIR)),)
# Hah! Not in kernel directory!!
build configure clean binary kernel_source kernel-source kernel-headers\
stamp-source kernel_headers stamp-headers kernel_image stamp-image \
kernel-image kernel-doc kernel_doc stamp-doc buildpackage \
libc_kheaders libc-kheaders stamp-libc-kheaders kernel-image-deb debian:
	@echo "You should invoke this command from the top level directory of"
	@echo "a linux kernel source directory tree, and as far as I can tell,"
	@echo "the current directory:"
	@echo "	$(SRCTOP)"
	@echo "is not a top level linux kernel source directory. "
	@echo ""
	@echo "	(If I am wrong then kernel-packages and the linux kernel"
	@echo "	 are so out sync that you'd better get the latest versions"
	@echo "	 of the kernel-package package and the Linux sources)"
	@echo ""
	@echo "Please change directory to wherever linux kernel sources"
	@echo "reside and try again."
else
ifneq ($(strip $(HAVE_VALID_PACKAGE_VERSION)),YES)
# Hah! Bogus version number
build configure clean binary kernel_source kernel-source kernel-headers\
stamp-source kernel_headers stamp-headers kernel_image stamp-image \
kernel-image kernel-doc kernel_doc stamp-doc buildpackage kernel-image-deb debian:
	@echo "Problems ecountered with the version number $(debian)."
	@echo "$(HAVE_VALID_PACKAGE_VERSION)"
	@echo ""
	@echo "Please re-read the README file and try again."
else
all build: configure stamp-build
stamp-build:
# Builds the binary package.
# debian.config contains the current idea of what the image should
# have.
	-test -f stamp-configure || $(deb_rule) configure
	$(MAKE) $(do_parallel) $(FLAV_ARG) ARCH=$(KERNEL_ARCH)	\
	                    CROSS_COMPILE=$(KERNEL_CROSS) $(target)
ifdef MODULES_ENABLED
	$(MAKE) $(do_parallel) $(FLAV_ARG) ARCH=$(KERNEL_ARCH) \
	                    CROSS_COMPILE=$(KERNEL_CROSS) modules
endif
	touch stamp-build

buildpackage: stamp-buildpackage
stamp-buildpackage: configure
	test -f stamp-configure || $(deb_rule) configure
	echo 'Building Package' > stamp-building
ifneq ($(strip $(root_cmd)),)
	dpkg-buildpackage -r$(strip $(root_cmd)) -m"$(maintainer) <$(email)>"
else
	dpkg-buildpackage -m"$(maintainer) <$(email)>"
endif
	rm -f stamp-building
	touch stamp-buildpackage

debian: stamp-debian
stamp-debian:
	@test -f $(DEBDIR)/rules || \
            echo Error: Could not find $(DEBDIR)/rules
	-test ! -f stamp-debian && test ! -f debian/official && \
	      rm -rf debian && $(make_directory) debian
ifeq ($(strip $(patch_the_kernel)),YES)
	if [ -d $(DIR_PATCH_APPLY) ]; then \
            run-parts --verbose $(DIR_PATCH_APPLY); \
        else \
	    true; \
	fi
	if [ -d $(ALL_PATCH_APPLY)  ]; then \
            run-parts --verbose $(ALL_PATCH_APPLY); \
        else \
	    true; \
	fi
endif
	-test ! -f stamp-debian && \
	   sed -e 's/=V/$(version)/g'        -e 's/=D/$(debian)/g' \
	       -e 's/=A/$(architecture)/g'   -e 's/=SA/$(INT_SUBARCH)/g' \
               -e 's/=L/$(int_loaderdep) /g' \
               -e 's/=M/$(maintainer) <$(email)>/g'  \
		         $(DEBDIR)/Control > debian/control
	-test ! -f stamp-debian && test ! -f debian/official && \
	   sed -e 's/=V/$(version)/g' -e 's/=D/$(debian)/g' \
	    -e 's/=A/$(architecture)/g' -e 's/=M/$(maintainer) <$(email)>/g' \
		$(DEBDIR)/changelog > debian/changelog
	-test ! -f debian/rules && \
	   $(install_program) $(DEBDIR)/rules debian/rules
	touch stamp-debian

configure: debian stamp-configure
stamp-configure: .config
	test -f stamp-debian || $(deb_rule) debian
	-test ! -f stamp-configure && \
	  (test -f .config || \
                $(install_file) $(DEBDIR)/config .config) \
	  && $(MAKE) $(FLAV_ARG) CROSS_COMPILE=$(KERNEL_CROSS) \
                                 ARCH=$(KERNEL_ARCH) oldconfig \
          && $(MAKE) $(FLAV_ARG) CROSS_COMPILE=$(KERNEL_CROSS) \
                                 ARCH=$(KERNEL_ARCH) dep \
          && $(MAKE) $(FLAV_ARG) CROSS_COMPILE=$(KERNEL_CROSS) \
                                 ARCH=$(KERNEL_ARCH) clean && \
              touch stamp-configure

.config:
ifneq ($(strip $(use_saved_config)),NO)
	test -f .config || (test -f .config.save && \
		            cp -pf .config.save .config) || \
			true
endif
	test -f .config || cp -pf $(CONFIG_FILE) .config


clean:
ifeq ($(strip $(patch_the_kernel)),YES)
	if [ -d $(DIR_PATCH_UNPATCH) ]; then \
            run-parts --verbose $(DIR_PATCH_UNPATCH); \
        else \
	    true; \
	fi
	if [ -d $(ALL_PATCH_UNPATCH)  ]; then \
            run-parts --verbose $(ALL_PATCH_UNPATCH); \
        else \
	    true; \
	fi
endif
	rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
	test ! -f .config || cp -pf .config config.precious
	-test -f Makefile && $(MAKE) $(FLAV_ARG) ARCH=$(KERNEL_ARCH) distclean
	test ! -f config.precious || mv -f config.precious .config
	rm -rf $(DIRS_TO_CLEAN)
	test -f stamp-building || test -f debian/official || rm -rf debian

binary:       binary-indep binary-arch
binary-indep: kernel_source kernel_doc
binary-arch:  kernel_image  kernel_headers


kernel-source kernel_source: stamp-source
stamp-source: debian
	@test 0 = $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
		(echo need root priviledges; exit 1)
	test -f stamp-debian || $(deb_rule) debian
	rm -rf debian/tmp-source
	$(make_directory) debian/tmp-source/DEBIAN
	$(make_directory) debian/tmp-source/usr/src/$(package)
	$(make_directory) debian/tmp-source/usr/share/doc/$(package)
	sed -e 's/=P/$(package)/g' -e 's/=V/$(version)/g' \
	    $(DEBDIR)/include.postinst > debian/tmp-source/DEBIAN/postinst
	chmod 755 debian/tmp-source/DEBIAN/postinst
	sed -e 's/=P/$(package)/g' -e 's/=V/$(version)/g' \
	    $(DEBDIR)/include.prerm > debian/tmp-source/DEBIAN/prerm
	chmod 755 debian/tmp-source/DEBIAN/prerm
	$(install_file) debian/changelog \
	          debian/tmp-source/usr/share/doc/$(package)/changelog.Debian
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/changelog.Debian
	$(install_file) $(DEBDIR)/README \
	          debian/tmp-source/usr/share/doc/$(package)/debian.README
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/debian.README
	$(install_file) $(DEBDIR)/README.headers \
	          debian/tmp-source/usr/share/doc/$(package)/README.headers
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/README.headers
	$(install_file) $(DEBDIR)/README.tecra \
	          debian/tmp-source/usr/share/doc/$(package)/README.tecra
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/README.tecra
	$(install_file) $(DEBDIR)/README.modules \
	          debian/tmp-source/usr/share/doc/$(package)/README.modules
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/README.modules
	$(install_file) README \
	          debian/tmp-source/usr/share/doc/$(package)/README
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/README
	$(install_file) $(DEBDIR)/Flavours \
	          debian/tmp-source/usr/share/doc/$(package)/Flavours
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/Flavours
	$(install_file) $(DEBDIR)/Rationale \
	          debian/tmp-source/usr/share/doc/$(package)/Rationale
	gzip -9qf debian/tmp-source/usr/share/doc/$(package)/Rationale
	$(install_file) $(DEBDIR)/copyright.source \
		debian/tmp-source/usr/share/doc/$(package)/copyright
	echo "This was produced by kernel-package version $(kpkg_version)." > \
	         debian/tmp-source/usr/share/doc/$(package)/Buildinfo
	-tar cf - `echo * | sed -e 's/debian//g' -e 's/\.deb//g' ` \
	| (cd debian/tmp-source/usr/src/$(package); umask 000; tar xsf -)
	(cd debian/tmp-source/usr/src/$(package); \
            $(MAKE) $(FLAV_ARG) ARCH=$(KERNEL_ARCH) distclean)
	(cd debian/tmp-source/usr/src/$(package); \
                        rm -f stamp-building $(STAMPS_TO_CLEAN))
	(cd debian/tmp-source/usr/src/$(package)/include; rm -f asm; \
		ln -s asm-$(KERNEL_ARCH) asm)
	if test -f debian/official -a -f debian/README.Debian ; then \
           $(install_file) debian/README.Debian \
		debian/tmp-source/usr/src/$(package)/README.Debian ; \
	else \
	    sed -e 's/=V/$(version)/g' -e 's/=A/$(architecture)/g' \
                 $(DEBDIR)/README.source > \
		 debian/tmp-source/usr/src/$(package)/README.Debian ; \
	fi
	chown -R root.root debian/tmp-source
	chmod -R og=rX debian/tmp-source
	(cd debian/tmp-source/usr/src/; \
           tar $(TAR_COMPRESSION) -cf $(package).tar.$(TAR_SUFFIX) $(package);\
             rm -rf $(package);)
	dpkg-gencontrol -isp -p$(package) -Pdebian/tmp-source/
	chown -R root.root debian/tmp-source
	chmod -R og=rX debian/tmp-source
	dpkg --build debian/tmp-source $(DEB_DEST)
	rm -f -r debian/tmp-source
	touch stamp-source

libc-kheaders libc_kheaders: stamp-libc-kheaders
stamp-libc-kheaders: configure
	@echo This target is now obsolete.


kernel-headers kernel_headers: stamp-headers
stamp-headers: configure
	@test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
		(echo need root priviledges; exit 1)
	test -f stamp-configure || $(deb_rule) configure
	rm -rf debian/tmp-headers
	$(make_directory) debian/tmp-headers/DEBIAN
	$(make_directory) debian/tmp-headers/usr/src/$(h_package)
	$(make_directory) debian/tmp-headers/usr/share/doc/$(h_package)
	sed -e 's/=P/$(h_package)/g' -e 's/=V/$(version)/g' \
		$(DEBDIR)/include.postinst > debian/tmp-headers/DEBIAN/postinst
	chmod 755 debian/tmp-headers/DEBIAN/postinst
	sed -e 's/=P/$(h_package)/g' -e 's/=V/$(version)/g' \
		$(DEBDIR)/include.prerm > debian/tmp-headers/DEBIAN/prerm
	chmod 755 debian/tmp-headers/DEBIAN/prerm
	$(install_file) $(DEBDIR)/copyright.headers \
		debian/tmp-headers/usr/share/doc/$(h_package)/copyright
	$(install_file) debian/changelog \
	         debian/tmp-headers/usr/share/doc/$(h_package)/changelog.Debian
	gzip -9qf debian/tmp-headers/usr/share/doc/$(h_package)/changelog.Debian
	$(install_file) $(DEBDIR)/README.headers \
	         debian/tmp-headers/usr/share/doc/$(h_package)/debian.README
	gzip -9qf debian/tmp-headers/usr/share/doc/$(h_package)/debian.README
	echo "This was produced by kernel-package version $(kpkg_version)." > \
	         debian/tmp-headers/usr/share/doc/$(h_package)/Buildinfo
	-tar cf - include | \
            (cd debian/tmp-headers/usr/src/$(h_package); umask 000; tar xsf -)
	(cd debian/tmp-headers/usr/src/$(h_package)/include; rm -f asm; \
		ln -s asm-$(KERNEL_ARCH) asm)
	dpkg-gencontrol -DArchitecture=$(architecture) -isp \
                        -p$(h_package) -Pdebian/tmp-headers/
	chown -R root.root debian/tmp-headers
	chmod -R og=rX debian/tmp-headers
	dpkg --build debian/tmp-headers $(DEB_DEST)
	rm -rf debian/tmp-headers
	touch stamp-headers

kernel-doc kernel_doc: stamp-doc
stamp-doc: debian
	@test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
		(echo need root priviledges; exit 1)
	test -f stamp-debian || $(deb_rule) debian
	rm -rf            debian/tmp-doc
	$(make_directory) debian/tmp-doc/DEBIAN
	$(make_directory) debian/tmp-doc/usr/share/doc/$(d_package)
	$(install_file) debian/changelog \
	         debian/tmp-doc/usr/share/doc/$(d_package)/changelog.Debian
	$(install_file) $(DEBDIR)/README.doc \
	         debian/tmp-doc/usr/share/doc/$(d_package)/README.Debian
	echo "This was produced by kernel-package version $(kpkg_version)." > \
	         debian/tmp-doc/usr/share/doc/$(d_package)/Buildinfo
	-tar cf - Documentation | \
            (cd debian/tmp-doc/usr/share/doc/$(d_package); umask 000; tar xsf -)
	-gzip -9fqr debian/tmp-doc/usr/share/doc/$(d_package)
	$(install_file) $(DEBDIR)/copyright.doc \
		debian/tmp-doc/usr/share/doc/$(d_package)/copyright
	dpkg-gencontrol -isp -p$(d_package) -Pdebian/tmp-doc/
	chown -R root.root debian/tmp-doc
	chmod -R og=rX debian/tmp-doc
	dpkg --build debian/tmp-doc $(DEB_DEST)
	rm -rf debian/tmp-doc
	touch stamp-doc

kernel-image kernel_image: stamp-image
stamp-image: configure build kernel-image-deb
# % make config
# % make-kpkg build
# % sudo make -f debian/rules kernel-image-deb
# seems to create a working .deb with a kernel that gives the correct
# user name (as opposed to root@...)
kernel-image-deb:
	@test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//')    \
		 || (echo need root priviledges; exit 1)
	rm -f -r ./debian/tmp-image ./debian/tmp-image.deb
	test -f stamp-configure     || $(deb_rule) configure
	test -f stamp-build         || $(deb_rule) build
	$(make_directory) debian/tmp-image/DEBIAN
	$(make_directory) debian/tmp-image/$(IMAGE_DESTDIR)
	$(make_directory) debian/tmp-image/usr/share/doc/$(i_package)
	sed -e 's/=V/$(version)/g'    -e 's/=B/$(image_in_boot)/g'   \
            -e 's/=S/$(no_symlink)/g' -e 's/=R/$(reverse_symlink)/g' \
            -e 's/=K/$(kimage)/g'     -e 's/=L/$(loader)/g'          \
            -e 's,=D,$(IMAGE_DESTDIR),g'                             \
             $(DEBDIR)/image.postinst > debian/tmp-image/DEBIAN/postinst
	chmod 755 debian/tmp-image/DEBIAN/postinst
	sed -e 's/=V/$(version)/g'    -e 's/=B/$(image_in_boot)/g'   \
            -e 's/=S/$(no_symlink)/g' -e 's/=R/$(reverse_symlink)/g' \
            -e 's/=K/$(kimage)/g'     -e 's/=L/$(loader)/g'          \
            -e 's,=D,$(IMAGE_DESTDIR),g'                             \
             $(DEBDIR)/image.postrm > debian/tmp-image/DEBIAN/postrm
	chmod 755 debian/tmp-image/DEBIAN/postrm
	sed -e 's/=V/$(version)/g'    -e 's/=L/$(loader)/g'          \
	             $(DEBDIR)/image.preinst > debian/tmp-image/DEBIAN/preinst
	chmod 755 debian/tmp-image/DEBIAN/preinst
	sed -e 's/=V/$(version)/g'    -e 's/=L/$(loader)/g'          \
	             $(DEBDIR)/image.prerm > debian/tmp-image/DEBIAN/prerm
	chmod 755 debian/tmp-image/DEBIAN/prerm
	$(install_file) debian/changelog \
	         debian/tmp-image/usr/share/doc/$(i_package)/changelog.Debian
	gzip -9qf debian/tmp-image/usr/share/doc/$(i_package)/changelog.Debian
ifdef loaderdoc
	$(install_file) $(DEBDIR)/$(loaderdoc) \
	         debian/tmp-image/usr/share/doc/$(i_package)/$(loaderdoc)
	gzip -9qf debian/tmp-image/usr/share/doc/$(i_package)/$(loaderdoc)
endif
	$(install_file) $(DEBDIR)/README.image \
	         debian/tmp-image/usr/share/doc/$(i_package)/debian.README
	gzip -9qf debian/tmp-image/usr/share/doc/$(i_package)/debian.README
	$(install_file) $(DEBDIR)/copyright.image \
		debian/tmp-image/usr/share/doc/$(i_package)/copyright
	echo "This was produced by kernel-package version $(kpkg_version)." > \
	         debian/tmp-image/usr/share/doc/$(i_package)/Buildinfo
	$(install_file) .config $(INT_IMAGE_DESTDIR)/config-$(version)
ifdef MODULES_ENABLED
ifeq  ($(strip $(HAVE_NEW_MODLIB)),)
	$(mod_inst_cmds)
else
	# Dang. This kills flavours.
	#$(MAKE) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) modules_install
	$(mod_inst_cmds)
endif
endif
ifeq ($(strip $(NEED_DIRECT_GZIP_IMAGE)),YES)
	gzip -9vc $(kimagesrc) > $(kimagedest)
else
	cp $(kimagesrc) $(kimagedest)
endif
	chmod 644 $(kimagedest)
ifeq ($(strip $(HAVE_COFF_IMAGE)),YES)
	cp $(coffsrc)   $(coffdest)
	chmod 644       $(coffdest)
endif
	-test -f System.map &&  cp System.map \
                        $(INT_IMAGE_DESTDIR)/System.map-$(version)
	-test -f System.map &&  chmod 644 \
                        $(INT_IMAGE_DESTDIR)/System.map-$(version)
	dpkg-gencontrol -DArchitecture=$(architecture) -isp \
                        -p$(i_package) -Pdebian/tmp-image/
	chown -R root.root debian/tmp-image
	chmod -R og=rX debian/tmp-image
	dpkg --build debian/tmp-image $(DEB_DEST)
	rm -f -r debian/tmp-image
ifeq ($(strip $(do_clean)),YES)
	$(MAKE) $(FLAV_ARG) ARCH=$(KERNEL_ARCH) clean
endif
	rm -f stamp-build
	touch stamp-image

# This endif is for HAVE_VALID_PACKAGE_VERSION
endif

#This  endif is for IN_KERNEL_DIR
endif


# only generate module image packages
modules-image modules_image: configure
ifndef MODULES_ENABLED
	@echo Modules not configured, so not making modules_image
else
	-for module in $(MODULE_LOC)/* ; do                         \
          if test -d  $$module; then                                \
	    (cd $$module;                                           \
              if ./debian/rules KVERS="$(version)" KSRC="$(SRCTOP)" \
                             KMAINT="$(pgp)" KEMAIL="$(email)"      \
                             KDREV="$(debian)" kdist_image; then    \
                  echo "Module $$module processed fine";            \
              else                                                  \
                   echo "Module $$module failed.";                  \
                   echo "Hit return to Continue";                   \
		   read ans;                                        \
              fi;                                                   \
	     );                                                     \
	  fi;                                                       \
        done
endif

# generate the modules packages and sign them with dchanges
modules: configure
ifndef MODULES_ENABLED
	@echo Modules not configured, so not making modules
else
	-for module in $(MODULE_LOC)/* ; do                         \
          if test -d  $$module; then                                \
	    (cd $$module;                                           \
              if ./debian/rules KVERS="$(version)" KSRC="$(SRCTOP)" \
                             KMAINT="$(pgp)" KEMAIL="$(email)"      \
                             KDREV="$(debian)" kdist; then          \
                  echo "Module $$module processed fine";            \
              else                                                  \
                   echo "Module $$module failed.";                  \
                   echo "Hit return to Continue?";                  \
		   read ans;                                        \
              fi;                                                   \
	     );                                                     \
	  fi;                                                       \
        done
endif

modules-config modules_config: configure
ifndef MODULES_ENABLED
	@echo Modules not configured, so not making modules_config
else
	-for module in $(MODULE_LOC)/* ; do \
          if test -d  $$module; then \
	    (cd $$module; \
              if ./debian/rules KVERS="$(version)" KSRC="$(SRCTOP)" \
                             KMAINT="$(pgp)" KEMAIL="$(email)"      \
                             KDREV="$(debian)" kdist_configure; then\
                  echo "Module $$module configured fine";           \
              else                                                  \
                   echo "Module $$module failed to configure";      \
                   echo "Hit return to Continue?";                  \
		   read ans;                                        \
              fi;                                                   \
	     );                                                     \
	  fi;                                                       \
        done
endif


source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

define mod_inst_cmds
        @( \
        MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(version); \
        cd modules; \
        MODULES=""; \
        inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
                mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
                echo Installing modules under $$MODLIB/$$2; \
        }; \
        \
	if [ -f BLOCK_MODULES    ]; then inst_mod BLOCK_MODULES    block; fi; \
	if [ -f NET_MODULES      ]; then inst_mod NET_MODULES      net;   fi; \
	if [ -f IPV4_MODULES     ]; then inst_mod IPV4_MODULES     ipv4;  fi; \
	if [ -f IPV6_MODULES     ]; then inst_mod IPV6_MODULES     ipv6;  fi; \
        if [ -f ATM_MODULES      ]; then inst_mod ATM_MODULES      atm;   fi; \
	if [ -f SCSI_MODULES     ]; then inst_mod SCSI_MODULES     scsi;  fi; \
	if [ -f FS_MODULES       ]; then inst_mod FS_MODULES       fs;    fi; \
	if [ -f NLS_MODULES      ]; then inst_mod NLS_MODULES      fs;    fi; \
	if [ -f CDROM_MODULES    ]; then inst_mod CDROM_MODULES    cdrom; fi; \
	if [ -f HAM_MODULES      ]; then inst_mod HAM_MODULES      net;   fi; \
	if [ -f SOUND_MODULES    ]; then inst_mod SOUND_MODULES    sound; fi; \
	if [ -f VIDEO_MODULES    ]; then inst_mod VIDEO_MODULES    video; fi; \
	if [ -f FC4_MODULES      ]; then inst_mod FC4_MODULES      fc4;   fi; \
	if [ -f IRDA_MODULES     ]; then inst_mod IRDA_MODULES     net;   fi; \
        if [ -f USB_MODULES      ]; then inst_mod USB_MODULES      usb;   fi; \
        \
        for f in *.o; do [ -r $$f ] && echo $$f; done > .allmods; \
        echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
        if [ -s .misc ]; then inst_mod .misc misc; fi; \
        rm -f .misc .allmods; \
        )
endef

# 		2.0.38	2.2.12	2.3.1
# BLOCK_MODULES	X	X	X
# NET_MODULES	X	X	X
# IPV4_MODULES	X	X	X
# IPV6_MODULES		X	X
# ATM_MODULES			X
# SCSI_MODULES	X	X	X
# FS_MODULES	X	X	X
# NLS_MODULES		X	X
# CDROM_MODULES	X	X	X
# HAM_MODULES		X	X
# SOUND_MODULES		X	X
# VIDEO_MODULES		X	X
# FC4_MODULES		X	X
# IRDA_MODULES		X	X
# USB_MODULES			X

.PHONY: binary binary-arch binary-indep clean modules modules_image

Reply to: