Re: [Patch] gfortran: Fix in-build-tree testing [PR101305, PR101660]
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.
Re: [Patch] gfortran: Fix in-build-tree testing [PR101305, PR101660]
On Tue, Aug 10, 2021 at 04:45:33PM +0200, Tobias Burnus wrote: > --- a/libgfortran/Makefile.am > +++ b/libgfortran/Makefile.am > @@ -1076,6 +1076,9 @@ fpu-target.inc: fpu-target.h $(srcdir)/libgfortran.h > grep '^#define GFC_FPE_' < $(top_srcdir)/../gcc/fortran/libgfortran.h > > $@ || true > grep '^#define GFC_FPE_' < $(srcdir)/libgfortran.h >> $@ || true > > +# 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. Otherwise LGTM. Jakub