Browse Source

Fix infinite loop problem that appear on gcc112 linux machine using GNU make 4.0.

  * Never put destination directory in the dependency list, as it gets modified when
    the target file is created and led to infinite recursion.
    We cannot use $(MKDIRTREE) unconditionally as this generates make error
    at least on Windows OS.
    Instead, create an explicit target for $(TEST_OUTPUTDIR), and add a: 
    $(MAKE) $dir
    line on gparmake, createlst and $(MAKEINC) targets explicitly.

git-svn-id: trunk@34324 -
pierre 9 years ago
parent
commit
bf652e79ed
1 changed files with 12 additions and 9 deletions
  1. 12 9
      tests/Makefile.fpc

+ 12 - 9
tests/Makefile.fpc

@@ -179,6 +179,9 @@ TESTDIRS:=test $(addprefix test/,$(TESTSUBDIRS))
 # Utilities
 # Utilities
 #
 #
 
 
+$(TEST_OUTPUTDIR):
+	$(MKDIRTREE) $(TEST_OUTPUTDIR)
+
 utils:
 utils:
         $(MAKE) -C utils utils
         $(MAKE) -C utils utils
 
 
@@ -267,7 +270,7 @@ $(C_OBJECTS) : %.o: %.c
 $(CPP_OBJECTS) : %.o: %.cpp
 $(CPP_OBJECTS) : %.o: %.cpp
 		$(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
 		$(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
 		
 		
-copyfiles: $(TEST_OUTPUTDIR)
+copyfiles:
         -$(MKDIRTREE) $(TEST_OUTPUTDIR)/test/cg
         -$(MKDIRTREE) $(TEST_OUTPUTDIR)/test/cg
         -$(COPY) $(C_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
         -$(COPY) $(C_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
         -$(COPY) $(CPP_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
         -$(COPY) $(CPP_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
@@ -283,9 +286,6 @@ testprep: testprep-stamp.$(TEST_FULL_TARGET)
 testprep-stamp.$(TEST_FULL_TARGET): utils tstunits copyfiles
 testprep-stamp.$(TEST_FULL_TARGET): utils tstunits copyfiles
         $(ECHOREDIR) $(DATE) > testprep-stamp.$(TEST_FULL_TARGET)
         $(ECHOREDIR) $(DATE) > testprep-stamp.$(TEST_FULL_TARGET)
 
 
-$(TEST_OUTPUTDIR):
-        $(MKDIRTREE) $@
-
 ################################
 ################################
 # Dotest options
 # Dotest options
 #
 #
@@ -500,11 +500,13 @@ else
 
 
 MAKEINC=$(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
 MAKEINC=$(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
 
 
-$(GPARMAKE): $(COMPILER_UNITTARGETDIR) utils/gparmake.pp $(CREATELST)
-        $(FPC) $(FPCOPT) -FE. utils/gparmake.pp $(OPT)
+$(GPARMAKE): utils/gparmake.pp $(CREATELST)
+	$(Q)$(MAKE)  $(COMPILER_UNITTARGETDIR)
+	$(FPC) $(FPCOPT) -FE. utils/gparmake.pp $(OPT)
 
 
-$(CREATELST): $(COMPILER_UNITTARGETDIR) utils/createlst.pp
-        $(FPC) $(FPCOPT) -FE. utils/createlst.pp $(OPT)
+$(CREATELST): utils/createlst.pp
+	$(Q)$(MAKE)  $(COMPILER_UNITTARGETDIR)
+	$(FPC) $(FPCOPT) -FE. utils/createlst.pp $(OPT)
 
 
 # Can't have testprep as prerequisite, because that is a phony target and
 # Can't have testprep as prerequisite, because that is a phony target and
 # phony targets are always remade. Since the makefile will be reparsed
 # phony targets are always remade. Since the makefile will be reparsed
@@ -518,12 +520,13 @@ $(CREATELST): $(COMPILER_UNITTARGETDIR) utils/createlst.pp
 # As a result, we list TEST_OUTPUTDIR as a dependency (that just creates
 # As a result, we list TEST_OUTPUTDIR as a dependency (that just creates
 # the directory) and have an explicit rule to build GPARMAKE rather than
 # the directory) and have an explicit rule to build GPARMAKE rather than
 # building it via the utils Makefile
 # building it via the utils Makefile
-$(MAKEINC): $(GPARMAKE) $(CREATELST) $(TEST_OUTPUTDIR)
+$(MAKEINC): $(GPARMAKE) $(CREATELST)
 # generate rules for parallel executions of dotest
 # generate rules for parallel executions of dotest
 # gparmake now also needs an additional parameter for the name of the
 # gparmake now also needs an additional parameter for the name of the
 # used subdirectory. Note also that the index must be increasing for each
 # used subdirectory. Note also that the index must be increasing for each
 # new call with a gap insuring that all the previous files have lower index
 # new call with a gap insuring that all the previous files have lower index
 # even if CHUNKSIZE is equal to 1.
 # even if CHUNKSIZE is equal to 1.
+	$(Q)$(MAKE) $(TEST_OUTPUTDIR)
 	$(Q)$(CREATELST) $(TESTDIRS) > testfilelist.lst
 	$(Q)$(CREATELST) $(TESTDIRS) > testfilelist.lst
 	$(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) @testfilelist.lst
 	$(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) @testfilelist.lst
 	$(Q)$(CREATELST) tbs > tbsfilelist.lst
 	$(Q)$(CREATELST) tbs > tbsfilelist.lst