1#-------------------------------------------------------------------------
2#
3# Makefile for parser
4#
5# src/backend/parser/Makefile
6#
7#-------------------------------------------------------------------------
8
9subdir = src/backend/parser
10top_builddir = ../../..
11include $(top_builddir)/src/Makefile.global
12
13override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
14
15OBJS= analyze.o gram.o scan.o parser.o \
16      parse_agg.o parse_clause.o parse_coerce.o parse_collate.o parse_cte.o \
17      parse_enr.o parse_expr.o parse_func.o parse_node.o parse_oper.o \
18      parse_param.o parse_relation.o parse_target.o parse_type.o \
19      parse_utilcmd.o scansup.o
20
21include $(top_srcdir)/src/backend/common.mk
22
23
24# There is no correct way to write a rule that generates two files.
25# Rules with two targets don't have that meaning, they are merely
26# shorthand for two otherwise separate rules.  If we have an action
27# that in fact generates two or more files, we must choose one of them
28# as primary and show it as the action's output, then make all of the
29# other output files dependent on the primary, like this.  Furthermore,
30# the "touch" action is essential, because it ensures that gram.h is
31# marked as newer than (or at least no older than) gram.c.  Without that,
32# make is likely to try to rebuild gram.h in subsequent runs, which causes
33# failures in VPATH builds from tarballs.
34
35gram.h: gram.c
36	touch $@
37
38gram.c: BISONFLAGS += -d
39gram.c: BISON_CHECK_CMD = $(PERL) $(srcdir)/check_keywords.pl $< $(top_srcdir)/src/include/parser/kwlist.h
40
41
42scan.c: FLEXFLAGS = -CF -p -p
43scan.c: FLEX_NO_BACKUP=yes
44scan.c: FLEX_FIX_WARNING=yes
45
46
47# Force these dependencies to be known even without dependency info built:
48gram.o scan.o parser.o: gram.h
49
50
51# gram.c, gram.h, and scan.c are in the distribution tarball, so they
52# are not cleaned here.
53clean distclean maintainer-clean:
54	rm -f lex.backup
55