[Patch] gfortran: Fix in-build-tree testing [PR101305, PR101660]

Jakub Jelinek jakub@redhat.com
Tue Aug 10 15:09:55 GMT 2021


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



More information about the Gcc-patches mailing list