From a949d5f4b4e2bcd5f20a9f02b4d7a3eaf24f9855 Mon Sep 17 00:00:00 2001
From: "James K. Lowden" <jklowden@symas.com>
Date: Thu, 9 Jan 2025 16:36:23 -0500
Subject: [PATCH] dependency refinement, some still missing

---
 gcc/cobol/Make-lang.in | 135 +++++++++++++++++++----------------------
 1 file changed, 64 insertions(+), 71 deletions(-)

diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index d4affebf0691..3b53912959fe 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -112,7 +112,7 @@ cobol_OBJS_FROM_LIBGCOBOL = \
 ../../gcc/cobol/charmaps-copy.cc: ../libgcobol/charmaps.cc
 	echo "// DO NOT EDIT THIS FILE.  It was copied from the libgcobol directory." > $@
 	tail -n +2 $< >> $@
-    
+
 ../../gcc/cobol/valconv-copy.cc: ../libgcobol/valconv.cc
 	echo "// DO NOT EDIT THIS FILE.  It was copied from the libgcobol directory." > $@
 	tail -n +2 $< >> $@
@@ -166,17 +166,17 @@ gcobol$(exeext): \
 #   2. eliminate compiler options, leaving only preprocessor options (-D and -I)
 #   3. add -E -MM
 #
