diff mbox series

libgfortran: Makefile fix for ISO_Fortran_binding.h

Message ID b5704e7e-ea05-382a-2201-1072524d7964@codesourcery.com
State New
Headers show
Series libgfortran: Makefile fix for ISO_Fortran_binding.h | expand

Commit Message

Tobias Burnus Sept. 7, 2021, 2:13 p.m. UTC
Since the last libgfortran/Makefile.am commit,
   https://gcc.gnu.org/g:13beaf9e8d2d8264c0ad8f6504793fdcf26f3f73
the ISO_Fortran_binding.h file is no longer copied to
$(build)/.../libgfortran/include/ – which breaks in-build-tree testing.

The Makefile does contain the rule:

    ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h

but make does not regard this as invitation to copy it from $srcdir to $build
but just prints:

make: Circular $(srcdir)/ISO_Fortran_binding.h <- $(srcdir)/ISO_Fortran_binding.h dependency dropped.

As we do not actually need the ISO_Fortran_binding.h file in
the $build directory (we just want to have it ready at
$build/include/ for the testsuite runs), the following patch
avoids an extra file in $build and also solves the dependency issue.

I intent to commit it later as obvious, unless anyone has
concerns, comments or a better suggestion.

Tobias

PS: Due to 'gfor_c_HEADERS = ISO_Fortran_binding.h', the 'make install'
file is copied from $srcdir, but that's fine and copying it from
$build/include/ is neither better nor worse.

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

Comments

Tobias Burnus Sept. 7, 2021, 3:47 p.m. UTC | #1
Now committed as r12-3384-gfc4f0631de806c89a383fd02428a16e91068b9f6

Sorry for the breakage – and thanks for the report on IRC, Richard!

Tobias

On 07.09.21 16:13, Tobias Burnus wrote:
> Since the last libgfortran/Makefile.am commit,
>   https://gcc.gnu.org/g:13beaf9e8d2d8264c0ad8f6504793fdcf26f3f73
> the ISO_Fortran_binding.h file is no longer copied to
> $(build)/.../libgfortran/include/ – which breaks in-build-tree testing.
>
> The Makefile does contain the rule:
>
>    ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h
>
> but make does not regard this as invitation to copy it from $srcdir to
> $build
> but just prints:
>
> make: Circular $(srcdir)/ISO_Fortran_binding.h <-
> $(srcdir)/ISO_Fortran_binding.h dependency dropped.
>
> As we do not actually need the ISO_Fortran_binding.h file in
> the $build directory (we just want to have it ready at
> $build/include/ for the testsuite runs), the following patch
> avoids an extra file in $build and also solves the dependency issue.
>
> I intent to commit it later as obvious, unless anyone has
> concerns, comments or a better suggestion.
>
> Tobias
>
> PS: Due to 'gfor_c_HEADERS = ISO_Fortran_binding.h', the 'make install'
> file is copied from $srcdir, but that's fine and copying it from
> $build/include/ is neither better nor worse.
>
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
diff mbox series

Patch

libgfortran: Makefile fix for ISO_Fortran_binding.h

libgfortran/ChangeLog:

	* Makefile.am (gfor_built_src): Depend on
	include/ISO_Fortran_binding.h not on ISO_Fortran_binding.h.
	(ISO_Fortran_binding.h): Rename make target to ...
	(include/ISO_Fortran_binding.h): ... this.
	* Makefile.in: Regenerate.

diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 366198b5938..008f2e7549c 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -817,7 +817,7 @@  gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
     $(i_pow_c) $(i_pack_c) $(i_unpack_c) $(i_matmulavx128_c) \
     $(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \
     $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h fpu-target.inc \
-    ISO_Fortran_binding.h \
+    include/ISO_Fortran_binding.h \
     $(i_cshift1a_c) $(i_maxloc0s_c) $(i_minloc0s_c) $(i_maxloc1s_c) \
     $(i_minloc1s_c) $(i_maxloc2s_c) $(i_minloc2s_c) $(i_maxvals_c) \
     $(i_maxval0s_c) $(i_minval0s_c) $(i_maxval1s_c) $(i_minval1s_c) \
@@ -1076,15 +1076,13 @@  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
+# Place ISO_Fortran_binding.h 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.h
+include/ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h
 	-rm -f $@
-	cp $(srcdir)/ISO_Fortran_binding.h $@
 	$(MKDIR_P) include
-	-rm -f include/ISO_Fortran_binding.h
-	cp $@ include/ISO_Fortran_binding.h
+	cp $(srcdir)/ISO_Fortran_binding.h $@
 
 ## A 'normal' build shouldn't need to regenerate these
 ## so we only include them in maintainer mode
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index a3cb6f4c5ca..5dac04e171e 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -1382,7 +1382,7 @@  gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
     $(i_pow_c) $(i_pack_c) $(i_unpack_c) $(i_matmulavx128_c) \
     $(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \
     $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h fpu-target.inc \
-    ISO_Fortran_binding.h \
+    include/ISO_Fortran_binding.h \
     $(i_cshift1a_c) $(i_maxloc0s_c) $(i_minloc0s_c) $(i_maxloc1s_c) \
     $(i_minloc1s_c) $(i_maxloc2s_c) $(i_minloc2s_c) $(i_maxvals_c) \
     $(i_maxval0s_c) $(i_minval0s_c) $(i_maxval1s_c) $(i_minval1s_c) \
@@ -7042,15 +7042,13 @@  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
+# Place ISO_Fortran_binding.h 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.h
+include/ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding.h
 	-rm -f $@
-	cp $(srcdir)/ISO_Fortran_binding.h $@
 	$(MKDIR_P) include
-	-rm -f include/ISO_Fortran_binding.h
-	cp $@ include/ISO_Fortran_binding.h
+	cp $(srcdir)/ISO_Fortran_binding.h $@
 
 @MAINTAINER_MODE_TRUE@$(i_all_c): m4/all.m4 $(I_M4_DEPS2)
 @MAINTAINER_MODE_TRUE@	$(M4) -Dfile=$@ -I$(srcdir)/m4 all.m4 > $@