aboutsummaryrefslogtreecommitdiff
path: root/src/backend/bootstrap/Makefile
blob: 61f9d2f1a8666aa243faa704ff456b9bf41795b0 (plain)
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
#-------------------------------------------------------------------------
#
# Makefile for the bootstrap module
#
# $PostgreSQL: pgsql/src/backend/bootstrap/Makefile,v 1.32 2003/11/29 19:51:40 pgsql Exp $
#
#-------------------------------------------------------------------------

subdir = src/backend/bootstrap
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global

override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)

# qnx4's wlink currently crashes with bootstrap.o
ifneq ($(PORTNAME), qnx4)
OBJS= bootparse.o bootstrap.o 
else
OBJS= bootparse.o
endif


# make sure bootstrap.o is built even on qnx4
all: SUBSYS.o bootstrap.o

SUBSYS.o: $(OBJS)
	$(LD) $(LDREL) $(LDOUT) $@ $^


bootstrap.o bootparse.o: $(srcdir)/bootstrap_tokens.h

# bootscanner is compiled as part of bootparse
bootparse.o: $(srcdir)/bootscanner.c

# `sed' rules to remove conflicts between bootstrap scanner and parser
# and the SQL scanner and parser. For correctness' sake the rules that
# use this must depend on this Makefile.
define sed-magic
sed -e 's/^yy/Int_yy/g' \
    -e 's/\([^a-zA-Z0-9_]\)yy/\1Int_yy/g'
endef


$(srcdir)/bootparse.c: $(srcdir)/bootstrap_tokens.h ;

$(srcdir)/bootstrap_tokens.h: bootparse.y Makefile
ifdef YACC
	$(YACC) -d $(YFLAGS) $<
	$(sed-magic) < y.tab.c > $(srcdir)/bootparse.c
	$(sed-magic) < y.tab.h > $(srcdir)/bootstrap_tokens.h
	rm -f y.tab.c y.tab.h
else
	@$(missing) bison $< $@
endif

$(srcdir)/bootscanner.c: bootscanner.l Makefile
ifdef FLEX
	$(FLEX) $(FLEXFLAGS) $<
	$(sed-magic) lex.yy.c > $@
	rm -f lex.yy.c
else
	@$(missing) flex $< $@
endif

clean:
	rm -f SUBSYS.o $(OBJS) bootstrap.o
# 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