Hello,

On Tue, 10 Aug 2021, Jakub Jelinek via Gcc-patches wrote:

> > +# Place ISO_Fortran_binding.h also under include/ in the build directory 
> > such
> > +# that it can be used for in-built-tree testsuite runs without 
> > interference of
> > +# other files in the build dir - like intrinsic .mod files or other .h 
> > files.
> >  ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
> >                    $(srcdir)/ISO_Fortran_binding-2-tmpl.h \
> >                    $(srcdir)/ISO_Fortran_binding-3-tmpl.h \
> > @@ -1085,6 +1088,8 @@ ISO_Fortran_binding.h: 
> > $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
> >     $(COMPILE) -E -dD $(srcdir)/ISO_Fortran_binding-2-tmpl.h \
> >     | grep '^#define CFI_type' >> $@
> >     cat $(srcdir)/ISO_Fortran_binding-3-tmpl.h >> $@
> > +   $(MKDIR_P) include
> > +   cp $@ include/ISO_Fortran_binding.h
> 
> I see many Makefile.* in GCC doing rm -f file before cp whatever file,
> but don't know if that is just trying to be extra cautious or if it is
> needed for portability.  coreutils cp (and what POSIX says) is that
> overwriting the destination file should be fine and shouldn't cause
> failures, at least when the destination is writable.

I think this is to deal cautiously with symlinks: if the destination 
filename is a symlink to an existing file that target file is overwritten 
by cp, not the symlink (which continues to point to the now changed target 
file).


Ciao,
Michael.

Reply via email to