Subject: bin/3334: 'make -f Makefile.boot' in /usr/src/usr.bin/make fails
To: None <gnats-bugs@gnats.netbsd.org>
From: Brian C. Grayson <bgrayson@data.ece.utexas.edu>
List: netbsd-bugs
Date: 03/15/1997 02:24:23
>Number:         3334
>Category:       bin
>Synopsis:       'make -f Makefile.boot' in /usr/src/usr.bin/make fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 15 00:35:01 1997
>Last-Modified:
>Originator:     Brian Grayson
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        ~late Feb.
>Environment:
System: NetBSD marvin 1.2C NetBSD 1.2C (MARVIN) #18: Tue Mar  4 10:01:21 CST 1997 bgrayson@marvin:/a/orac/home/orac/src/sys/arch/i386/compile/MARVIN i386



>Description:
	Although the Makefile.boot in /usr/src/usr.bin/make is
	intended to be used only for bootstrapping, it is unfortunate
	that this Makefile can not be used on NetBSD systems.
	The fatal errors from attempting to build arch.o are:

In file included from make.h:77,
                 from arch.c:107:
/usr/include/unistd.h:170: conflicting types for `truncate'
/usr/include/sys/types.h:95: previous declaration of `truncate'
/usr/include/unistd.h:178: conflicting types for `getopt'
/usr/include/stdlib.h:150: previous declaration of `getopt'
/usr/include/unistd.h:184: conflicting types for `getsubopt'
/usr/include/stdlib.h:156: previous declaration of `getsubopt'

	These are due to the fact that 'make.h' redefines 'const'
	to be '', but only after some header files have already been
	processed.
>How-To-Repeat:
	cd /usr/src/usr.bin/make && make clean && make -f Makefile.boot
>Fix:
	I don't know what the best fix would be.  I would suggest
	having _every_ C file include "bootstrap.h" before _any_
	includes, including system headers.  If MAKE_BOOTSTRAP is
	undefined, bootstrap.h would do nothing.  Otherwise, it
	would do the things such as making const and volatile
	be ignored -- the things that are currently in
	"make.h".  I tried this out (making every C file
	include "bootstrap.h" first) and it worked, although it
	gave lots of warnings about conflicting types for memcpy,
	etc.  I then used the created bmake to re-create itself
	with the -j3 option, and it succeeded.

	This may not be the best fix, but to me it seems a bit
	better than the current situation.  Comments?
	
>Audit-Trail:
>Unformatted: