Skip to content

Commit

Permalink
Try to fix an issue where make fails if a header file disappears
Browse files Browse the repository at this point in the history
Currently, when a header file is removed (or renamed), there is a stale
dependency file still referring to the header, and GNU make aborts, because
the header is missing.  Attempt to work around this by adding a pattern
rule to generate any header in `src/`.  The rule prints a warning message.

The C source file whose header was missing will be recompiled because a
dependency was rebuilt.  Once it is, the removed header should be removed
from the dependency file.

(Aside: FWIW, the "ninja" build tool knows directly about depfiles, and it
does not have this problem.)
  • Loading branch information
rprichard committed Feb 29, 2016
1 parent 483aeff commit e390c87
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@ build/unix/%.o : src/%.cc VERSION.txt | $$(@D)/.mkdir
%.mkdir :
@mkdir -p $(dir $@)
@touch $@

src/%.h :
@echo "Missing header file $@ (stale dependency file?)"

0 comments on commit e390c87

Please sign in to comment.