# SPIN - Verification Software - Version 4.0 - January 2003
#
# Copyright (c) 1991-2003 by Lucent Technologies - Bell Laboratories
# All Rights Reserved.  This software is for educational purposes only.
# No guarantee is expressed or implied by the distribution of this code.
#
# The SPIN software is written by Gerard J. Holzmann, originally as part
# of ``Design and Validation of Protocols,'' ISBN 0-13-539925-4,
# 1991, Prentice Hall, Englewood Cliffs, NJ, 07632
# Send bug-reports and/or questions to: bugs@spinroot.com            
# The book is available from www.amazon.com
# [a more up-to-date book documenting Spin will appear in 2003]

# CC=gcc		# or any other ansi compatible c compiler
CC=cc -g -DNXT 		# -DNXT enables the X operator in LTL
CFLAGS=-ansi -D_POSIX_SOURCE	# on some systems add: -I/usr/include

#	on Solaris:	add -DSOLARIS
#	on PCs:		add -DPC
#	on HP-UX:	add -Aa to CFLAGS
#			and add $(CFLAGS) to the spin.o line: $(CC) $(CFLAGS) -c y.tab.c
#	on __FreeBSD__: omit -D_POSIX_SOURCE

YACC=yacc		# on Solaris: /usr/ccs/bin/yacc
YFLAGS=-v -d 		# creates y.output and y.tab.h

SPIN_OS= spin.o spinlex.o sym.o vars.o main.o ps_msc.o \
	mesg.o flow.o sched.o run.o pangen1.o pangen2.o \
	pangen3.o pangen4.o pangen5.o guided.o dstep.o \
	structs.o pc_zpp.o pangen6.o reprosrc.o

TL_OS=	tl_parse.o tl_lex.o tl_main.o tl_trans.o tl_buchi.o \
	tl_mem.o tl_rewrt.o tl_cache.o

spin:	$(SPIN_OS) $(TL_OS)
	$(CC) $(CFLAGS) -o spin $(SPIN_OS) $(TL_OS)

spin.o:	spin.y
	$(YACC) $(YFLAGS) spin.y
	$(CC) -c y.tab.c
	rm -f y.tab.c
	mv y.tab.o spin.o

$(SPIN_OS): spin.h

$(TL_OS): tl.h

main.o pangen2.o ps_msc.o: version.h
pangen1.o: pangen1.h pangen3.h
pangen2.o: pangen2.h pangen4.h pangen5.h

wrap:
	tar -cf - makefile *.c *.h *.y > spin4.0.tar

lclint:
	lclint -weak +trytorecover +posixlib dstep.c flow.c guided.c main.c mesg.c pangen1.c pangen2.c pangen3.c pangen4.c pangen5.c pangen6.c pc_zpp.c ps_msc.c run.c sched.c spinlex.c structs.c sym.c tl_buchi.c tl_cache.c tl_lex.c tl_main.c tl_mem.c tl_parse.c tl_rewrt.c tl_trans.c vars.c y.tab.c reprosrc.c > Out

clean:
	rm -f spin *.o y.tab.[ch] y.output y.debug spin.c
	rm -f pan.[chmotb] a.out core
