diff --git a/mkhelper.mk.in b/mkhelper.mk.in index 07f38cb..c2f3bbd 100644 --- a/mkhelper.mk.in +++ b/mkhelper.mk.in @@ -192,8 +192,7 @@ sanitize-mod-proxies: # Dependency generation rule for undetectable Fortran dependencies: extra_f90.d: mkhelper.mk $(silent_DEPGEN):;{ \ - echo '#-hint src/program/main.o: src/program/implicit_external.o'; \ - echo '#-hint <*.o: $(moddir)/mo_test_submodule.@FC_MOD_FILE_EXT@.proxy>.targets: src/modules/submo_test_submodule.o'; \ + echo '#-hint src/program/main.@OBJEXT@: src/program/implicit_external.@OBJEXT@'; \ } >$@ # Configure delayed bundled libraries: diff --git a/mkhelper/depgen.py b/mkhelper/depgen.py index ab4c800..0e4f7ed 100755 --- a/mkhelper/depgen.py +++ b/mkhelper/depgen.py @@ -449,6 +449,7 @@ def include_callback(filename): provided_modules = set() required_modules = set() + extended_modules = set() pp_debug_info = None lc_debug_info = None @@ -510,7 +511,7 @@ def format_debug_line(line, msg): module ) parser.submodule_start_callback = ( - lambda _submodule, _parent, module: required_modules.add(module) + lambda _submodule, _parent, module: extended_modules.add(module) ) parser.module_use_callback = lambda module: required_modules.add(module) @@ -545,12 +546,13 @@ def format_debug_line(line, msg): gen_include_deps(src_name, obj_name, dep_name, included_files) ) - if provided_modules or required_modules: + if provided_modules or required_modules or extended_modules: out_lines.extend( gen_module_deps( obj_name, provided_modules, required_modules, + extended_modules, args.fc_mod_dir, args.fc_mod_upper, args.fc_mod_ext, @@ -592,6 +594,7 @@ def format_debug_line(line, msg): lc_files.clear() provided_modules.clear() required_modules.clear() + extended_modules.clear() def gen_lc_deps(src_name, lc_files): @@ -612,7 +615,13 @@ def gen_include_deps(src_name, obj_name, dep_name, included_files): def gen_module_deps( - obj_name, provided_modules, required_modules, mod_dir, mod_upper, mod_ext + obj_name, + provided_modules, + required_modules, + extended_modules, + mod_dir, + mod_upper, + mod_ext, ): result = [] if obj_name: @@ -626,7 +635,9 @@ def gen_module_deps( # Do not depend on the modules that are provided in the same file: required_modules = [ - m for m in required_modules if m not in provided_modules + m + for m in required_modules | extended_modules + if m not in provided_modules ] if required_modules: prereqs = " ".join( @@ -635,6 +646,17 @@ def gen_module_deps( ) ) result.append("{0}: {1}\n".format(obj_name, prereqs)) + + if extended_modules: + result.extend( + [ + "#-hint <*:{0}>.targets: {1}\n".format(m, obj_name) + for m in modulenames_to_filenames( + extended_modules, mod_dir, mod_upper, mod_ext + ) + ] + ) + return result