Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jan 1997 06:16:04 -0800 (PST)
From:      mark thompson <thompson@tgsoft.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2493: make $DESTDIR work
Message-ID:  <199701141416.GAA21689@squirrel.tgsoft.com>
Resent-Message-ID: <199701141420.GAA14664@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2493
>Category:       bin
>Synopsis:       Cannot use DESTDIR to build a seperate tree
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 14 06:20:02 PST 1997
>Last-Modified:
>Originator:     mark thompson
>Organization:
tgsoft
>Release:        FreeBSD 2.1.6.1-RELEASE
>Environment:

The following stuff allows the building of 2.2 on a 2.1.6.1 system without
wiping out the 2.1.6.1 system.

>Description:

Enclosed is a set of diffs (mostly to makefiles) that make them respect
$DESTDIR. Also, three files have redundant (conflicting) definitions of
malloc, and refuse to compile.
Also included is a shell script that sets various environment variables,
and so forth to build the system successfully.

>How-To-Repeat:

Try to build 2.2 with DESTDIR set.

>Fix:
	
#!/bin/sh
#
# (builds FreeBSD 2.2 in a seperate tree on FreeBSD 2.1.6)
#
# This script will build FreeBSD 2.2 in a tree seperate from your 
# running system. To use it, make a directory to hold the results
# and set its name below:
ROOT=/u/build2.2/Root
#
# Then copy (or check out) the source tree into $ROOT/usr/src.
# The object files will go into /usr/obj. If this is not where you want
# them, /usr/obj (or one of its subdirectories) should be a symlink. 
# On my system (where ROOT=/u/build2.2/Root), 
#
# # ls -l /usr/obj/u/build2.2
# # lrwxr-xr-x  1 root  wheel  24 Jan  5 06:53 Root -> /u/build2.2/Root/usr/obj
#
# This exploits the fact that the object directory is /usr/obj/<source dir>
#
# Set an initial path
PATH=/usr/bin:/bin:/usr/sbin:/sbin
# I prefer to have the files in /usr/include be real files, and not symlinks
SHARED=copies
export PATH SHARED
#
# Go to the source tree
cd $ROOT/usr/src
#
# We need a make that has the -m flag. The 2.1.6.1 make does not, so
# make up through the making of make. This also insures that the right
# things are in $ROOT/usr/share/mk
#
echo "--------------------------------------------------------------"
echo make DESTDIR=$ROOT hierarchy mk cleandir obj bootstrap
echo "--------------------------------------------------------------"
make DESTDIR=$ROOT hierarchy mk cleandir obj bootstrap
#
# Set up some paths for what follows. 
#
# BISON's auxiliary files
#
BISON_SIMPLE=$ROOT/usr/share/misc/bison.simple
BISON_HAIRY=$ROOT/usr/share/misc/bison.hairy
#
# Path for the compiler's passes
#
COMPILER_PATH=$ROOT/usr/bin:$ROOT/usr/libexec
#
# Paths for the library files, both link-time and run-time
#
LD_LIBRARY_PATH=$ROOT/usr/lib:/usr/lib
LIBRARY_PATH=$ROOT/usr/lib:/usr/lib
#
# Now the executeable PATH. Look first in our newly built directories, then
# fall back to the existing ones
#
PATHL=$ROOT/usr/bin:$ROOT/bin:$ROOT/usr/sbin:$ROOT/sbin
PATH=$PATHL:$PATH
export BISON_SIMPLE BISON_HAIRY COMPILER_PATH LD_LIBRARY_PATH LIBRARY_PATH PATH
#
echo "--------------------------------------------------------------"
echo make -m $ROOT/usr/share/mk DESTDIR=$ROOT \
	-DNOCLEAN -DNOPROFILE -DNOGAMES world
echo "--------------------------------------------------------------"
make -m $ROOT/usr/share/mk DESTDIR=$ROOT \
	-DNOCLEAN -DNOPROFILE -DNOGAMES world
exit $?


These patches make it possible to build 2.2 on 2.1.6.1 with DESTDIR set.
The first group of files refer to /usr/include without mentioning DESTDIR.
This grabs the wrong include files

diff -r -u ../FreeBSD.2.2/src/lib/librpcsvc/Makefile Root/usr/src/lib/librpcsvc/Makefile
--- ../FreeBSD.2.2/src/lib/librpcsvc/Makefile	Thu Aug 29 19:02:09 1996
+++ Root/usr/src/lib/librpcsvc/Makefile	Mon Jan 13 11:44:29 1997
@@ -10,7 +10,7 @@
 
 RPCCOM = rpcgen
 
-INCDIRS= -I/usr/include/rpcsvc
+INCDIRS= -I${DESTDIR}/usr/include/rpcsvc
 CFLAGS+= ${INCDIRS}
 
 SRCS= ${RPCSRCS:R:S/$/_xdr.c/g}
diff -r -u ../FreeBSD.2.2/src/gnu/lib/libg++/Makefile Root/usr/src/gnu/lib/libg++/Makefile
--- ../FreeBSD.2.2/src/gnu/lib/libg++/Makefile	Mon Oct  7 16:38:08 1996
+++ Root/usr/src/gnu/lib/libg++/Makefile	Mon Jan 13 11:40:19 1997
@@ -13,7 +13,7 @@
 SHLIB_MINOR=	0
 CPLUSPLUSLIB=	1	# include c++rt0.o for static constructors
 
-CFLAGS+=	-I${GPPDIR}/include -I/usr/include/g++
+CFLAGS+=	-I${GPPDIR}/include -I${DESTDIR}/usr/include/g++
 CXXFLAGS+=	-I${GPPDIR}/include -I${GPPDIR}/libio -I${GPPDIR}/libstdc++
 
 # C source
diff -r -u ../FreeBSD.2.2/src/gnu/lib/libstdc++/Makefile Root/usr/src/gnu/lib/libstdc++/Makefile
--- ../FreeBSD.2.2/src/gnu/lib/libstdc++/Makefile	Fri Nov 15 10:15:45 1996
+++ Root/usr/src/gnu/lib/libstdc++/Makefile	Mon Jan 13 11:41:46 1997
@@ -12,7 +12,7 @@
 SHLIB_MINOR=	0
 CPLUSPLUSLIB=	1	# include c++rt0.o for static constructors
 
-CFLAGS+=	-I${GPPDIR}/include -I/usr/include/g++ -I.
+CFLAGS+=	-I${GPPDIR}/include -I${DESTDIR}/usr/include/g++ -I.
 CXXFLAGS+=	-I${GPPDIR}/include -I${GPPDIR}/libio -I${GPPDIR}/libstdc++
 CXXFLAGS+=	-fno-implicit-templates
 
The next group is composed of Makefiles that reference /sys without DESTDIR.
Naturally, this is the wrong /sys... so fix it

diff -r -u ../FreeBSD.2.2/src/bin/ps/Makefile Root/usr/src/bin/ps/Makefile
--- ../FreeBSD.2.2/src/bin/ps/Makefile	Wed Oct 25 08:07:38 1995
+++ Root/usr/src/bin/ps/Makefile	Mon Jan 13 11:46:38 1997
@@ -3,7 +3,7 @@
 
 PROG=	ps
 SRCS=	fmt.c keyword.c nlist.c print.c ps.c
-CFLAGS+=-I/sys
+CFLAGS+=-I${DESTDIR}/sys
 DPADD=	${LIBM} ${LIBKVM}
 LDADD=	-lm -lkvm
 BINGRP=	kmem
diff -r -u ../FreeBSD.2.2/src/lib/libkvm/Makefile Root/usr/src/lib/libkvm/Makefile
--- ../FreeBSD.2.2/src/lib/libkvm/Makefile	Thu Aug  4 18:42:04 1994
+++ Root/usr/src/lib/libkvm/Makefile	Mon Jan 13 11:46:39 1997
@@ -1,7 +1,7 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 LIB=	kvm
-CFLAGS+=-DLIBC_SCCS -I/sys
+CFLAGS+=-DLIBC_SCCS -I${DESTDIR}/sys
 SRCS=	kvm.c kvm_${MACHINE}.c kvm_file.c kvm_getloadavg.c kvm_proc.c
 
 MAN3=	kvm.3 kvm_geterr.3 kvm_getfiles.3 kvm_getloadavg.3 kvm_getprocs.3 \
diff -r -u ../FreeBSD.2.2/src/lib/libutil/Makefile Root/usr/src/lib/libutil/Makefile
--- ../FreeBSD.2.2/src/lib/libutil/Makefile	Mon Dec 30 13:15:43 1996
+++ Root/usr/src/lib/libutil/Makefile	Mon Jan 13 11:46:39 1997
@@ -3,7 +3,7 @@
 LIB=	util
 SHLIB_MAJOR= 2
 SHLIB_MINOR= 1
-CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -I/sys
+CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -I${DESTDIR}/sys
 SRCS=	login.c login_tty.c logout.c logwtmp.c pty.c setproctitle.c
 MAN3+=	login.3 login_tty.3 logout.3 logwtmp.3 pty.3 setproctitle.3
 MLINKS+= pty.3 openpty.3  pty.3 forkpty.3
diff -r -u ../FreeBSD.2.2/src/libexec/lfs_cleanerd/Makefile Root/usr/src/libexec/lfs_cleanerd/Makefile
--- ../FreeBSD.2.2/src/libexec/lfs_cleanerd/Makefile	Sun Sep 22 14:53:40 1996
+++ Root/usr/src/libexec/lfs_cleanerd/Makefile	Mon Jan 13 11:46:39 1997
@@ -2,7 +2,7 @@
 #	$Id: Makefile,v 1.5 1996/09/22 21:53:40 wosch Exp $
 
 PROG=	lfs_cleanerd
-CFLAGS+=-I/sys/ufs/lfs -I${.CURDIR} ${DEBUG}
+CFLAGS+=-I${DESTDIR}/sys/ufs/lfs -I${.CURDIR} ${DEBUG}
 MAN8=	lfs_cleanerd.8
 SRCS=	cleanerd.c lfs_cksum.c library.c misc.c print.c
 
diff -r -u ../FreeBSD.2.2/src/sbin/dumplfs/Makefile Root/usr/src/sbin/dumplfs/Makefile
--- ../FreeBSD.2.2/src/sbin/dumplfs/Makefile	Sun Nov 20 14:28:09 1994
+++ Root/usr/src/sbin/dumplfs/Makefile	Mon Jan 13 11:46:39 1997
@@ -1,7 +1,7 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 PROG=	dumplfs
-CFLAGS+=-I/sys/ufs/lfs
+CFLAGS+=-I${DESTDIR}/sys/ufs/lfs
 SRCS=	dumplfs.c lfs_cksum.c misc.c
 .PATH:	${.CURDIR}/../../sys/ufs/lfs
 MAN8=	dumplfs.8
diff -r -u ../FreeBSD.2.2/src/usr.bin/fstat/Makefile Root/usr/src/usr.bin/fstat/Makefile
--- ../FreeBSD.2.2/src/usr.bin/fstat/Makefile	Fri May 27 05:31:24 1994
+++ Root/usr/src/usr.bin/fstat/Makefile	Mon Jan 13 11:46:39 1997
@@ -1,7 +1,7 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	fstat
-CFLAGS+=-I/sys
+CFLAGS+=-I${DESTDIR}/sys
 DPADD=	${LIBKVM}
 LDADD=	-lkvm
 BINGRP=	kmem
diff -r -u ../FreeBSD.2.2/src/usr.bin/mt/Makefile Root/usr/src/usr.bin/mt/Makefile
--- ../FreeBSD.2.2/src/usr.bin/mt/Makefile	Fri May 27 05:32:24 1994
+++ Root/usr/src/usr.bin/mt/Makefile	Mon Jan 13 11:46:40 1997
@@ -1,6 +1,6 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	mt
-CFLAGS+=-I/sys
+CFLAGS+=-I${DESTDIR}/sys
 
 .include <bsd.prog.mk>
diff -r -u ../FreeBSD.2.2/src/usr.bin/netstat/Makefile Root/usr/src/usr.bin/netstat/Makefile
--- ../FreeBSD.2.2/src/usr.bin/netstat/Makefile	Thu Sep  5 10:14:56 1996
+++ Root/usr/src/usr.bin/netstat/Makefile	Mon Jan 13 11:46:40 1997
@@ -4,7 +4,7 @@
 SRCS=	if.c inet.c main.c mbuf.c mroute.c ipx.c route.c \
 	unix.c atalk.c # iso.c ns.c tp_astring.c
 
-CFLAGS+=-I/sys # -g
+CFLAGS+=-I${DESTDIR}/sys # -g
 #.PATH:	${.CURDIR}/../../sys/netiso
 BINGRP=	kmem
 BINMODE=2555
diff -r -u ../FreeBSD.2.2/src/usr.sbin/iostat/Makefile Root/usr/src/usr.sbin/iostat/Makefile
--- ../FreeBSD.2.2/src/usr.sbin/iostat/Makefile	Fri Aug  5 09:30:14 1994
+++ Root/usr/src/usr.sbin/iostat/Makefile	Mon Jan 13 11:46:40 1997
@@ -1,7 +1,7 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	iostat
-CFLAGS+=-I/sys -I${.CURDIR}/../../usr.bin/vmstat
+CFLAGS+=-I${DESTDIR}/sys -I${.CURDIR}/../../usr.bin/vmstat
 MAN8=	iostat.8
 DPADD=	${LIBKVM}
 LDADD=	-lkvm
diff -r -u ../FreeBSD.2.2/src/usr.sbin/pciconf/Makefile Root/usr/src/usr.sbin/pciconf/Makefile
--- ../FreeBSD.2.2/src/usr.sbin/pciconf/Makefile	Tue Oct 22 13:27:46 1996
+++ Root/usr/src/usr.sbin/pciconf/Makefile	Mon Jan 13 11:46:40 1997
@@ -3,6 +3,6 @@
 PROG=	pciconf
 NOMAN=
 
-CFLAGS+=	-I/sys
+CFLAGS+=	-I${DESTDIR}/sys
 
 .include <bsd.prog.mk>
diff -r -u ../FreeBSD.2.2/src/usr.sbin/pstat/Makefile Root/usr/src/usr.sbin/pstat/Makefile
--- ../FreeBSD.2.2/src/usr.sbin/pstat/Makefile	Sat May 13 10:25:22 1995
+++ Root/usr/src/usr.sbin/pstat/Makefile	Mon Jan 13 11:46:40 1997
@@ -1,7 +1,7 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	pstat
-CFLAGS+=-I/sys
+CFLAGS+=-I${DESTDIR}/sys
 BINGRP=	kmem
 BINMODE=2555
 DPADD=	${LIBKVM}

The lkm's are a tough case. They refer to machine/... Since the /sys directory
does not have a directory named that, they find it in /usr/include. We need
to stop this behaviour. In the atapi driver, the makefile just makes a
symlink for machine. We copy that into the other lkms

diff -r -u ../FreeBSD.2.2/src/lkm/atapi/Makefile Root/usr/src/lkm/atapi/Makefile
--- ../FreeBSD.2.2/src/lkm/atapi/Makefile	Sun Oct  6 15:16:44 1996
+++ Root/usr/src/lkm/atapi/Makefile	Mon Jan 13 18:58:01 1997
@@ -29,8 +29,12 @@
 		echo "#define ATAPI 1"> opt_atapi.h
 
 .c.o:
-		-@$(LN) /sys/i386/include machine
+		$(LN) ${DESTDIR}/sys/i386/include machine
 		$(CC) $(CFLAGS) -c $<
-		-@rm -f machine
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/ccd/Makefile Root/usr/src/lkm/ccd/Makefile
--- ../FreeBSD.2.2/src/lkm/ccd/Makefile	Fri Sep 20 18:51:11 1996
+++ Root/usr/src/lkm/ccd/Makefile	Mon Jan 13 18:58:01 1997
@@ -9,8 +9,18 @@
 
 NCCD?=          4
 CLEANFILES+=    ccd.h vnode_if.h vnode_if.c
+LN              = ln -f -s
 
 ccd.h:
 	echo "#define NCCD ${NCCD}" > ccd.h
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/cd9660/Makefile Root/usr/src/lkm/cd9660/Makefile
--- ../FreeBSD.2.2/src/lkm/cd9660/Makefile	Wed Sep 21 16:27:03 1994
+++ Root/usr/src/lkm/cd9660/Makefile	Mon Jan 13 18:58:01 1997
@@ -6,6 +6,16 @@
 	cd9660_util.c cd9660_vfsops.c cd9660_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DCD9660
+CFLAGS+= -DCD9660 -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/coff/Makefile Root/usr/src/lkm/coff/Makefile
--- ../FreeBSD.2.2/src/lkm/coff/Makefile	Thu Oct 27 16:39:19 1994
+++ Root/usr/src/lkm/coff/Makefile	Mon Jan 13 18:58:01 1997
@@ -6,5 +6,15 @@
 NOMAN=
 CLEANFILES+= vnode_if.h vnode_if.c
 CFLAGS+= -DLKM -I. -DCOMPAT_IBCS2
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/fdesc/Makefile Root/usr/src/lkm/fdesc/Makefile
--- ../FreeBSD.2.2/src/lkm/fdesc/Makefile	Wed Sep 21 16:27:05 1994
+++ Root/usr/src/lkm/fdesc/Makefile	Mon Jan 13 18:58:01 1997
@@ -5,6 +5,16 @@
 SRCS=	fdesc_vfsops.c fdesc_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DFDESC
+CFLAGS+= -DFDESC -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/ibcs2/Makefile Root/usr/src/lkm/ibcs2/Makefile
--- ../FreeBSD.2.2/src/lkm/ibcs2/Makefile	Sun Sep 22 14:56:45 1996
+++ Root/usr/src/lkm/ibcs2/Makefile	Mon Jan 13 18:58:01 1997
@@ -10,11 +10,22 @@
 MAN8=	ibcs2.8
 
 CFLAGS+= -DLKM -I. -DCOMPAT_IBCS2
+LN              = ln -f -s
+
 CLEANFILES+= vnode_if.h vnode_if.c
 EXPORT_SYMS= _ibcs2_mod _ibcs2_emul_path _ibcs2_svr3_sysvec
 
 afterinstall:
 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
 	${.CURDIR}/ibcs2 ${DESTDIR}/usr/bin
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/if_disc/Makefile Root/usr/src/lkm/if_disc/Makefile
--- ../FreeBSD.2.2/src/lkm/if_disc/Makefile	Mon Mar 20 11:25:46 1995
+++ Root/usr/src/lkm/if_disc/Makefile	Mon Jan 13 18:58:02 1997
@@ -6,6 +6,7 @@
 NOMAN=
 PSEUDO_LKM=
 CFLAGS+= -I.
+LN              = ln -f -s
 
 NBPFILTER?=	0
 PROTOS?=	-DINET
@@ -15,5 +16,14 @@
 
 bpfilter.h:
 	echo "#define NBPFILTER ${NBPFILTER}" > bpfilter.h
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/if_ppp/Makefile Root/usr/src/lkm/if_ppp/Makefile
--- ../FreeBSD.2.2/src/lkm/if_ppp/Makefile	Tue Oct 31 12:54:15 1995
+++ Root/usr/src/lkm/if_ppp/Makefile	Mon Jan 13 18:58:02 1997
@@ -6,6 +6,7 @@
 NOMAN=
 PSEUDO_LKM=
 CFLAGS+= -I.
+LN              = ln -f -s
 
 NBPFILTER?=	0
 NPPP?=		2
@@ -19,5 +20,14 @@
 
 ppp.h:
 	echo "#define NPPP ${NPPP}" > ppp.h
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/if_sl/Makefile Root/usr/src/lkm/if_sl/Makefile
--- ../FreeBSD.2.2/src/lkm/if_sl/Makefile	Mon Mar 20 11:31:47 1995
+++ Root/usr/src/lkm/if_sl/Makefile	Mon Jan 13 18:58:02 1997
@@ -6,6 +6,7 @@
 NOMAN=
 PSEUDO_LKM=
 CFLAGS+= -I.
+LN              = ln -f -s
 
 NBPFILTER?=	0
 NSL?=		2
@@ -19,5 +20,14 @@
 
 sl.h:
 	echo "#define NSL ${NSL}" > sl.h
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/if_tun/Makefile Root/usr/src/lkm/if_tun/Makefile
--- ../FreeBSD.2.2/src/lkm/if_tun/Makefile	Mon Mar 20 11:25:49 1995
+++ Root/usr/src/lkm/if_tun/Makefile	Mon Jan 13 18:58:02 1997
@@ -6,6 +6,7 @@
 NOMAN=
 PSEUDO_LKM=
 CFLAGS+= -I.
+LN              = ln -f -s
 
 NBPFILTER?=	0
 NTUN?=		2
@@ -19,5 +20,14 @@
 
 tun.h:
 	echo "#define NTUN ${NTUN}" > tun.h
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/ipfw/Makefile Root/usr/src/lkm/ipfw/Makefile
--- ../FreeBSD.2.2/src/lkm/ipfw/Makefile	Sun Jun 23 07:27:52 1996
+++ Root/usr/src/lkm/ipfw/Makefile	Mon Jan 13 18:58:02 1997
@@ -4,11 +4,21 @@
 KMOD=	ipfw_mod
 SRCS=	ip_fw.c
 NOMAN=
