Subject: Re: Makefile structure in htdocs
To: None <netbsd-docs@NetBSD.org>
From: Roland Illig <rillig@NetBSD.org>
List: netbsd-docs
Date: 10/09/2005 18:48:51
Roland Illig wrote:
> Couldn't we put the detection of the correct WEB_PREFIX into 
> share/mk/web.site.mk? That way, we would save one line in every 
> Makefile. And then, web.site.mk could also test for any Makefile.inc on 
> the way from ${.CURDIR} downto ${WEB_PREFIX}.

This patch implements the above paragraph. The only Makefile.inc that 
needs to be modified is the one in ${WEB_PREFIX}, as the others only 
contain conditional definitions.

The effect is that in every directory that includes the top-level 
Makefile.inc directly, a warning is printed. These Makefiles should then 
be converted not to include any Makefile.inc at all, as all the work 
will be done inside web.site.mk.

If this patch should be committed, the <filename>Makefile</filename>s 
and <filename>Makefile.inc</filename>s can be refactored as follows:

- The path name to web.site.mk should not use ${WEB_PREFIX}, as this 
variable will not be defined until the web.site.mk file is parsed. 
Instead, it should be written as "../../share/mk/web.site.mk" in all 
directories that are two levels under ${WEB_PREFIX}. You can guess what 
it looks like for other directories. ;)

- Any .include lines to "Makefile.inc" can be removed.

- Any "Makefile.inc" that only sets WEB_PREFIX can be removed.

When all the Makefiles are converted properly, the multiple-inclusion 
guards can be removed to make the two patched files more readable again.

Roland