#
# The Verus Model Checking System
# Copyright (c) 1997 Carnegie Mellon University
# All Rights Reserved. See file license.txt for details.
#
#
# Makefile for Verus
#
# Sergio Campos -- 1997
#
#
# In order to build Verus do:
#
# cd ../../obj/verus (or appropriate obj directory - 
#                                          change SRCDIR appropriately)
# make -f ../../src/verus [clean]
#

INCLUDEDIR = $(HOME)/include
LIBDIR = $(HOME)/lib
SRCDIR = $(HOME)/src/verus
OBJDIR = $(HOME)/obj/verus

VPATH = .:$(SRCDIR)

CC = gcc

LIBS = -lbdd -lmem -lm

#
# -g: generates gdb info.
# -I<dir>: include <dir> in the search path for files.
#
CFLAGS  = -g -I$(SRCDIR) -I. -I$(INCLUDEDIR) -Wall -ansi

# CFLAGS2 does not include -Wall -ansi for lex and yacc peace of mind.
CFLAGS2 = -g -I$(SRCDIR) -I. -I$(INCLUDEDIR)

OBJS = tokens.o grammar.o symbols.o error.o compile.o \
       verus.o bdd.o integer.o modcheck.o

EXEC = verus


$(EXEC): $(OBJS)
	rm -f $(EXEC)
	$(CC) $(CFLAGS) -o $(EXEC) $(OBJS) -L$(LIBDIR) $(LIBS)

tokens.c: tokens.lex
	rm -f tokens.c
	lex -t $(SRCDIR)/tokens.lex > tokens.c

grammar.c: grammar.y
	rm -f grammar.c y.output y.tab.h y.tab.c
	yacc -v -d $(SRCDIR)/grammar.y
	mv y.tab.c grammar.c

#
# tokens.c includes y.tab.h that is generated by yacc
#
tokens.o: tokens.c grammar.c
	$(CC) -c $(CFLAGS2) $<

grammar.o: grammar.c
	$(CC) -c $(CFLAGS2) $<

.c.o:
	$(CC) -c $(CFLAGS) $<


default: $(EXEC)

clean:
	rm -f $(OBJS) $(EXEC) tokens.c grammar.c y.output y.tab.h y.tab.c

depend: 
	makedepend -- $(CFLAGS) $(SRCDIR)/*.c
#	cp $(SRCDIR)/Makefile $(OBJDIR)
#	gcc -M $(CFLAGS) $(SRCDIR)/*.c > ($OBJDIR)/MMakefile



# DO NOT DELETE