-CFLAGS+= -DIPFIREWALL -DIPFIREWALL_MODULE
+CFLAGS+= -I. -DIPFIREWALL -DIPFIREWALL_MODULE
 #
 #If you want it verbose
 #CFLAGS+= -DIPFIREWALL_VERBOSE
 #CFLAGS+= -DIPFIREWALL_VERBOSE_LIMIT=100
 #
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/joy/Makefile Root/usr/src/lkm/joy/Makefile
--- ../FreeBSD.2.2/src/lkm/joy/Makefile	Sun Sep 22 14:56:49 1996
+++ Root/usr/src/lkm/joy/Makefile	Mon Jan 13 18:58:02 1997
@@ -7,6 +7,7 @@
 
 CFLAGS		+= -I. -DJOY_MODULE
 CLEANFILES	+= joy.h
+LN              = ln -f -s
 
 joy.h:
 	echo "#define NJOY 1" > joy.h
@@ -15,5 +16,14 @@
 afterinstall:
 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
 	${.CURDIR}/joy ${DESTDIR}/usr/bin
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/kernfs/Makefile Root/usr/src/lkm/kernfs/Makefile
--- ../FreeBSD.2.2/src/lkm/kernfs/Makefile	Wed Sep 21 16:27:06 1994
+++ Root/usr/src/lkm/kernfs/Makefile	Mon Jan 13 18:58:02 1997
@@ -5,6 +5,16 @@
 SRCS=	kernfs_vfsops.c kernfs_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DKERNFS
+CFLAGS+= -DKERNFS -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/linux/Makefile Root/usr/src/lkm/linux/Makefile
--- ../FreeBSD.2.2/src/lkm/linux/Makefile	Tue Jun 25 13:13:12 1996
+++ Root/usr/src/lkm/linux/Makefile	Mon Jan 13 18:58:03 1997
@@ -36,4 +36,9 @@
 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
 		${.CURDIR}/linux ${DESTDIR}/usr/bin
 
+.if defined(DESTDIR)
+depend:
+	touch .depend
+.endif
+
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/msdos/Makefile Root/usr/src/lkm/msdos/Makefile
--- ../FreeBSD.2.2/src/lkm/msdos/Makefile	Fri Mar  3 10:33:04 1995
+++ Root/usr/src/lkm/msdos/Makefile	Mon Jan 13 18:58:03 1997
@@ -6,6 +6,16 @@
 	msdosfs_vfsops.c msdosfs_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DMSDOSFS
+CFLAGS+= -DMSDOSFS -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/nfs/Makefile Root/usr/src/lkm/nfs/Makefile
--- ../FreeBSD.2.2/src/lkm/nfs/Makefile	Thu Sep 22 15:12:59 1994
+++ Root/usr/src/lkm/nfs/Makefile	Mon Jan 13 18:58:03 1997
@@ -6,6 +6,16 @@
         nfs_srvcache.c nfs_subs.c nfs_syscalls.c nfs_vfsops.c nfs_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DNFS -DINET
+CFLAGS+= -DNFS -DINET -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/nullfs/Makefile Root/usr/src/lkm/nullfs/Makefile
--- ../FreeBSD.2.2/src/lkm/nullfs/Makefile	Wed Sep 21 16:27:10 1994
+++ Root/usr/src/lkm/nullfs/Makefile	Mon Jan 13 18:58:03 1997
@@ -5,6 +5,16 @@
 SRCS=	null_subr.c null_vfsops.c null_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DNULLFS
+CFLAGS+= -DNULLFS -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/pcic/Makefile Root/usr/src/lkm/pcic/Makefile
--- ../FreeBSD.2.2/src/lkm/pcic/Makefile	Sun Oct 15 10:00:49 1995
+++ Root/usr/src/lkm/pcic/Makefile	Mon Jan 13 18:58:03 1997
@@ -5,6 +5,16 @@
 SRCS=   pcic.c
 NOMAN=
 PSEUDO_LKM=
-CFLAGS+= -DLKM
+CFLAGS+= -I. -DLKM
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/portal/Makefile Root/usr/src/lkm/portal/Makefile
--- ../FreeBSD.2.2/src/lkm/portal/Makefile	Wed Sep 21 16:27:12 1994
+++ Root/usr/src/lkm/portal/Makefile	Mon Jan 13 18:58:03 1997
@@ -5,6 +5,16 @@
 SRCS=	portal_vfsops.c portal_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DPORTAL
+CFLAGS+= -DPORTAL -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/procfs/Makefile Root/usr/src/lkm/procfs/Makefile
--- ../FreeBSD.2.2/src/lkm/procfs/Makefile	Tue Jun 18 09:58:44 1996
+++ Root/usr/src/lkm/procfs/Makefile	Mon Jan 13 19:00:23 1997
@@ -6,6 +6,16 @@
 	procfs_type.c procfs_vfsops.c procfs_vnops.c
 NOMAN=
 VFS_LKM=
