Commit dfea575
committed
Makefile: lazily compute header dependencies
Use the gcc -MMD -MP -MF options to generate dependency rules as
a byproduct when building .o files if the
COMPUTE_HEADER_DEPENDENCIES variable is defined. That variable
is left undefined by default for now.
As each object file is built, write a makefile fragment
containing its dependencies in the deps/ subdirectory of its
containing directory. The deps/ directories should be generated
if they are missing at the start of each build. So let each
object file depend on $(missing_dep_dirs), which lists only the
directories of this kind that are missing to avoid needlessly
regenerating files when the directories' timestamps change.
gcc learned the -MMD -MP -MF options in version 3.0, so most gcc
users should have them by now.
The dependencies this option computes are more specific than the
rough estimates hard-coded in the Makefile, greatly speeding up
rebuilds when only a little-used header file has changed.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>1 parent c373991 commit dfea575
2 files changed
+45
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
220 | 224 | | |
221 | 225 | | |
222 | 226 | | |
| |||
1677 | 1681 | | |
1678 | 1682 | | |
1679 | 1683 | | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
1680 | 1695 | | |
1681 | 1696 | | |
1682 | | - | |
1683 | | - | |
| 1697 | + | |
| 1698 | + | |
1684 | 1699 | | |
1685 | 1700 | | |
1686 | | - | |
1687 | | - | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1688 | 1726 | | |
1689 | 1727 | | |
1690 | 1728 | | |
| |||
1700 | 1738 | | |
1701 | 1739 | | |
1702 | 1740 | | |
1703 | | - | |
1704 | 1741 | | |
1705 | 1742 | | |
1706 | 1743 | | |
| 1744 | + | |
1707 | 1745 | | |
1708 | 1746 | | |
1709 | 1747 | | |
| |||
2011 | 2049 | | |
2012 | 2050 | | |
2013 | 2051 | | |
| 2052 | + | |
2014 | 2053 | | |
2015 | 2054 | | |
2016 | 2055 | | |
| |||
0 commit comments