1 #-------------------------------------------------------------------------
4 # Makefile for the bootstrap module
7 # $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.20 2000/01/16 20:04:53 petere Exp $
10 # We must build bootparse.c and bootscanner.c with yacc and lex and sed,
11 # but bootstrap.c is part of the distribution.
13 # Another kinda weird Makefile cause we need two
14 # scanner/parsers in the backend and most yaccs and lexs
15 # don't have the prefix option.
17 # sed files are HACK CITY! - redo...
19 #-------------------------------------------------------------------------
22 include ../../Makefile.global
33 BOOTYACCS= bootstrap_tokens.h bootparse.c
35 OBJS= bootparse.o bootscanner.o bootstrap.o
36 ifeq ($(PORTNAME), qnx4)
37 # wlink currently crashes with bootstrap.o
38 OBJS1= bootparse.o bootscanner.o
44 ifneq ($(PORTNAME), qnx4)
45 $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
47 $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS1)
50 # bootstrap.o's dependency on bootstrap_tokens.h is computed by the
51 # make depend, but we state it here explicitly anyway because
52 # bootstrap_tokens.h doesn't even exist at first and if user fails to
53 # do make depend, we still want the build to succeed.
55 bootstrap.o: bootstrap_tokens.h
57 bootstrap_tokens.h bootparse.c: bootparse.y
59 grep -v "^#" boot.sed > sedfile
60 sed -f sedfile < y.tab.c > bootparse.c
61 mv y.tab.h bootstrap_tokens.h
64 bootscanner.c: bootscanner.l
66 grep -v "^#" boot.sed > sedfile
67 sed -f sedfile < lex.yy.c > bootscanner.c
68 rm -f lex.yy.c sedfile
71 rm -f SUBSYS.o $(OBJS)
72 # And the garbage that might have been left behind by partial build:
73 rm -f y.tab.h y.tab.c y.output lex.yy.c
75 # This is unusual: We actually have to build some of the parts before
76 # we know what the header file dependencies are.
77 dep depend: bootparse.c bootscanner.c bootstrap_tokens.h
78 $(CC) -MM $(CFLAGS) *.c >depend
80 ifeq (depend,$(wildcard depend))