Subject: make and ELF (PR bin/5445)
To: None <tech-toolchain@NetBSD.ORG>
From: Simon Burge <simonb@telstra.com.au>
List: tech-toolchain
Date: 05/13/1998 23:41:29
I've had some discussion with Christos Zoulas about PR bin/5445 with
regards to make making things unnecessarily.  It turns out that ELF
library archives don't have a __.SYMDEF member (defined as RANLIBMAG in
/usr/include/ranlib.h).  The problem is that make expects a __.SYMDEF
member in the archive, and if there isn't one there it considers the
archive out of date (because RANLIBMAG is defined unconditionally in
ranlib.h, and __ELF__ isn't defined by the pmax toolchain when make is
built).

Where do we go?  With ELF, ranlib isn't necessary.  The choice here is
to either do away with it altogether on ELF platforms, or make it a
symlink to /bin/true.  How many things (third party things) are going to
break if they think they are on a BSD-derived system without ranlib?

The variable OBJECT_FMT is defined in <bsd.own.mk> to be "ELF" or
"a.out" depending on the platform, so that's one way of determining the
current object file format.  Should __ELF__ or __AOUT__ be defined by
the compiler?  There's been much talk in the past about defining the
least number of defines as possible.

Comments on the best thing to do?  The rough idea below will at least
solve the immediate problem of make making things unnecessarily.  This
is obviously not the best solution, and anything else that includes
ranlib.h may not know about the __ELF__ define.

Simon.
--

/usr/src/include/ranlib.h:

	#if !defined(__ELF__)
	#define RANLIBMAG       "__.SYMDEF"     /* archive file name */
	#endif

/usr/src/usr.bin/make/Makefile:

	CPPFLAGS+= -I${.CURDIR}
	.if (${OBJECT_FMT} == ELF)
	CPPFLAGS+= -D__ELF__
	.endif