-# Below is postprocessed: the files are one per line, used "realpath
-# --relative-to=$PWD" to rationalize them, and sorted.
-
-ALL_H_FILES = $(wildcard $(srcdir)/cobol/*.h) $(wildcard $(srcdir)/../libgcobol/*.h) 
+# The below lists of include files for the the generated files is
+# postprocessed: the files are one per line, used "realpath
+# --relative-to=$PWD" to rationalize them, and sorted.  We include
+# parse.c in the list for scan.o because that's the one make(1) knows about.
 
-cobol/parse.c: cobol/parse.y $(ALL_H_FILES)
+cobol/parse.c: cobol/parse.y
 	$(YACC) -o $@ $(YFLAGS)				\
 		--defines=cobol/parse.h			\
 		--report-file=cobol/parser.out $<
 
-cobol/cdf.c: cobol/cdf.y  $(ALL_H_FILES)
+cobol/cdf.c: cobol/cdf.y
 	$(YACC) -o $@ $(YFLAGS)						\
 		--defines=cobol/cdf.h --report-file=cobol/cdf.out $<
 
@@ -184,85 +184,78 @@ cobol/cdf.c: cobol/cdf.y  $(ALL_H_FILES)
 # in Flex manual. We suppress those messages, as a convenience.
 FLEX_WARNING = warning, dangerous trailing context
 
-cobol/scan.c: cobol/scan.l  $(ALL_H_FILES)
+cobol/scan.c: cobol/scan.l
 	$(LEX) -o$@ $(LFLAGS) $< >$@~ 2>&1
-	awk  '! /$(FLEX_WARNING)/ {print > "/dev/stderr"; nerr++}		\
+	awk  '! /$(FLEX_WARNING)/ {print > "/dev/stderr"; nerr++}	\
 	     END {print "$(LEX):", NR, "messages" > "/dev/stderr";	\
-		  exit nerr}' $@~
+		  exit nerr}' $@~					\
 	@rm $@~
 
-cdf.o: cobol/cdf.c				\
-	../../gcc/cobol/cbldiag.h		\
-	../../gcc/cobol/cdfval.h		\
-	../../gcc/cobol/copybook.h		\
-	../../gcc/cobol/symbols.h		\
-	../../gcc/cobol/util.h			\
-	../../libgcobol/common-defs.h		\
-	../../libgcobol/ec.h			\
-	../../libgcobol/ec.h			\
+cobol/cdf.o: cobol/cdf.c			\
+	$(srcdir)/cobol/cbldiag.h		\
+	$(srcdir)/cobol/cdfval.h		\
+	$(srcdir)/cobol/copybook.h		\
+	$(srcdir)/cobol/symbols.h		\
+	$(srcdir)/cobol/util.h			\
+	$(srcdir)/../libgcobol/common-defs.h	\
+	$(srcdir)/../libgcobol/ec.h		\
 	cobol/cdf.h				\
 	include/limits.h			\
 	include/stdint.h			\
 	include/syslimits.h 
 
-parse.o: cobol/parse.c				\
-	../../gcc/cobol/cbldiag.h		\
-	../../gcc/cobol/cdfval.h		\
-	../../gcc/cobol/cobol-system.h		\
-	../../gcc/cobol/exceptg.h		\
-	../../gcc/cobol/genapi.h		\
-	../../gcc/cobol/genapi.h		\
-	../../gcc/cobol/inspect.h		\
-	../../gcc/cobol/inspect.h		\
-	../../gcc/cobol/parse_ante.h		\
-	../../gcc/cobol/parse_util.h		\
-	../../gcc/cobol/symbols.h		\
-	../../gcc/cobol/util.h			\
-	../../gcc/hwint.h			\
-	../../gcc/system.h			\
-	../../include/ansidecl.h		\
-	../../include/ansidecl.h		\
-	../../include/filenames.h		\
-	../../include/hashtab.h			\
-	../../include/libiberty.h		\
-	../../include/safe-ctype.h		\
-	../../libgcobol/common-defs.h		\
-	../../libgcobol/ec.h			\
-	../../libgcobol/ec.h			\
-	../../libgcobol/exceptl.h		\
-	../../libgcobol/io.h			\
+cobol/parse.o: cobol/parse.c			\
+	$(srcdir)/cobol/cbldiag.h		\
+	$(srcdir)/cobol/cdfval.h		\
+	$(srcdir)/cobol/cobol-system.h		\
+	$(srcdir)/cobol/exceptg.h		\
+	$(srcdir)/cobol/genapi.h		\
+	$(srcdir)/cobol/inspect.h		\
+	$(srcdir)/cobol/parse_ante.h		\
+	$(srcdir)/cobol/parse_util.h		\
+	$(srcdir)/cobol/symbols.h		\
+	$(srcdir)/cobol/util.h			\
+	$(srcdir)/hwint.h			\
+	$(srcdir)/system.h			\
+	$(srcdir)/../include/ansidecl.h		\
+	$(srcdir)/../include/filenames.h	\
+	$(srcdir)/../include/hashtab.h		\
+	$(srcdir)/../include/libiberty.h	\
+	$(srcdir)/../include/safe-ctype.h	\
+	$(srcdir)/../libgcobol/common-defs.h	\
+	$(srcdir)/../libgcobol/ec.h		\
+	$(srcdir)/../libgcobol/exceptl.h	\
+	$(srcdir)/../libgcobol/io.h		\
 	auto-host.h				\
 	cobol/parse.h				\
 	config.h 
 
-scan.o: cobol/scan.c				\
-	../../gcc/cobol/cbldiag.h		\
-	../../gcc/cobol/cdfval.h		\
-	../../gcc/cobol/cobol-system.h		\
-	../../gcc/cobol/copybook.h		\
-	../../gcc/cobol/dts.h			\
-	../../gcc/cobol/inspect.h		\
-	../../gcc/cobol/lexio.h			\
-	../../gcc/cobol/scan_ante.h		\
-	../../gcc/cobol/scan_post.h		\
-	../../gcc/cobol/symbols.h		\
-	../../gcc/cobol/symbols.h		\
-	../../gcc/cobol/util.h			\
-	../../gcc/hwint.h			\
-	../../gcc/system.h			\
-	../../include/ansidecl.h		\
-	../../include/ansidecl.h		\
-	../../include/filenames.h		\
-	../../include/hashtab.h			\
-	../../include/libiberty.h		\
-	../../include/safe-ctype.h		\
-	../../libgcobol/common-defs.h		\
-	../../libgcobol/ec.h			\
-	../../libgcobol/ec.h			\
-	../../libgcobol/exceptl.h		\
-	../../libgcobol/io.h			\
+cobol/scan.o: cobol/scan.c			\
+	$(srcdir)/cobol/cbldiag.h		\
+	$(srcdir)/cobol/cdfval.h		\
+	$(srcdir)/cobol/cobol-system.h		\
+	$(srcdir)/cobol/copybook.h		\
+	$(srcdir)/cobol/dts.h			\
+	$(srcdir)/cobol/inspect.h		\
+	$(srcdir)/cobol/lexio.h			\
+	$(srcdir)/cobol/scan_ante.h		\
+	$(srcdir)/cobol/scan_post.h		\
+	$(srcdir)/cobol/symbols.h		\
+	$(srcdir)/cobol/util.h			\
+	$(srcdir)/hwint.h			\
+	$(srcdir)/system.h			\
+	$(srcdir)/../include/ansidecl.h		\
+	$(srcdir)/../include/filenames.h	\
+	$(srcdir)/../include/hashtab.h		\
+	$(srcdir)/../include/libiberty.h	\
+	$(srcdir)/../include/safe-ctype.h	\
+	$(srcdir)/../libgcobol/common-defs.h	\
+	$(srcdir)/../libgcobol/ec.h		\
+	$(srcdir)/../libgcobol/exceptl.h	\
+	$(srcdir)/../libgcobol/io.h		\
 	auto-host.h				\
 	cobol/cdf.h				\
+	cobol/parse.c				\
 	cobol/parse.h				\
 	config.h 
 
-- 
GitLab