Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The Makefile runs the lexer and parser through flex and bison, respectively, and compiles them together. The dependencies take care of generating and compiling the scanner, including the bison-generated header file.
# Makefile for pmysql
CC = cc -g
LEX = flex
YACC = bison
CFLAGS = -DYYDEBUG=1
PROGRAMS5 = pmysql
all: ${PROGRAMS5}
# chapter 5
pmysql: pmysql.tab.o pmysql.o
${CC} -o $@ pmysql.tab.o pmysql.o
pmysql.tab.c pmysql.tab.h: pmysql.y
${YACC} -vd pmysql.y
pmysql.c: pmysql.l
${LEX} -o $*.c $<
pmysql.o: pmysql.c pmysql.tab.h
.SUFFIXES: .pgm .l .y .c