Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2004 15:41:04 +0200
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Garance A Drosehn <gad@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src Makefile
Message-ID:  <20040219134104.GB14981@ip.net.ua>
In-Reply-To: <p06020431bc58344f6847@[128.113.24.47]>
References:  <200402162018.i1GKIQK4029731@repoman.freebsd.org> <p06020431bc58344f6847@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help

--eJnRUKwClWJh1Khz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 17, 2004 at 04:16:34PM -0500, Garance A Drosehn wrote:
> At 12:18 PM -0800 2/16/04, Garance A Drosehn wrote:
> >gad         2004/02/16 12:18:26 PST
> >
> >  FreeBSD src repository
> >
> >  Modified files:
> >    .                    Makefile
> >  Log:
> >  Add a 'realclean' target, which simply and quickly removes
> >  everything that was built in previous 'make buildworld' and
> >  'make buildkernel'.
>=20
> Just a note on this.  The target might need some extra logic so
> it is smarter in how it handles some situations, so don't start
> using it in documentation just yet.
>=20
Sorry, I could not reply earlier, been busy with real life issues,
so I'm doing the post-commit review.  The committed version has a
number of issues, namely:

- it's dangerous -- if .OBJDIR doesn't exist, it will wipe
  away your .CURDIR (typically /usr/src) which will upset
  many people out there including myself,

- it doesn't respect the -s option of make(1) -- the "echo"
  commands should be spelled ${ECHO} to respect this (see
  how ECHO is set in sys.mk),

- (minor) it uses home-grown style (space after a colon
  after a target name, -R vs. -r for rm(1), etc.),

- the comment mostly repeats what the code does, where it
  should actually document the intent of this target, not
  the gory details of how it achives its goal.  ;)

Also, why "rm -rf ${.OBJDIR}/*" instead of "rm -rf ${.OBJDIR}"?
Is it to preserve a possibly symlinked /usr/obj?

I suggest to commit the following which fixes all but the last
issue mentioned above.

%%%
Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/Makefile,v
retrieving revision 1.293
diff -u -r1.293 Makefile
--- Makefile	16 Feb 2004 20:18:25 -0000	1.293
+++ Makefile	19 Feb 2004 12:50:04 -0000
@@ -109,14 +109,12 @@
 # The first 'rm' will usually remove all files and directories.  If
 # it does not, then there are probably some files with chflags set.
 # Unset all special chflags, and try the 'rm' a second time.
-realclean :
-	-rm -Rf ${.OBJDIR}/* 2>/dev/null
-	@-if [ "`echo ${.OBJDIR}/*`" !=3D "${.OBJDIR}/*" ] ; then \
-	    echo "chflags -R 0 ${.OBJDIR}/*" ; \
-	    chflags -R 0 ${.OBJDIR}/* ;  \
-	    echo "rm -Rf ${.OBJDIR}/*" ; \
-	    rm -Rf ${.OBJDIR}/* ; \
-	fi
+realclean:
+.if ${.OBJDIR} !=3D ${.CURDIR}
+	-rm -rf ${.OBJDIR}/* 2>/dev/null
+	-chflags -R 0 ${.OBJDIR}/.
+	rm -rf ${.OBJDIR}/*
+.endif
=20
 #
 # Handle the user-driven targets, using the source relative mk files.
%%%



Cheers,
--=20
Ruslan Ermilov
FreeBSD committer
ru@FreeBSD.org

--eJnRUKwClWJh1Khz
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFANLzwUkv4P6juNwoRAlYcAJ4kpld55dTLcbhi3/t0qneXA7yIxACdHb0u
z/1PJeUJpU6G6Y4f3toHBG4=
=zSWh
-----END PGP SIGNATURE-----

--eJnRUKwClWJh1Khz--



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