Hello,
* Steffen Dettmer wrote on Wed, Feb 10, 2010 at 11:01:34AM CET:
> module=xyz
> _mak=${module}.mak
> echo "# Autogenerated by $0" > ${_mak}
> echo "${module}files = \\" >> ${_mak}
> find directoty1 directory2 directory3 -type f \
> -not -path '*/CVS*' \
With find, -not is not portable, but ! is (suitably escaped when used in
an interactive shell); -path is not portable either.
> -not -path '*/*.sw?' \
> -exec echo "{} \\" \; \
POSIX find only allows you to use {} as a single argument IIRC; you can
just pass arguments to echo separately here: `-exec echo "{}" \\ \;'.
> | sort >> ${_mak}
With sort, you should always normalize the locale, i.e.,
LC_ALL=C sort
> echo "${_mak}" >> ${_mak}
>
> Also find and friends could be used in Makefile rules but we made less
> good experiences with it; at least errors can be hard to find because
> may turn out much later and it feels "less defined" I think.
Well, don't look at the GNU find(1) manpage if you're looking for
portable options only. That's what POSIX/SUSv3 is for; the findutils
info pages are more verbose about portability, too.
Cheers,
Ralf