-CFLAGS+= -DPROCFS
+CFLAGS+= -DPROCFS -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/qcam/Makefile Root/usr/src/lkm/qcam/Makefile
--- ../FreeBSD.2.2/src/lkm/qcam/Makefile	Sun Sep 22 14:56:54 1996
+++ Root/usr/src/lkm/qcam/Makefile	Mon Jan 13 18:58:04 1997
@@ -7,6 +7,7 @@
 
 CFLAGS		+= -I. -DQCAM_MODULE
 CLEANFILES	+= qcam.h
+LN              = ln -f -s
 
 qcam.h:
 	echo "#define NQCAM 1" > qcam.h
@@ -14,5 +15,14 @@
 afterinstall:
 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
 	${.CURDIR}/qcam ${DESTDIR}/usr/bin
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/syscons/blank/Makefile Root/usr/src/lkm/syscons/blank/Makefile
--- ../FreeBSD.2.2/src/lkm/syscons/blank/Makefile	Sun Oct  6 15:16:52 1996
+++ Root/usr/src/lkm/syscons/blank/Makefile	Mon Jan 13 18:58:04 1997
@@ -4,6 +4,16 @@
 SRCS= 	blank_saver.c
 
 NOMAN=
-CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+CFLAGS+= -I. -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys 
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/syscons/fade/Makefile Root/usr/src/lkm/syscons/fade/Makefile
--- ../FreeBSD.2.2/src/lkm/syscons/fade/Makefile	Sun Oct  6 15:16:57 1996
+++ Root/usr/src/lkm/syscons/fade/Makefile	Mon Jan 13 18:58:04 1997
@@ -4,6 +4,16 @@
 SRCS= 	fade_saver.c
 
 NOMAN=
-CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+CFLAGS+= -I. -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys 
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/syscons/green/Makefile Root/usr/src/lkm/syscons/green/Makefile
--- ../FreeBSD.2.2/src/lkm/syscons/green/Makefile	Sun Oct  6 15:17:02 1996
+++ Root/usr/src/lkm/syscons/green/Makefile	Mon Jan 13 18:58:04 1997
@@ -4,6 +4,16 @@
 SRCS= 	green_saver.c
 
 NOMAN=
-CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+CFLAGS+= -I. -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys 
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/syscons/snake/Makefile Root/usr/src/lkm/syscons/snake/Makefile
--- ../FreeBSD.2.2/src/lkm/syscons/snake/Makefile	Sun Oct  6 15:17:10 1996
+++ Root/usr/src/lkm/syscons/snake/Makefile	Mon Jan 13 18:58:04 1997
@@ -4,6 +4,16 @@
 SRCS= 	snake_saver.c
 
 NOMAN=
-CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+CFLAGS+= -I. -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/syscons/star/Makefile Root/usr/src/lkm/syscons/star/Makefile
--- ../FreeBSD.2.2/src/lkm/syscons/star/Makefile	Sun Oct  6 15:17:12 1996
+++ Root/usr/src/lkm/syscons/star/Makefile	Mon Jan 13 19:00:23 1997
@@ -4,6 +4,16 @@
 SRCS= 	star_saver.c
 
 NOMAN=
-CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+CFLAGS+= -I. -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/umapfs/Makefile Root/usr/src/lkm/umapfs/Makefile
--- ../FreeBSD.2.2/src/lkm/umapfs/Makefile	Wed Sep 21 16:27:14 1994
+++ Root/usr/src/lkm/umapfs/Makefile	Mon Jan 13 19:14:57 1997
@@ -5,6 +5,16 @@
 SRCS=	umap_subr.c umap_vfsops.c umap_vnops.c
 NOMAN=
 VFS_LKM= yes
-CFLAGS+= -DUMAPFS
+CFLAGS+= -DUMAPFS -I.
+LN              = ln -f -s
+
+.c.o:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>
diff -r -u ../FreeBSD.2.2/src/lkm/wcd/Makefile Root/usr/src/lkm/wcd/Makefile
--- ../FreeBSD.2.2/src/lkm/wcd/Makefile	Sun Oct  6 15:17:16 1996
+++ Root/usr/src/lkm/wcd/Makefile	Mon Jan 13 19:14:57 1997
@@ -25,8 +25,12 @@
 		echo "#define ATAPI 1"> opt_atapi.h
 
 .c.o:
