Repository navigation
Commit 6f290e1
committed
build: make each grammar object depend on the sources it includes
A grammar unity object, grammar_<lang>.c, #includes its own vendored parser.c
and, where the grammar has one, scanner.c. Those files were prerequisites of
nothing. Editing a vendored scanner therefore left the object untouched and the
edit silently absent from the binary.
This is not hypothetical: the properties scanner fix in the previous commit
appeared not to work at all. An A/B said 3 stalls against 2 - no effect - and
the reason was that prod_grammar_properties.o predated the edit by five minutes
and `nm` still showed the old `_reached_eof` symbol sitting in it. The measured
"no effect" was a stale object, not a bad fix.
The build already treats its other two unity objects this way and says why:
LSP_UNITY_DEPS and TS_RUNTIME_DEPS both list the sources and headers they pull
in, because this Makefile deliberately does not use compiler auto-dependency
(-MMD) generation. Grammars were the gap, and MANIFEST.md's "Local source
patches" table means patching a vendored scanner is an expected thing to do -
so the trap was reachable by design.
Secondary expansion is what lets one pattern rule name each grammar's own
directory ($$* is the stem, grammar_properties -> properties). Applied to all
three grammar object rules: production, test and tsan. Non-grammar objects
match no directory and gain no prerequisite.
Verified by touching internal/cbm/vendored/grammars/properties/scanner.c and
watching exactly one object rebuild.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent 2f33999 commit 6f290e1
1 file changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
864 | | - | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
865 | 882 | | |
866 | 883 | | |
867 | 884 | | |
| |||
873 | 890 | | |
874 | 891 | | |
875 | 892 | | |
876 | | - | |
| 893 | + | |
877 | 894 | | |
878 | 895 | | |
879 | 896 | | |
| |||
1103 | 1120 | | |
1104 | 1121 | | |
1105 | 1122 | | |
1106 | | - | |
| 1123 | + | |
1107 | 1124 | | |
1108 | 1125 | | |
1109 | 1126 | | |
| |||
0 commit comments