mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Refactor flex and bison make rules
Numerous flex and bison make rules have appeared in the source tree over time, and they are all virtually identical, so we can replace them by pattern rules with some variables for customization. Users of pgxs will also be able to benefit from this.
This commit is contained in:
@ -17,8 +17,6 @@ OBJS= analyze.o gram.o keywords.o kwlookup.o parser.o \
|
||||
parse_expr.o parse_func.o parse_node.o parse_oper.o parse_param.o \
|
||||
parse_relation.o parse_target.o parse_type.o parse_utilcmd.o scansup.o
|
||||
|
||||
FLEXFLAGS = -CF -b -p -p
|
||||
|
||||
include $(top_srcdir)/src/backend/common.mk
|
||||
|
||||
|
||||
@ -40,22 +38,12 @@ endif
|
||||
|
||||
gram.h: gram.c ;
|
||||
|
||||
gram.c: gram.y
|
||||
$(PERL) $(srcdir)/check_keywords.pl $< $(top_srcdir)/src/include/parser/kwlist.h
|
||||
ifdef BISON
|
||||
$(BISON) -d $(BISONFLAGS) -o $@ $<
|
||||
else
|
||||
@$(missing) bison $< $@
|
||||
endif
|
||||
gram.c: BISONFLAGS += -d
|
||||
gram.c: BISON_CHECK_CMD = $(PERL) $(srcdir)/check_keywords.pl $< $(top_srcdir)/src/include/parser/kwlist.h
|
||||
|
||||
|
||||
scan.c: scan.l
|
||||
ifdef FLEX
|
||||
$(FLEX) $(FLEXFLAGS) -o'$@' $<
|
||||
@if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup, see lex.backup."; exit 1; fi
|
||||
else
|
||||
@$(missing) flex $< $@
|
||||
endif
|
||||
scan.c: FLEXFLAGS = -CF -p -p
|
||||
scan.c: FLEX_NO_BACKUP=yes
|
||||
|
||||
|
||||
# Force these dependencies to be known even without dependency info built:
|
||||
|
Reference in New Issue
Block a user