Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 May 1998 01:36:32 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        current@FreeBSD.ORG
Cc:        committers@FreeBSD.ORG
Subject:   elf vs. bsd.*.mk
Message-ID:  <199805301736.BAA24556@spinner.netplex.com.au>

next in thread | raw e-mail | index | archive | help
I've been having a good fight trying to get the world and all the 
permutations of the binary formats doing something sensible.

Along the way I've found some things in the *.mk files which scare the 
hell out of me.

For starters, sys.mk is automatically pulled in at make(1) startup time to 
setup the base, posix and generally widely accepted default rules and 
variables.

However, at the end, it's now pulling in bsd.own.mk and /etc/make.conf (!).
This is polluting the default make environment up with all sorts of crap.  
Sure, it means more when the .include <bsd.*.mk> stuff is activated at the 
end, but there's no reason for it to be there when using non-bmake  
Makefiles.

The reason I ran into this was because there are certain things in the 
tree that *must* be compiled with a given object format and cannot use the 
system default - eg: the a.out ld.so must be a.out, libgcc.a needs to be 
compiled twice, once in a.out and once in elf format etc.

Ideally, this could be fixed by overriding things in the Makefile, eg: 
sticking in a BINFORMAT=elf or BINFORMAT=aout as needed..  But at that 
point, it's too late as certain .ifs have already been "done" in 
bsd.own.mk (LIBDIR in particular).

The other *BSD's don't have this problem.  They pull in make.conf in 
bsd.own.mk, and all the public bsd.{prog,lib,doc,..etc..}.mk files are 
responsible for pulling in bsd.own.mk (instead of sys.mk).  This means 
that STRIP, BINOWN etc are not defined until the bsd.prog.mk (or whatever) 
pulls it in.

This is actually not much of a problem, except for a few cases where 
things like usr.bin/strip/Makefile do conditional rules based on variables 
that are not yet defined and hence don't work.  A simple reordering of 
rules fixes it.

Anyway, I manged to get it (pretty much) working although it nearly cost 
me my remaining sanity.  I've now got the world building again, although I 
know of a handful of minor problems still.

However, I've just realized another way of doing it that doesn't cause 
such a dramatic disturbance to the *.mk files, and hence is less likely to 
badly break things....  and is much simpler (damn!!!!!).

So, I thought I'd see what general feelings were on the subject.  Do we 
really want things like ${LIBDIR} defined for *all* makefiles, including 
non bsd.prog.mk etc Makefiles.  Also, make.conf is also globally visible 
as well.  I'm sure this can't be good for posix compliance etc.  Since 
I've finished 95% of the work so far, should I press on and clean up the 
loose ends, or should I put it in the 'too hard' basket for the time being 
and try the simple way out :-).

Cheers,
-Peter




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



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