]> granicus.if.org Git - postgresql/blob - src/backend/bootstrap/Makefile
a3e8fa168586716aa5ebe9fec45eae95eaaa5f40
[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.14 1998/07/24 03:31:06 scrappy 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 MB
26 CFLAGS += -DMB=$(MB)
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
37 all: SUBSYS.o
38
39 SUBSYS.o: $(OBJS)
40         $(LD) -r -o SUBSYS.o $(OBJS)
41
42 # bootstrap.o's dependency on bootstrap_tokens.h is computed by the
43 # make depend, but we state it here explicitly anyway because 
44 # bootstrap_tokens.h doesn't even exist at first and if user fails to 
45 # do make depend, we still want the build to succeed.
46
47 bootstrap.o: bootstrap_tokens.h
48
49 bootstrap_tokens.h bootparse.c: bootparse.y
50         $(YACC) $(YFLAGS) $<
51         grep -v "^#" boot.sed > sedfile
52         sed -f sedfile < y.tab.c > bootparse.c
53         mv y.tab.h bootstrap_tokens.h
54         rm -f y.tab.c sedfile
55
56 bootscanner.c: bootscanner.l
57         $(LEX) $<
58         grep -v "^#" boot.sed > sedfile
59         sed -f sedfile < lex.yy.c > bootscanner.c
60         rm -f lex.yy.c sedfile
61
62 clean:
63         rm -f SUBSYS.o $(OBJS) bootparse.c bootstrap_tokens.h bootscanner.c
64 # And the garbage that might have been left behind by partial build:
65         rm -f y.tab.h y.tab.c y.output lex.yy.c
66
67 # This is unusual:  We actually have to build some of the parts before
68 # we know what the header file dependencies are.  
69 dep depend: bootparse.c bootscanner.c bootstrap_tokens.h
70         $(CC) -MM $(CFLAGS) *.c >depend
71
72 ifeq (depend,$(wildcard depend))
73 include depend
74 endif
75