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