diff mbox series

[committed] libgfortran: Partly revert my r12-6498 change to fix Solaris build [PR104006]

Message ID 20220114112146.GJ2646553@tucnak
State New
Headers show
Series [committed] libgfortran: Partly revert my r12-6498 change to fix Solaris build [PR104006] | expand

Commit Message

Jakub Jelinek Jan. 14, 2022, 11:21 a.m. UTC
Hi!

In r12-6498 I've added $(version_dep) to BUILT_SOURCES, previously version_dep
on Linux used to be a file in $(srcdir), but with my changes it is a generated
file in the object directory (preprocessed version of the $(srcdir) file)
and I thought generated files belong to BUILT_SOURCES so that they are
cleaned up etc.
For Linux that is fine, but it broke parallel builds on Solaris.
BUILT_SOURCES is a special variable for automake where automake ensures
that for make all, make check and make install all those $(BUILT_SOURCES)
are generated before actually starting building in parallel the various
object files.  That way we can avoid hacks like:
$(patsubst %.F90,%.lo,$(notdir $(filter %.F90,$(prereq_SRC)))): kinds.inc c99_protos.inc
$(patsubst %.c,%.lo,$(notdir $(filter %.c,$(prereq_SRC)))): kinds.h
$(patsubst %.f90,%.lo,selected_real_kind.f90): selected_real_kind.inc
$(patsubst %.f90,%.lo,selected_int_kind.f90): selected_int_kind.inc
$(patsubst %.F90,%.lo,ieee_exceptions.F90): fpu-target.inc
$(patsubst %.F90,%.lo,ieee_arithmetic.F90): fpu-target.inc ieee_exceptions.lo
$(patsubst %.c,%.lo,fpu.c): fpu-target.h
which makes those dependencies explicit but hides it from automake, so that it
doesn't throw away its rules for those object files.
On Solaris, $(version_dep) contains gfortran.ver and gfortran.ver-sun.
gfortran.ver is like on Linux, it can be in $(BUILT_SOURCES), but unfortunately
gfortran.ver-sun depends on all the object files being compiled already,
so if gfortran.ver-sun appears in $(BUILT_SOURCES), the BUILT_SOURCES function
of ensuring the generated files are generated before building object files
is gone, almost everything is built before all-am is entered and there
are no explicit dependencies that e.g. *.F90 files depend on
kinds.inc etc.

So, this change reverts that mistake and instead adds $(version_dep) to
what is removed during make clean (clean-local in particular).

The reversion committed under the reversion of our own patches policy,
the clean-local change considered obvious, committed to trunk.

2022-01-14  Jakub Jelinek  <jakub@redhat.com>

	PR libfortran/104006
	* Makefile.am (BUILT_SOURCES): Don't include $(version_dep).
	(clean-local): Remove $(version_dep).
	* Makefile.in: Regenerated.


	Jakub
diff mbox series

Patch

--- libgfortran/Makefile.am.jj	2022-01-13 17:44:40.503962317 +0100
+++ libgfortran/Makefile.am	2022-01-13 23:37:52.876004924 +0100
@@ -1118,7 +1118,7 @@  ieee_arithmetic.mod: ieee_arithmetic.lo
 	:
 
 BUILT_SOURCES=$(gfor_built_src) $(gfor_built_specific_src) \
-	$(gfor_built_specific2_src) $(gfor_misc_specifics) $(version_dep)
+	$(gfor_built_specific2_src) $(gfor_misc_specifics)
 
 prereq_SRC = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
 	$(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src)
@@ -1356,7 +1356,7 @@  $(gfor_misc_specifics): m4/misc_specific
 endif
 
 clean-local:
-	-rm -rf include
+	-rm -rf include $(version_dep)
 
 EXTRA_DIST = $(m4_files)
 
--- libgfortran/Makefile.in.jj	2022-01-13 17:44:51.468807363 +0100
+++ libgfortran/Makefile.in	2022-01-13 23:37:58.729923341 +0100
@@ -1652,7 +1652,7 @@  intrinsics/random_init.f90
 
 BUILT_SOURCES = $(gfor_built_src) $(gfor_built_specific_src) \
 	$(gfor_built_specific2_src) $(gfor_misc_specifics) \
-	$(version_dep) $(am__append_7)
+	$(am__append_7)
 prereq_SRC = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
 	$(gfor_helper_src) $(gfor_ieee_src) $(gfor_io_headers) $(gfor_specific_src)
 
@@ -7857,7 +7857,7 @@  include/ISO_Fortran_binding.h: $(srcdir)
 @MAINTAINER_MODE_TRUE@	$(M4) -Dfile=$@ -I$(srcdir)/m4 misc_specifics.m4 > $@
 
 clean-local:
-	-rm -rf include
+	-rm -rf include $(version_dep)
 
 # target overrides
 -include $(tmake_file)