Yasuhito FUTATSUKI wrote on Fri, Nov 29, 2019 at 00:15:48 +0900:
> Hi, while I do 'make distclean', I find odd `find' usage.
> 
> In Makefile.in:
> > gcov-clean:
> >     rm -f gcov-lcov.dat gcov-lcov.log gcov-genhtml.log
> >     rm -rf gcov-report
> >     find . -name "*.gcda" -o -name "*.gcno" -exec rm -f -- {} \;
> 
> Is it intended below ?
>     find . \( -name  "*.gcda" -o -name "*.gcno" \) -exec rm -f -- {}\;

I believe so, yes.  Good catch.

> I also want to insert `-name ".svn" -prune -or ' to avoid searching
> files into metadata directory in working copy, for I can find it
> because it takes long time to execute gov-clean target on my jalopy
> computer :)

Is -prune portable?  I don't see it in the POSIX spec of find(1).

Is there a way to avoid find(1) altogether here?  For example, by skipping this
block when gcov hasn't been run, or by hardcoding glob patterns to gcda/gcno
files, etc?

Would the following be correct? —
.
    if test -e gcov-report; then
        find . \( -name "*.gcda" -o -name "*.gcno" \) -exec rm -f -- {} \;
        rm -rf gcov-report
    fi

I deliberately did the «rm» after the «find» to make the target
interruptible/restartable.

Alternatively, you could sidestep the problem entirely by doing an out-of-tree
build and then just rm -rf the builddir.  (I always do out-of-tree builds with
the build tree on a ramdisk; it's far faster this way.  That used to be 
documented
on http://wiki.apache.org/subversion/BuildNotes, but I'm not sure if that link's
still valid — it just gives me a login prompt now ☹)

Cheers,

Daniel

Reply via email to