1 #-------------------------------------------------------------------------
5 # $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.40 2003/02/10 04:44:45 tgl Exp $
7 #-------------------------------------------------------------------------
9 subdir = src/backend/parser
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
13 override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
15 OBJS= analyze.o gram.o keywords.o parser.o parse_agg.o parse_clause.o \
16 parse_expr.o parse_func.o parse_node.o parse_oper.o parse_relation.o \
17 parse_type.o parse_coerce.o parse_target.o scansup.o
25 $(LD) $(LDREL) $(LDOUT) $@ $^
28 # scan is compiled as part of gram
29 gram.o: $(srcdir)/scan.c
32 # There is no correct way to write a rule that generates two files.
33 # Rules with two targets don't have that meaning, they are merely
34 # shorthand for two otherwise separate rules. To be safe for parallel
35 # make, we must chain the dependencies like this. The semicolon is
36 # important, otherwise make will choose the built-in rule for
39 $(srcdir)/gram.c: $(srcdir)/parse.h ;
41 # The sed hack is so that we can get the same error messages with
42 # bison 1.875 and later as we did with earlier bisons. Eventually,
43 # I suppose, we should re-standardize on "syntax error" --- in which
44 # case flip the sed translation, but don't remove it.
46 $(srcdir)/parse.h: gram.y
48 $(YACC) -d $(YFLAGS) $<
49 sed -e 's/"syntax error/"parse error/' < y.tab.c > $(srcdir)/gram.c
50 mv -f y.tab.h $(srcdir)/parse.h
53 @$(missing) bison $< $@
57 $(srcdir)/scan.c: scan.l
59 $(FLEX) $(FLEXFLAGS) -o'$@' $<
61 @$(missing) flex $< $@
65 # Force these dependencies to be known even without dependency info built:
67 gram.o keywords.o parser.o: $(srcdir)/parse.h
70 # gram.c, parse.h, and scan.c are in the distribution tarball, so they
71 # are not cleaned here.
73 rm -f SUBSYS.o $(OBJS)
74 # And the garbage that might have been left behind by partial build:
75 @rm -f y.tab.c y.tab.h lex.yy.c