1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for the bootstrap module
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.20 2000/01/16 20:04:53 petere Exp $
#
#
# We must build bootparse.c and bootscanner.c with yacc and lex and sed,
# but bootstrap.c is part of the distribution.
#
# Another kinda weird Makefile cause we need two
# scanner/parsers in the backend and most yaccs and lexs
# don't have the prefix option.
#
# sed files are HACK CITY! - redo...
#
#-------------------------------------------------------------------------
SRCDIR= ../..
include ../../Makefile.global
CFLAGS += -I..
ifdef MULTIBYTE
CFLAGS+= $(MBFLAGS)
endif
ifeq ($(CC), gcc)
CFLAGS+= -Wno-error
endif
BOOTYACCS= bootstrap_tokens.h bootparse.c
OBJS= bootparse.o bootscanner.o bootstrap.o
ifeq ($(PORTNAME), qnx4)
# wlink currently crashes with bootstrap.o
OBJS1= bootparse.o bootscanner.o
endif
all: SUBSYS.o
SUBSYS.o: $(OBJS)
ifneq ($(PORTNAME), qnx4)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
else
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS1)
endif
# bootstrap.o's dependency on bootstrap_tokens.h is computed by the
# make depend, but we state it here explicitly anyway because
# bootstrap_tokens.h doesn't even exist at first and if user fails to
# do make depend, we still want the build to succeed.
bootstrap.o: bootstrap_tokens.h
bootstrap_tokens.h bootparse.c: bootparse.y
$(YACC) $(YFLAGS) $<
grep -v "^#" boot.sed > sedfile
sed -f sedfile < y.tab.c > bootparse.c
mv y.tab.h bootstrap_tokens.h
rm -f y.tab.c sedfile
bootscanner.c: bootscanner.l
$(LEX) $<
grep -v "^#" boot.sed > sedfile
sed -f sedfile < lex.yy.c > bootscanner.c
rm -f lex.yy.c sedfile
clean:
rm -f SUBSYS.o $(OBJS)
# And the garbage that might have been left behind by partial build:
rm -f y.tab.h y.tab.c y.output lex.yy.c
# This is unusual: We actually have to build some of the parts before
# we know what the header file dependencies are.
dep depend: bootparse.c bootscanner.c bootstrap_tokens.h
$(CC) -MM $(CFLAGS) *.c >depend
ifeq (depend,$(wildcard depend))
include depend
endif