Re: [GRASS-dev] cp -r vs -R in make

2016-01-26 Thread Glynn Clements

Anna Petrášová wrote:

> cp: the -H, -L, and -P options may not be specified with the -r option.
> 
> make: *** [install] Error 1
> 
> 
> It seems cp -r (lowercase r) is not portable, see [1]. Mac cp man page says:
> 
> Historic versions of the cp utility had a -r option. This implementation
> supports that option; how-ever, however, ever, its use is strongly
> discouraged, as it does not correctly copy special files, symbolic links,
> or fifo's.
> 
> lowercase r is used on couple of places, mainly include/Make/Install.make.
> So my question is if anyone thinks there are some valid reasons for using
> lowercase r.

"cp" probably shouldn't be used at all.

Executable files should be installed with $(INSTALL), non-executable
files with $(INSTALL_DATA).

In either case, they should only be used to copy a rule's prerequisite
to its target (i.e. no unconditional "bulk" copies in the body of an
unrelated rule), as in:

destination: source
$(INSTALL_DATA) $< $@

If the number of files is large, $(wildcard ...) and $(patsubst ...) 
should be used to construct a list of targets which should then be
made prerequisites of the Makefile's "default" rule, with the
installation performed by a pattern rule.

The only places "cp" is used in the actual GRASS source tree (not
including "addons") are in Install.make, the "install" targets of a
couple of other *.make files, and the "update-po" target in
locale/Makefile. None of these are part of the actual build process.

(I just removed the one in simlib; Rules.make already has a pattern
rule for installing headers).

FWIW, the "portable" solution for recursive copies has historically
been to use "tar c ... | tar x ...".

-- 
Glynn Clements 
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] cp -r vs -R in make

2016-01-26 Thread Anna Petrášová
On Tue, Jan 26, 2016 at 7:28 AM, Glynn Clements 
wrote:

>
> Anna Petrášová wrote:
>
> > cp: the -H, -L, and -P options may not be specified with the -r option.
> >
> > make: *** [install] Error 1
> >
> >
> > It seems cp -r (lowercase r) is not portable, see [1]. Mac cp man page
> says:
> >
> > Historic versions of the cp utility had a -r option. This implementation
> > supports that option; how-ever, however, ever, its use is strongly
> > discouraged, as it does not correctly copy special files, symbolic links,
> > or fifo's.
> >
> > lowercase r is used on couple of places, mainly
> include/Make/Install.make.
> > So my question is if anyone thinks there are some valid reasons for using
> > lowercase r.
>
> "cp" probably shouldn't be used at all.
>
> Executable files should be installed with $(INSTALL), non-executable
> files with $(INSTALL_DATA).
>
> In either case, they should only be used to copy a rule's prerequisite
> to its target (i.e. no unconditional "bulk" copies in the body of an
> unrelated rule), as in:
>
> destination: source
> $(INSTALL_DATA) $< $@
>
> If the number of files is large, $(wildcard ...) and $(patsubst ...)
> should be used to construct a list of targets which should then be
> made prerequisites of the Makefile's "default" rule, with the
> installation performed by a pattern rule.
>
> The only places "cp" is used in the actual GRASS source tree (not
> including "addons") are in Install.make, the "install" targets of a
> couple of other *.make files, and the "update-po" target in
> locale/Makefile. None of these are part of the actual build process.
>
> (I just removed the one in simlib; Rules.make already has a pattern
> rule for installing headers).
>
> FWIW, the "portable" solution for recursive copies has historically
> been to use "tar c ... | tar x ...".
>

Thanks for the information on this. However, for now, I just fixed one of
the usages in Script.make (by changing -r to -R) to be able to install the
addon, since I can't fix it properly.

Anna

>
> --
> Glynn Clements 
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] cp -r vs -R in make

2016-01-25 Thread Anna Petrášová
Hi,

I just ran into a problem when compiling an addon on Mac OS X:

Compiling...

Installing...

cp: the -H, -L, and -P options may not be specified with the -r option.

make: *** [install] Error 1


It seems cp -r (lowercase r) is not portable, see [1]. Mac cp man page says:

Historic versions of the cp utility had a -r option. This implementation
supports that option; how-ever, however, ever, its use is strongly
discouraged, as it does not correctly copy special files, symbolic links,
or fifo's.

lowercase r is used on couple of places, mainly include/Make/Install.make.
So my question is if anyone thinks there are some valid reasons for using
lowercase r.

Thanks,

Anna


[1]
http://unix.stackexchange.com/questions/18712/difference-between-cp-r-and-cp-r-copy-command
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev