diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index ac92f3b42be53c8675b5d726f00b643b9cb9f2d0..c8442e2a71e609a64df687c42bdf775dfd8540d3 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -184,6 +184,10 @@ warnMissingHomeModules hsc_env mod_graph =
     is_my_target mod (TargetFile target_file _)
       | Just mod_file <- ml_hs_file (ms_location mod)
       = target_file == mod_file ||
+
+           --  Don't warn on B.hs-boot if B.hs is specified (#16551)
+           addBootSuffix target_file == mod_file ||
+
            --  We can get a file target even if a module name was
            --  originally specified in a command line because it can
            --  be converted in guessTarget (by appending .hs/.lhs).
diff --git a/testsuite/tests/warnings/should_compile/T16551.stderr b/testsuite/tests/warnings/should_compile/T16551.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..352784c7d6920185e61c34c6759712379a3d0c1f
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T16551.stderr
@@ -0,0 +1,3 @@
+[1 of 3] Compiling B[boot]          ( T16551/B.hs-boot, T16551/B.o-boot )
+[2 of 3] Compiling A                ( T16551/A.hs, T16551/A.o )
+[3 of 3] Compiling B                ( T16551/B.hs, T16551/B.o )
diff --git a/testsuite/tests/warnings/should_compile/T16551/A.hs b/testsuite/tests/warnings/should_compile/T16551/A.hs
new file mode 100644
index 0000000000000000000000000000000000000000..138a4faa1cda9e480a5a452fec94bb6b8371935e
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T16551/A.hs
@@ -0,0 +1,2 @@
+module A where
+import {-# SOURCE #-} B
diff --git a/testsuite/tests/warnings/should_compile/T16551/B.hs b/testsuite/tests/warnings/should_compile/T16551/B.hs
new file mode 100644
index 0000000000000000000000000000000000000000..af1191696690ad1b0907d58ad88cbe15a46e57ab
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T16551/B.hs
@@ -0,0 +1,2 @@
+module B where
+import A
diff --git a/testsuite/tests/warnings/should_compile/T16551/B.hs-boot b/testsuite/tests/warnings/should_compile/T16551/B.hs-boot
new file mode 100644
index 0000000000000000000000000000000000000000..c759bc2d1322cce214ce3f29b053a34d449f4cf7
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T16551/B.hs-boot
@@ -0,0 +1 @@
+module B where
diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T
index 36e6b1beeb63959feb3a2a5c1c95ed7d5309c147..fcf03443d3f4b7cef0ece84061344fa73cb51a21 100644
--- a/testsuite/tests/warnings/should_compile/all.T
+++ b/testsuite/tests/warnings/should_compile/all.T
@@ -22,6 +22,7 @@ test('Werror01', normal, compile, [''])
 test('Werror02', normal, compile, [''])
 
 test('MissingMod', normal, multimod_compile, ['MissingMod', '-Wmissing-home-modules'])
+test('T16551', [extra_files(['T16551/'])], multimod_compile, ['T16551/A.hs T16551/B.hs', '-Wmissing-home-modules'])
 
 test('StarBinder', normal, compile, [''])