diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-20 12:26:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-20 12:26:35 +0200 |
commit | cddb2d17e71887fdb325afdc67905201d0220b13 (patch) | |
tree | 175760231452f2658a9c017d9d347dbcf3312bfa /libbuild2/algorithm.cxx | |
parent | b85ec1f2cc27ee178488de480eb3f64245a6e563 (diff) |
Don't create targets for non-existent source files
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r-- | libbuild2/algorithm.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index cb63e87..8f399dd 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -65,7 +65,13 @@ namespace build2 if (const target* pt = pk.tk.type->search (t, pk)) return *pt; - return create_new_target (t.ctx, pk); + if (pk.tk.out->empty ()) + return create_new_target (t.ctx, pk); + + // If this is triggered, then you are probably not passing scope to + // search() (which leads to search_existing_file() being skipped). + // + fail << "no existing source file for prerequisite " << pk << endf; } pair<target&, ulock> @@ -76,7 +82,13 @@ namespace build2 if (const target* pt = pk.tk.type->search (t, pk)) return {const_cast<target&> (*pt), ulock ()}; - return create_new_target_locked (t.ctx, pk); + if (pk.tk.out->empty ()) + return create_new_target_locked (t.ctx, pk); + + // If this is triggered, then you are probably not passing scope to + // search() (which leads to search_existing_file() being skipped). + // + fail << "no existing source file for prerequisite " << pk << endf; } const target* |