Browse code

Merge changes from ELPA

Andreas Marek authored on11/07/2016 18:34:40 • Lorenz Hüdepohl committed on23/05/2018 14:40:20
Showing2 changed files
... ...
@@ -11,6 +11,9 @@ endef
11 11
 _f90_verbose = $(_f90_verbose_$(V))
12 12
 _f90_verbose_ = $(_f90_verbose_$(AM_DEFAULT_VERBOSITY))
13 13
 _f90_verbose_0 = @echo "  $1";
14
+_f90_only_verbose = $(_f90_only_verbose_$(V))
15
+_f90_only_verbose_ = @
16
+_f90_only_verbose_0 = @
14 17
 _f90_targets = $(call translate_name,$(PROGRAMS) $(LTLIBRARIES))
15 18
 
16 19
 FORTRAN_CPP ?= cpp -P -traditional -Wall -Werror
... ...
@@ -92,9 +95,26 @@ endef
92 95
 ifneq ($(call is_clean),1)
93 96
 include $(_f90_depfile)
94 97
 endif
98
+
99
+# $1 string
100
+# $2 file
101
+define append_to
102
+	$(_f90_only_verbose)echo '$1' >> $2
103
+
104
+endef
105
+
106
+# $1 program
107
+define program_dependencies
108
+	$(_f90_only_verbose)rm -f .$p.dep.args
109
+	$(foreach argument,$(_$p_use_mods) $(_$p_def_mods) $(foreach l,$(call recursive_lib_deps,$p),$(_$l_use_mods) $(_$l_def_mods)),$(call append_to,$(argument),.$p.dep.args))
110
+	$(_f90_only_verbose)$(top_srcdir)/fdep/fortran_dependencies.pl $p < .$p.dep.args >> $@ || { rm $@; exit 1; }
111
+	$(_f90_only_verbose)rm -f .$p.dep.args
112
+
113
+endef
114
+
95 115
 $(_f90_depfile): $(top_srcdir)/fdep/fortran_dependencies.pl $(foreach p,$(_f90_targets),$(_$p_use_mods) $(_$p_def_mods)) | $(foreach p,$(_f90_targets),$(_f90_depdir)/$p)
96 116
 	$(call _f90_verbose,F90 DEPS $@)echo > $@;
97
-	$(foreach p,$(_f90_targets),$(top_srcdir)/fdep/fortran_dependencies.pl $p $(_$p_use_mods) $(_$p_def_mods) $(foreach l,$(call recursive_lib_deps,$p),$(_$l_use_mods) $(_$l_def_mods)) >> $@; $(newline))
117
+	$(foreach p,$(_f90_targets),$(call program_dependencies,$p))
98 118
 
99 119
 $(_f90_depdir):
100 120
 	@mkdir $@
... ...
@@ -42,7 +42,8 @@ sub add_def {
42 42
 
43 43
 my $target = shift;
44 44
 
45
-foreach my $file (@ARGV) {
45
+foreach my $file (<>) {
46
+	chomp($file);
46 47
 	if (exists $files{$file}) {
47 48
 		next;
48 49
 	} else {