Subject: ufs includes in src/tools/compat
To: None <tech-toolchain@netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: tech-toolchain
Date: 05/07/2003 22:36:44
While building our toolchain for cross compiling from MacOS X,
I discovered a bug in the December Dev Tools supplied by apple.
[* see the end of this mail for a description of the bug]
I include patches below which work around this bug and which I think
are a cleaner construct than that which is currently in our
src/tools makefiles. Instead of symlinking the ufs include files
into the build directory when building nbinstallboot and nbmakefs,
I added reachover include files in src/tools/compat/ufs.
Could someone please review and comment on the following patch before
I commit it? (It creates new directories under src/tools/compat/ufs
in the cvs repository, so it can't be trivially backed out if its the
wrong thing.)
Darrin
--- /dev/null Thu May 8 01:00:27 2003
+++ src/tools/compat/ufs/ffs/fs.h Fri May 2 16:14:19 2003
@@ -0,1 +1,4 @@
+/* $NetBSD: $ */
+
+#include "../../../../sys/ufs/ffs/fs.h"
--- /dev/null Thu May 8 01:00:27 2003
+++ src/tools/compat/ufs/ffs/ffs_extern.h Fri May 2 16:14:14 2003
@@ -0,1 +1,4 @@
+/* $NetBSD: $ */
+
+#include "../../../../sys/ufs/ffs/ffs_extern.h"
--- /dev/null Thu May 8 01:00:27 2003
+++ src/tools/compat/ufs/ufs/ufs_bswap.h Fri May 2 16:14:04 2003
@@ -0,1 +1,4 @@
+/* $NetBSD: $ */
+
+#include "../../../../sys/ufs/ufs/ufs_bswap.h"
--- /dev/null Thu May 8 01:00:27 2003
+++ src/tools/compat/ufs/ufs/dinode.h Fri May 2 16:13:41 2003
@@ -0,1 +1,4 @@
+/* $NetBSD: $ */
+
+#include "../../../../sys/ufs/ufs/dinode.h"
--- /dev/null Thu May 8 01:00:27 2003
+++ src/tools/compat/ufs/ufs/dir.h Fri May 2 16:13:58 2003
@@ -0,0 +1,3 @@
+/* $NetBSD: $ */
+
+#include "../../../../sys/ufs/ufs/dir.h"
Index: src/tools/installboot/Makefile
===================================================================
RCS file: /cvsroot/src/tools/installboot/Makefile,v
retrieving revision 1.7
diff -u -u -r1.7 Makefile
--- src/tools/installboot/Makefile 2002/12/08 20:20:01 1.7
+++ src/tools/installboot/Makefile 2003/05/08 00:48:01
@@ -3,15 +3,7 @@
HOSTPROGNAME= ${_TOOL_PREFIX}installboot
HOST_SRCDIR= usr.sbin/installboot
-DPSRCS+= ufs.stamp
HOST_CPPFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../mips-elf2ecoff
-CLEANFILES+= ufs
.include "${.CURDIR}/../Makefile.host"
-$(OBJS): ufs.stamp
-
-ufs.stamp:
- -rm -f ufs
- ln -f -s ${.CURDIR}/../../sys/ufs ufs
- @touch $@
Index: src/tools/makefs/Makefile
===================================================================
RCS file: /cvsroot/src/tools/makefs/Makefile,v
retrieving revision 1.6
diff -u -u -r1.6 Makefile
--- src/tools/makefs/Makefile 2002/12/08 20:20:02 1.6
+++ src/tools/makefs/Makefile 2003/05/08 00:48:01
@@ -3,15 +3,7 @@
HOSTPROGNAME= ${_TOOL_PREFIX}makefs
HOST_SRCDIR= usr.sbin/makefs
-DPSRCS+= ufs.stamp
HOST_CPPFLAGS+= -I.
-CLEANFILES+= ufs
.include "${.CURDIR}/../Makefile.host"
-$(OBJS): ufs.stamp
-
-ufs.stamp:
- -rm -f ufs
- ln -f -s ${.CURDIR}/../../sys/ufs ufs
- @touch $@
[*] When using cc -no-cpp-precomp, apple's dev tools will
prefer subdirectories of /usr/include over directories
symlinked into the current directory, even with -I.
The bug in apple's compiler can be demonstrated as such:
$ mkdir foo
$ touch foo/time.h
$ ln -s foo sys
$ echo "#include <sys/time.h>" > testme.c
$ cc -E -no-cpp-precomp -I. testme.c
You will notice from the resulting output that it is including
/usr/include/sys/time.h rather than ./sys/time.h.
Invoking the compiler without -no-cpp-precomp does not
produce the problem.
Darrin