-		-@$(LN) /sys/i386/include machine
-		$(CC) $(CFLAGS) -c $<
-		-@rm -f machine
+	$(LN) ${DESTDIR}/sys/i386/include machine
+	$(CC) $(CFLAGS) -c $<
+
+.if defined(DESTDIR)
+beforedepend:
+	$(LN) ${DESTDIR}/sys/i386/include machine
+.endif
 
 .include <bsd.kmod.mk>

The next three files have local definitions of malloc that conflict with
the one in stdlib.h. I don't know why they cause problems when built this
way and not the traditional way... but it's wrong anyway.

diff -r -u ../FreeBSD.2.2/src/usr.bin/fmt/fmt.c Root/usr/src/usr.bin/fmt/fmt.c
--- ../FreeBSD.2.2/src/usr.bin/fmt/fmt.c	Tue Sep 10 12:50:23 1996
+++ Root/usr/src/usr.bin/fmt/fmt.c	Mon Jan 13 21:31:21 1997
@@ -70,7 +70,7 @@
 int	mark;			/* Last place we saw a head line */
 int	center;
 
-char	*malloc();		/* for lint . . . */
+
 char	*headnames[] = {"To", "Subject", "Cc", 0};
 
 /*
diff -r -u ../FreeBSD.2.2/src/usr.bin/more/main.c Root/usr/src/usr.bin/more/main.c
--- ../FreeBSD.2.2/src/usr.bin/more/main.c	Sun Aug 11 09:22:47 1996
+++ Root/usr/src/usr.bin/more/main.c	Mon Jan 13 21:32:23 1997
@@ -342,7 +342,7 @@
 save(s)
 	char *s;
 {
-	char *p, *strcpy(), *malloc();
+	char *p, *strcpy();
 
 	p = malloc((u_int)strlen(s)+1);
 	if (p == NULL)
diff -r -u ../FreeBSD.2.2/src/usr.sbin/arp/arp.c Root/usr/src/usr.sbin/arp/arp.c
--- ../FreeBSD.2.2/src/usr.sbin/arp/arp.c	Thu Feb  8 13:05:52 1996
+++ Root/usr/src/usr.sbin/arp/arp.c	Mon Jan 13 21:33:08 1997
@@ -379,7 +379,7 @@
 {
 	int mib[6];
 	size_t needed;
-	char *host, *malloc(), *lim, *buf, *next;
+	char *host, *lim, *buf, *next;
 	struct rt_msghdr *rtm;
 	struct sockaddr_inarp *sin;
 	struct sockaddr_dl *sdl;

This file just has a bug in it (How did it *ever* work?) resolver.3 is in a
subdirectory.

diff -r -u ../FreeBSD.2.2/src/lib/libc/net/Makefile.inc Root/usr/src/lib/libc/net/Makefile.inc
--- ../FreeBSD.2.2/src/lib/libc/net/Makefile.inc	Mon Dec 30 04:35:19 1996
+++ Root/usr/src/lib/libc/net/Makefile.inc	Mon Jan 13 11:57:33 1997
@@ -21,7 +21,7 @@
 MAN3+=	net/addr2ascii.3 \
 	net/byteorder.3 net/ethers.3 net/gethostbyname.3 net/getnetent.3 \
 	net/getprotoent.3 net/getservent.3 net/inet.3 net/linkaddr.3 \
-	net/rcmd.3 resolver.3
+	net/rcmd.3 net/resolver.3
 
 # not installed: net/ns.3 net/iso_addr.3
 
This file has DESTDIR mis-spelled.

diff -r -u ../FreeBSD.2.2/src/lib/libc/yp/Makefile.inc Root/usr/src/lib/libc/yp/Makefile.inc
--- ../FreeBSD.2.2/src/lib/libc/yp/Makefile.inc	Wed Dec 13 21:16:43 1995
+++ Root/usr/src/lib/libc/yp/Makefile.inc	Mon Jan 13 11:52:34 1997
@@ -7,7 +7,7 @@
 SRCS+=		xdryp.c yp_xdr.c yplib.c
 CLEANFILES+=	yp_xdr.c yp.h
 
-RPCSRC= ${.DESTDIR}/usr/include/rpcsvc/yp.x
+RPCSRC= ${DESTDIR}/usr/include/rpcsvc/yp.x
 RPCGEN= rpcgen
 
 yp_xdr.c: ${RPCSRC} yp.h
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701141416.GAA21689>