Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Aug 2002 13:57:19 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Szilveszter Adam <sziszi@bsd.hu>, Nik Clayton <nik@FreeBSD.org>
Cc:        "Bruce A. Mah" <bmah@FreeBSD.org>, doc@FreeBSD.org
Subject:   Re: repetitive docs install?
Message-ID:  <20020814105719.GA94060@sunbay.com>
In-Reply-To: <20020813161125.GC1105@fonix.adamsfamily.xx>
References:  <20020811225529.GH2818@vectors.cx> <20020812173917.GB2080@fonix.adamsfamily.xx> <20020812213302.GS71774@clan.nothing-going-on.org> <20020813161125.GC1105@fonix.adamsfamily.xx>

next in thread | previous in thread | raw e-mail | index | archive | help
[I am no longer subscribed to -doc because I couldn't keep up with
the increased load on the mailing lists I participate in, so I had
to leave some.  Please Cc: me if you need to.  This problem was
brought to my attention by Bruce A. Mah.]

On Tue, Aug 13, 2002 at 06:11:26PM +0200, Szilveszter Adam wrote:
> On Mon, Aug 12, 2002 at 10:33:02PM +0100, Nik Clayton wrote:
> > I'd definitely like to see the patches.  Is this a bug in the .mk files,
> > or a bug in make?
> 
> OK, find enclosed the two patches that I use at present. One is against 
> doc/share/mk/doc.subdir.mk and the other is against
> www/share/mk/web.site.mk.
> 
> As for your question, it is not a bug in make(1) but rather duplication
> in the .mk infrastructure. Earlier there was no code in
> src/share/mk/bsd.subdir.mk to recursively make the targets in
> subdirectories, rather this was implemented in other .mk files. (For the
> base system this was bsd.own.mk, for us the files referred to above).
> The MFC in rev 1.30.2.2 merged the _SUBDIR macro from bsd.own.mk into
> bsd.subdir.mk, but the doc (and www) build infrastucture was not
> changed. So, we were instructing make(1) to loop the subdirs once in
> bsd.subdir.mk (pulled in by include) and once in eg doc.subdir.mk.
> Make(1) only did what was requested. The _SUBDIRUSE macro was only
> called from the realinstall target in doc.subdir.mk, so there only "make
> install" was affected. But for the website build, the similar
> _PROGSUBDIR macro was also called from the "all" target, so there even the
> build did loop uselessly. This was all the more annoying because at
> least the "prstats" target is always rerun no matter what and takes
> quite a lot to complete.
> 
Err.  This only worked before because bsd.subdir.mk and doc.subdir.mk
had these macros named similarly, _SUBDIRUSE.  Simply renaming the
_SUBDIRUSE in doc.subdir.mk to _SUBDIR makes the observed behavior
of duplicate installs go away on RELENG_4 and HEAD.  The actual bug
is with bsd.doc.mk though, see below.

> I am not entirely sure if any other changes are needed on -STABLE, but
> the general idea is this: since we include bsd.subdir.mk, there should
> be no need for separate macros that duplicate the functionality of the
> _SUBDIR macro from there. 
> 
Not quite; there is the NOINCLUDEMK knob AFAICT, that is supposed to
make doc.*.mk infrastructure independent of bsd.*.mk.  I would suggest
that this be made a default, Nik.  It would be much easier to maintain
then.  (kmod.mk is the good example of the bsd.prog.mk derivative.)

> One problem stays, however: this has to be conditionalized, since
> earlier releases of FreeBSD, including early versions of 4.6-STABLE,
> will still need the old framework, if doc building is to be supported on
> them.
> 
This is not entirely true.  It is possible to write a version of the
below fix that will work with any 4.x bsd.*.mk, with some black magic.
I have not attempted to do it here because I think this is a bad idea;
it would be too hard to support this in the future.

I am speaking of the doc.subdir.mk only, haven't looked at web.site.mk.
I haven't also attempted to merge various bsd.obj.mk fixes here while
these are quite possible.  This fix though merges the bsd.subdir.mk
rev. 1.43 fix, e.g., realinstall bogusly attempts to run beforeinstall
now.

%%%
Index: doc.subdir.mk
===================================================================
RCS file: /home/ncvs/doc/share/mk/doc.subdir.mk,v
retrieving revision 1.9
diff -u -p -r1.9 doc.subdir.mk
--- doc.subdir.mk	13 Dec 2001 23:51:26 -0000	1.9
+++ doc.subdir.mk	14 Aug 2002 10:46:50 -0000
@@ -60,12 +60,20 @@ __initialized__:
 .endif
 
 .if !target(install)
-install: afterinstall symlinks 
-afterinstall: realinstall
-realinstall: beforeinstall _SUBDIRUSE
+.if !target(beforeinstall)
+beforeinstall:
+.endif
+.if !target(afterinstall)
+afterinstall:
+.endif
+install: beforeinstall realinstall afterinstall symlinks
+.ORDER: beforeinstall realinstall afterinstall symlinks
 .endif
 
+.if !target(package)
 package: realpackage symlinks
+.ORDER: realpackage symlinks
+.endif
 realpackage: _SUBDIRUSE
 
 .if !defined(IGNORE_COMPAT_SYMLINK) && defined(COMPAT_SYMLINK)
@@ -104,12 +112,6 @@ symlinks:
 .endif
 .endif
 
-.for __target in beforeinstall afterinstall realinstall realpackage
-.if !target(${__target})
-${__target}:
-.endif
-.endfor
-
 _SUBDIRUSE: .USE
 .for entry in ${SUBDIR}
 	@${ECHODIR} "===> ${DIRPRFX}${entry}"
@@ -130,10 +132,8 @@ _SUBDIRUSE: .USE
 ${SUBDIR}::
 	@cd ${.CURDIR}/${.TARGET} && ${MAKE} all
 
-.for __target in all cleandir lint objlink install
-.if !target(${__target})
+.for __target in all cleandir lint objlink realinstall
 ${__target}: _SUBDIRUSE
-.endif
 .endfor
 
 .if !target(obj)
@@ -184,7 +184,7 @@ clean: _SUBDIRUSE
 .endif
 .endif
 
-cleandir: cleanobj _SUBDIRUSE
+cleandir: cleanobj
 
 .endif # end of NOINCLUDEMK section
 
%%%


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

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




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