From: Donald J. Becker (becker@super.org)
Date: 04/30/93


From: becker@super.org (Donald J. Becker)
Subject: Re: my list of things to do on linux
Date: Fri, 30 Apr 1993 05:35:02 GMT

In article <pdhC67xEy.9uo@netcom.com> pdh@netcom.com (P D H) writes:
>5. I want to make the kernel easy to compile without touching the kernel
> sources in the standard place. I think I now have a way to do this
> with only a hack to the first Makefile and a shell script in front.
> I'll probably be trying this out tonight (thanks to HJ Lu for the info).
> Then I want to make sure my hack won't defeat things others do so it
> can be eventually incorporated into the kernel source tree setup.

I've been doing this since, oh, about 0.97 with fair success. I hope
Linus will keep this in mind, since CD-ROM source distributions make
pure source tree's increasingly important. Trees of symoblic links
wasteful and distracting, so I use the VPATH feature of Makefile.

You still have to make symoblic links to:
        tools/*.c
        boot/*.S
        zBoot/*.c
        kernel/chr_drv/{console,keyboard}.c
        kernel/chr_drv/vt_kern.h
The only part of the pure kernel source you'll have to touch is the
include director, to build the link to 'include/linux/autoconf.h'.

Here are the Makefiles I use:
________________Vmakefile________________
# Define the directories if they aren't passed in.
ifndef srcroot
   srcroot = /usr/src/linux/
   curroot = /usr/linux-build/
endif
srcdir := $(subst $(curroot),$(srcroot),$(shell echo $$PWD))
# If there is already a ./Makefile use that instead.
ifneq (, $(wildcard GNUmakefile Makefile))
  include $(firstword $(wildcard GNUmakefile Makefile))
else
  include $(srcdir)/Makefile
endif
VPATH = $(srcdir)
MAKE := $(MAKE) -f $(curroot)/Vmakefile
.EXPORT_ALL_VARIABLES:

________________Makefile________________
srcroot = /usr/src/linux/
curroot := /usr/linux-build/

srcdir := $(srcroot)
VPATH = $(srcdir)

lilo-new: lilo-test

include $(srcroot)/Makefile
# Here is the important line -- redefine the 'make' command
MAKE := $(MAKE) -f $(curroot)/Vmakefile

ROOT_DEV = /dev/hda2

# Fix a broken kernel, while keeping the (presumably good) backup intact.
lilo-test: Version Image
        install -m 644 Image /vmlinux
        /etc/lilo/install
TAGS:
        etags -f $@ */*.[ch] */*/*.[ch] $(srcdir)/*/*.[ch] $(srcdir)/*/*/*.[ch]
.EXPORT_ALL_VARIABLES:

-- 
Donald Becker                                  becker@super.org
Supercomputing Research Center
17100 Science Drive, Bowie MD 20715                301-805-7482