next up previous
Next: A session Up: A detailed example Previous: The file expressionTree.y

The Makefile

# Makefile $CS447ROOT/yacc
# Marc Moreno Maza 
# Décembre 2002

SHELL = bash

# Files location
TOPDIR = $(PWD)
PSDIR = $(TOPDIR)/ps
SRCDIR = $(TOPDIR)/src
BINDIR = $(TOPDIR)/bin
TESTDIR = $(TOPDIR)/test

# Compilers, commands  and options
YACC = yacc
YACCO = -d
LEX = flex
LEXO = 
CC = gcc
CCO = -Wall -I./src -ll -o
PP = a2ps
PPO = -q -o
MV = mv
MV0 = -f 
RM = rm
RMO = -f

# All files that require building
SRCS = calculator

all:  clean bin ps

bin: $(BINTARS)

test: $(TESTTARGS) clean

ps: $(PSTARGS)

clean: 
	@(cd $(BINDIR); $(RM) $(RMO) *)
	@(cd $(SRCDIR); $(RM) $(RMO) *~)
	@(cd $(TESTDIR); $(RM) $(RMO) *~)
	@(cd $(TOPDIR); $(RM) $(RMO) *.c)
	@(cd $(TOPDIR); $(RM) $(RMO) *.h)
	@(cd $(PSDIR); $(RM) $(RMO) *)
	@(cd $(TOPDIR); $(RM) $(RMO) *~)

distrib: 

%.ps: 
	@($(PP) $(PPO) $(PSDIR)/`basename $*`.ps $(SRCDIR)/`basename $*`.l)

pdf:

html:

%.out:
	@($(YACC) $(YACCO) $(SRCDIR)/$*.y)
	@($(LEX) $(LEXO) $(SRCDIR)/$*.l)
	@($(CC) $(TOPDIR)/lex.yy.c  $(TOPDIR)/y.tab.c  $(CCO) $(BINDIR)/$*)

.DEFAULT : 
	@ echo "------------------------------------------------------------"
	@ echo "Building $< in $(BINDIR)"                                     
	@($(YACC) $(YACCO) $(SRCDIR)/$<.y)
	@($(LEX) $(LEXO) $(SRCDIR)/$<.l)
	@($(CC) $(TOPDIR)/lex.yy.c  $(TOPDIR)/y.tab.c  $(CCO) $(BINDIR)/$<)
	@(cd $(TOPDIR); $(RM) $(RMO) lex.yy.c y.tab.c y.tab.h)
	@ echo "------------------------------------------------------------"


next up previous
Next: A session Up: A detailed example Previous: The file expressionTree.y
Marc Moreno Maza
2004-12-02