Skip to content

Commit

Permalink
Process parse.y without temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed May 15, 2023
1 parent 41dccb6 commit 3fe45a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions common.mk
Expand Up @@ -924,13 +924,8 @@ PHONY:

{$(srcdir)}.y.c:
$(ECHO) generating $@
$(Q)$(BASERUBY) $(tooldir)/id2token.rb $(SRC_FILE) > parse.tmp.y
$(Q)$(YACC) -d $(YFLAGS) -o y.tab.c parse.tmp.y
$(Q)$(RM) parse.tmp.y
$(Q)sed -e "/^#/s|parse\.tmp\.[iy]|$(SRC_FILE)|" -e "/^#/s!y\.tab\.c!$@!" y.tab.c > $@.new
$(Q)$(MV) $@.new $@
$(Q)sed -e "/^#line.*y\.tab\.h/d;/^#line.*parse.*\.y/d" y.tab.h > $(@:.c=.h)
$(Q)$(RM) y.tab.c y.tab.h
$(Q)$(BASERUBY) $(tooldir)/id2token.rb $(SRC_FILE) | \
$(YACC) -d $(YFLAGS) -o$@ -h$*.h - parse.y

$(PLATFORM_D):
$(Q) $(MAKEDIRS) $(PLATFORM_DIR) $(@D)
Expand Down
2 changes: 1 addition & 1 deletion ext/ripper/depend
Expand Up @@ -11,7 +11,7 @@ ripper.o: ripper.c

.y.c:
$(ECHO) compiling compiler $<
$(Q) $(BISON) -t -v -o$@ -h$*.h $<
$(Q) $(BISON) -t -v -o$@ -h$*.h - parse.y < $<

all: check
static: check
Expand Down

0 comments on commit 3fe45a3

Please sign in to comment.