|
1 | 1 | #------------------------------------------------------------------------- |
2 | 2 | # |
3 | | -# Makefile-- |
4 | | -# Makefile for the bootstrap module |
| 3 | +# Makefile for the bootstrap module |
5 | 4 | # |
6 | | -# IDENTIFICATION |
7 | | -# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.23 2000/06/07 16:26:37 petere Exp $ |
8 | | -# |
9 | | -# |
10 | | -# We must build bootparse.c and bootscanner.c with yacc and lex and sed, |
11 | | -# but bootstrap.c is part of the distribution. |
12 | | -# |
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. |
16 | | -# |
17 | | -# sed files are HACK CITY! - redo... |
| 5 | +# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.24 2000/07/19 16:29:47 petere Exp $ |
18 | 6 | # |
19 | 7 | #------------------------------------------------------------------------- |
20 | 8 |
|
21 | | -SRCDIR= ../.. |
22 | | -include $(SRCDIR)/Makefile.global |
| 9 | +subdir = src/backend/bootstrap |
| 10 | +top_builddir = ../../.. |
| 11 | +include $(top_builddir)/src/Makefile.global |
23 | 12 |
|
24 | | -ifeq ($(CC), gcc) |
| 13 | +ifeq ($(GCC), yes) |
25 | 14 | CFLAGS+= -Wno-error |
26 | 15 | endif |
27 | 16 |
|
28 | | -BOOTYACCS= bootstrap_tokens.h bootparse.c |
29 | | - |
| 17 | +# qnx4's wlink currently crashes with bootstrap.o |
30 | 18 | ifneq ($(PORTNAME), qnx4) |
31 | 19 | OBJS= bootparse.o bootscanner.o bootstrap.o |
32 | 20 | else |
33 | | -# qnx4's wlink currently crashes with bootstrap.o |
34 | 21 | OBJS= bootparse.o bootscanner.o |
35 | 22 | endif |
36 | 23 |
|
| 24 | + |
37 | 25 | # make sure bootstrap.o is built even on qnx4 |
38 | 26 | all: SUBSYS.o bootstrap.o |
39 | 27 |
|
40 | 28 | SUBSYS.o: $(OBJS) |
41 | | - $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) |
| 29 | + $(LD) $(LDREL) $(LDOUT) $@ $^ |
| 30 | + |
42 | 31 |
|
43 | | -# bootstrap.o's dependency on bootstrap_tokens.h is computed by the |
44 | | -# make depend, but we state it here explicitly anyway because |
45 | | -# bootstrap_tokens.h doesn't even exist at first and if user fails to |
46 | | -# do make depend, we still want the build to succeed. |
| 32 | +bootstrap.o bootscanner.c: $(srcdir)/bootstrap_tokens.h |
47 | 33 |
|
48 | | -bootstrap.o: bootstrap_tokens.h |
49 | 34 |
|
50 | | -bootstrap_tokens.h bootparse.c: bootparse.y |
| 35 | +# `sed' rules to remove conflicts between bootstrap scanner and parser |
| 36 | +# and the SQL scanner and parser. For correctness' sake the rules that |
| 37 | +# use this must depend on this Makefile. |
| 38 | +define sed-magic |
| 39 | +sed -e 's/^yy/Int_yy/g' \ |
| 40 | + -e 's/\([^a-zA-Z0-9_]\)yy/\1Int_yy/g' |
| 41 | +endef |
| 42 | + |
| 43 | + |
| 44 | +$(srcdir)/bootparse.c $(srcdir)/bootstrap_tokens.h: bootparse.y Makefile |
51 | 45 | $(YACC) -d $(YFLAGS) $< |
52 | | - grep -v "^#" boot.sed > sedfile |
53 | | - sed -f sedfile < y.tab.c > bootparse.c |
54 | | - mv y.tab.h bootstrap_tokens.h |
55 | | - rm -f y.tab.c sedfile |
| 46 | + $(sed-magic) < y.tab.c > $(srcdir)/bootparse.c |
| 47 | + $(sed-magic) < y.tab.h > $(srcdir)/bootstrap_tokens.h |
| 48 | + rm -f y.tab.c y.tab.h |
56 | 49 |
|
57 | | -bootscanner.c: bootscanner.l |
| 50 | +$(srcdir)/bootscanner.c: bootscanner.l Makefile |
58 | 51 | $(LEX) $(LFLAGS) $< |
59 | | - grep -v "^#" boot.sed > sedfile |
60 | | - sed -f sedfile < lex.yy.c > bootscanner.c |
61 | | - rm -f lex.yy.c sedfile |
| 52 | + $(sed-magic) < lex.yy.c > $@ |
| 53 | + rm -f lex.yy.c |
62 | 54 |
|
63 | 55 | clean: |
64 | 56 | rm -f SUBSYS.o $(OBJS) bootstrap.o |
65 | 57 | # And the garbage that might have been left behind by partial build: |
66 | | - rm -f y.tab.h y.tab.c y.output lex.yy.c |
| 58 | + @rm -f y.tab.h y.tab.c y.output lex.yy.c |
| 59 | + |
67 | 60 |
|
68 | 61 | # This is unusual: We actually have to build some of the parts before |
69 | 62 | # we know what the header file dependencies are. |
|
0 commit comments