diff options
| author | Peter Eisentraut | 2012-10-11 10:57:04 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2012-10-11 10:57:04 +0000 |
| commit | 8521d131941be5a177270bc428fa8e684cd645b5 (patch) | |
| tree | bfbf285859f3770aedc6b3c674a45d45cc4be5fe /src/backend | |
| parent | ab112068b657a2bd30a7f953c732e2ee75a606f5 (diff) | |
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.
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/bootstrap/Makefile | 16 | ||||
| -rw-r--r-- | src/backend/parser/Makefile | 20 | ||||
| -rw-r--r-- | src/backend/replication/Makefile | 14 | ||||
| -rw-r--r-- | src/backend/utils/misc/Makefile | 7 |
4 files changed, 4 insertions, 53 deletions
diff --git a/src/backend/bootstrap/Makefile b/src/backend/bootstrap/Makefile index a77d864800..672bc8b6d7 100644 --- a/src/backend/bootstrap/Makefile +++ b/src/backend/bootstrap/Makefile @@ -16,24 +16,8 @@ OBJS= bootparse.o bootstrap.o include $(top_srcdir)/src/backend/common.mk - # bootscanner is compiled as part of bootparse bootparse.o: bootscanner.c -bootparse.c: bootparse.y -ifdef BISON - $(BISON) $(BISONFLAGS) -o $@ $< -else - @$(missing) bison $< $@ -endif - -bootscanner.c: bootscanner.l -ifdef FLEX - $(FLEX) $(FLEXFLAGS) -o'$@' $< -else - @$(missing) flex $< $@ -endif - - # bootparse.c and bootscanner.c are in the distribution tarball, so # they are not cleaned here. diff --git a/src/backend/parser/Makefile b/src/backend/parser/Makefile index 1f48e16a76..0395bd5934 100644 --- a/src/backend/parser/Makefile +++ b/src/backend/parser/Makefile @@ -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: diff --git a/src/backend/replication/Makefile b/src/backend/replication/Makefile index 1f93ac1e5d..2dde0118a4 100644 --- a/src/backend/replication/Makefile +++ b/src/backend/replication/Makefile @@ -22,19 +22,5 @@ include $(top_srcdir)/src/backend/common.mk # repl_scanner is compiled as part of repl_gram repl_gram.o: repl_scanner.c -repl_gram.c: repl_gram.y -ifdef BISON - $(BISON) $(BISONFLAGS) -o $@ $< -else - @$(missing) bison $< $@ -endif - -repl_scanner.c: repl_scanner.l -ifdef FLEX - $(FLEX) $(FLEXFLAGS) -o'$@' $< -else - @$(missing) flex $< $@ -endif - # repl_gram.c and repl_scanner.c are in the distribution tarball, so # they are not cleaned here. diff --git a/src/backend/utils/misc/Makefile b/src/backend/utils/misc/Makefile index 08be3bd699..c7b745e513 100644 --- a/src/backend/utils/misc/Makefile +++ b/src/backend/utils/misc/Makefile @@ -28,13 +28,6 @@ include $(top_srcdir)/src/backend/common.mk # guc-file is compiled as part of guc guc.o: guc-file.c -guc-file.c: guc-file.l -ifdef FLEX - $(FLEX) $(FLEXFLAGS) -o'$@' $< -else - @$(missing) flex $< $@ -endif - # Note: guc-file.c is not deleted by 'make clean', # since we want to ship it in distribution tarballs. clean: |
