Makefile 2.01 KB
Newer Older
1 2 3 4 5 6
#-------------------------------------------------------------------------
#
# Makefile--
#    Makefile for the bootstrap module
#
# IDENTIFICATION
7
#    $Header: /cvsroot/pgsql/src/backend/bootstrap/Makefile,v 1.9 1997/06/11 01:05:48 scrappy Exp $
8 9 10 11 12 13 14 15 16 17 18 19 20
#
#
# 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...
#
#-------------------------------------------------------------------------

21
SRCDIR= ../..
22 23
include ../../Makefile.global

24 25 26
INCLUDE_OPT= -I.. \
             -I../port/$(PORTNAME) \
             -I../../include
27

28 29
CFLAGS+= $(INCLUDE_OPT)  

Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
30
ifeq ($(CC), gcc)
31 32
CFLAGS+= -Wno-error
endif
33

34 35 36
BOOTYACCS= bootstrap_tokens.h bootparse.c

OBJS= bootparse.o bootscanner.o bootstrap.o 
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

all: SUBSYS.o

SUBSYS.o: $(OBJS)
	ld -r -o SUBSYS.o $(OBJS)

# 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) $<
52 53
	grep -v "^#" boot.sed > sedfile
	sed -f sedfile < y.tab.c > bootparse.c
54
	mv y.tab.h bootstrap_tokens.h
55
	rm -f y.tab.c sedfile
56 57 58

bootscanner.c: bootscanner.l
	$(LEX) $<
59 60 61
	grep -v "^#" boot.sed > sedfile
	sed -f sedfile < lex.yy.c > bootscanner.c
	rm -f lex.yy.c sedfile
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

clean:
	rm -f SUBSYS.o $(OBJS) bootparse.c bootstrap_tokens.h bootscanner.c
# 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: bootparse.c bootscanner.c bootstrap_tokens.h
	$(CC) -MM $(INCLUDE_OPT) *.c >depend

ifeq (depend,$(wildcard depend))
include depend
endif