Commit af516f07
af516f076002Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · +1 added · ~1 modified
Description
Split spinel_parse.c into a legacy standalone and a src/ library copy
The Prism front-end was a single top-level spinel_parse.c that toggled its CLI main() via -DSPINEL_PARSE_AS_LIB. Separate the two consumers:
- legacy/spinel_parse.c: the standalone (with main), built by the legacy
parsetarget. - src/spinel_parse.c: the library copy (main removed), linked into the C compiler build/spinel as sp_parse_file_to_text.
Drop the top-level copy and the -DSPINEL_PARSE_AS_LIB flag (no longer
needed now that main is physically absent from the lib copy). Both
builds and make test (846/0/0) verified.
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- af516f076002
- Parent
- 7751669a7dad
MakefilemodifiedView file
@@ -119,13 +119,14 @@
119119
120120
parse: spinel_parse$(EXE)121121
122-
spinel_parse$(EXE): spinel_parse.c $(PRISM_LIB)123-
$(CC) $(CFLAGS) -I$(PRISM_INC) spinel_parse.c $(PRISM_LIB) -lm -o $@122+
spinel_parse$(EXE): legacy/spinel_parse.c $(PRISM_LIB)123+
$(CC) $(CFLAGS) -I$(PRISM_INC) legacy/spinel_parse.c $(PRISM_LIB) -lm -o $@124124
125125
# ---- C compiler (src/) ----126126
# The single-binary C reimplementation of the analyzer + code generator.127-
# Reuses spinel_parse.c's Prism walk (compiled with -DSPINEL_PARSE_AS_LIB so128-
# its standalone main() drops out and sp_parse_file_to_text is exposed).127+
# Links src/spinel_parse.c, the library copy of the Prism walk (no main();128+
# exposes sp_parse_file_to_text). The standalone-with-main copy used by the129+
# legacy `parse` target lives in legacy/spinel_parse.c.129130
# `spinel` is the single binary: it emits C and then drives cc to link it.130131
# (SPINEL itself is defined above, just before the `all` target.)131132
@@ -142,8 +143,8 @@
142143
build/csrc/%.o: src/%.c $(SPINEL_HDRS) | build/csrc143144
$(CC) $(CFLAGS) -Isrc -c $< -o $@144145
145-
build/csrc/sp_parse_lib.o: spinel_parse.c $(PRISM_LIB) | build/csrc146-
$(CC) $(CFLAGS) -DSPINEL_PARSE_AS_LIB -I$(PRISM_INC) -c spinel_parse.c -o $@146+
build/csrc/sp_parse_lib.o: src/spinel_parse.c $(PRISM_LIB) | build/csrc147+
$(CC) $(CFLAGS) -I$(PRISM_INC) -c src/spinel_parse.c -o $@147148
148149
$(SPINEL): $(SPINEL_OBJ) build/csrc/sp_parse_lib.o $(PRISM_LIB)149150
$(CC) $(CFLAGS) $(SPINEL_OBJ) build/csrc/sp_parse_lib.o $(PRISM_LIB) -lm $(LDFLAGS) -o $@legacy/spinel_parse.crenamedView file
Loading diff…
src/spinel_parse.caddedView file
Loading diff…