Skip to content

Commit

Permalink
test: Remake *_scanner.c if *_scanner.h is missing.
Browse files Browse the repository at this point in the history
If a ${foo}_scanner.c exists but the respective ${foo}_scanner.h is
missing, then 'make' can halt. Fix this by deleting the
${foo}_scanner.c file and then remake it. This rule is the same as the
automake-generated rule for .c files that require LEX or YACC (except
automake will use ylwrap).
  • Loading branch information
Explorer09 authored and westes committed Jan 24, 2017
1 parent afc687f commit e8cb34e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,24 @@ FLEX = $(top_builddir)/src/flex

bison_nr_main.$(OBJEXT): bison_nr_parser.h bison_nr_scanner.h
bison_nr_scanner.$(OBJEXT): bison_nr_parser.h

bison_nr_scanner.h: bison_nr_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

bison_yylloc_main.$(OBJEXT): bison_yylloc_parser.h bison_yylloc_scanner.h
bison_yylloc_scanner.$(OBJEXT): bison_yylloc_parser.h

bison_yylloc_scanner.h: bison_yylloc_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

bison_yylval_main.$(OBJEXT): bison_yylval_parser.h bison_yylval_scanner.h
bison_yylval_scanner.$(OBJEXT): bison_yylval_parser.h

bison_yylval_scanner.h: bison_yylval_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

# automake does not support compiling flex scanners output in C as C++
# so we explicitly sayhow, using the .lll suffix for the lex input file
Expand All @@ -356,18 +365,36 @@ bison_yylval_scanner.h: bison_yylval_scanner.c
$(FLEX) -o $@ $<

header_nr_main.$(OBJEXT): header_nr_scanner.h

header_nr_scanner.h: header_nr_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

header_r_main.$(OBJEXT): header_r_scanner.h

header_r_scanner.h: header_r_scanner.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

multiple_scanners_nr_main.$(OBJEXT): multiple_scanners_nr_1.h multiple_scanners_nr_2.h

multiple_scanners_nr_1.h: multiple_scanners_nr_1.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

multiple_scanners_nr_2.h: multiple_scanners_nr_2.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

multiple_scanners_r_main.$(OBJEXT): multiple_scanners_r_1.h multiple_scanners_r_2.h

multiple_scanners_r_1.h: multiple_scanners_r_1.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

multiple_scanners_r_2.h: multiple_scanners_r_2.c
@if test ! -f $@; then rm -f $<; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) $<; else :; fi

posixly_correct.c: posixly_correct.l $(FLEX)
POSIXLY_CORRECT=1 $(FLEX) -o $@ $<
Expand Down

0 comments on commit e8cb34e

Please sign in to comment.