Subject: Re: sanitising make(1) variable overrides
To: None <tech-userlevel@netbsd.org>
From: Luke Mewburn <lukem@cs.rmit.edu.au>
List: tech-userlevel
Date: 02/11/1999 14:33:00
A couple of weeks ago I suggested cleaning up the make(1) variable
overrides (those that generally start with `NO...').

The purpose of this is that it allows the Makefiles to set NOxxx
as they currently do, and users should instead set MKxxx=no
in /etc/mk.conf or on the make(1) command line (so that a user can
do a per-make override without having to edit /etc/mk.conf)

Here's the current status:

The following variables are now supported for users to define in
/etc/mk.conf and on the make(1) command line (all of which should
be either "yes" or "no"):
	MKCATPAGES	if "no", don't build or install the catman pages
	MKDOC		if "no", don't build or install the documentation
	MKLINKLIB	if "no", don't build or install the *.a libraries
			(including the profiling libraries)
	MKLINT		if "no", don't build or install the lint libraries
	MKMAN		if "no", don't build or install the man or catman pages
	MKNLS		if "no", don't build or install the NLS files
	MKOBJ		if "no", don't create objdirs
	MKPIC		if "no", don't build or install shared libraries
	MKPICINSTALL	if "no", don't install the *_pic.a libraries
	MKPROFILE	if "no", don't build or install the profiling libraries
	MKSHARE		if "no", set MKDOC=no, MKMAN=no, MKNLS=no

Except for MKCATPAGES, if NOxxx is defined it forces MKxxx=no.

All of the other <*.mk> files have been modified as necessary to test
against ${MKxxx}=="no" instead of defined(NOxxx). All tests are
against == "no" or != "no", for consistency.


At this time, the user settings of LDSTATIC are:
	LDSTATIC=-static	build all the tree static
	LDSTATIC=		build all the tree dynamic
	!defined(LDSTATIC)	build most the tree dynamic, except
				for where there's overrides (e.g, /bin)

The problem here is that there's one variable to perform the following:
	* building the entire tree dynamic, unless overridden by parts of
	  the tree, depending upon the setting of LDSTATIC (default)
	* building the entire tree dynamic, irregardless of Makefile
	* building the entire tree static, irregardless of Makefile
	* indicate to the link how to statically link

Solving this is a bit tricky. This might work:
	MKSTATIC	if "no", build all dynamic (default)
			if "yes, build all static
			Makefiles should override with MKSTATIC?=yes
			will need various Makefiles changed from
			setting LDSTATIC

	LDFLAGS		gets -static added if MKSTATIC!="yes"



I can't see any problem with doing all the changes (except for the
LDSTATIC stuff).

Comments/thoughts?