]> granicus.if.org Git - postgresql/blob - src/backend/bootstrap/Makefile
3e47413d798baa8b58248a941c56bb4e4062e516
[postgresql] / src / backend / bootstrap / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile--
4 #    Makefile for the bootstrap module
5 #
6 # IDENTIFICATION
7 #    $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.20 2000/01/16 20:04:53 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...
18 #
19 #-------------------------------------------------------------------------
20
21 SRCDIR= ../..
22 include ../../Makefile.global
23
24 CFLAGS += -I..
25 ifdef MULTIBYTE
26 CFLAGS+= $(MBFLAGS)
27 endif
28
29 ifeq ($(CC), gcc)
30 CFLAGS+= -Wno-error
31 endif
32
33 BOOTYACCS= bootstrap_tokens.h bootparse.c
34
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
39 endif
40
41 all: SUBSYS.o
42
43 SUBSYS.o: $(OBJS)
44 ifneq ($(PORTNAME), qnx4)
45         $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
46 else
47         $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS1)
48 endif
49
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.
54
55 bootstrap.o: bootstrap_tokens.h
56
57 bootstrap_tokens.h bootparse.c: bootparse.y
58         $(YACC) $(YFLAGS) $<
59         grep -v "^#" boot.sed > sedfile
60         sed -f sedfile < y.tab.c > bootparse.c
61         mv y.tab.h bootstrap_tokens.h
62         rm -f y.tab.c sedfile
63
64 bootscanner.c: bootscanner.l
65         $(LEX) $<
66         grep -v "^#" boot.sed > sedfile
67         sed -f sedfile < lex.yy.c > bootscanner.c
68         rm -f lex.yy.c sedfile
69
70 clean:
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
74
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
79
80 ifeq (depend,$(wildcard depend))
81 include depend
82 endif
83