######################################################################### 
#									# 
#   File: scorpion/src/gentransitions/Makefile 
#				 					# 
#   Copyright (C) 1991 Karen Shannon
#									# 
#   The Scorpion System is free software in the public domain; you can  # 
#   redistribute it and/or modify it as you wish. We ask that you 	# 
#   retain credits referencing the University of Arizona and that you	# 
#   identify any changes you make.					# 
#									# 
#   Report problems to scorpion-project@cs.arizona.edu			# 
#   Direct all inquiries to:	The Scorpion Project			# 
#				Department of Computer Science		# 
#				Gould-Simpson Building			# 
#				University of Arizona			# 
#				Tucson, AZ 85721			# 
#				U.S.A.					# 
#									# 
#   Revision Log:							# 
#	$Log:$ 
#									# 
#   Edit Log:								# 
#									# 
######################################################################### 


# IMPORTED VARIABLES
SHELL=/bin/sh
BINDIR=/usr/local/scorpion/bin
LIBDIR=/usr/local/scorpion/lib
INCDIR=/usr/local/scorpion/include
SRCDIR=/usr/local/scorpion/src
SPECSDIR=/usr/local/scorpion/src/specs
CC=cc
IDLC=$(BINDIR)/idlc
PC=pc
CFLAGS=-I$(INCDIR)
IDLCFLAGS=-v
PFLAGS=
CP=cp
MV=mv
RM=rm -f
LEX=lex
MACHINE=sparc
MAKE=make
YACC=yacc

LINT=/usr/bin/lint
LINTINC=-I$(INCDIR)
LINTFLAGS=-abx

UTILITYVARS='CC=$(CC)' 'IDLC=$(IDLC)' 'PC=$(PC)' 'CFLAGS=$(CFLAGS)' \
	      'IDLCFLAGS=$(IDLCFLAGS)' 'PFLAGS=$(PFLAGS)' 'CP=$(CP)' \
	      'MV=$(MV)' 'RM=$(RM)' 'LEX=$(LEX)' 'MAKE=$(MAKE)' \
	      'YACC=$(YACC)'
CI=ci
CO=co -l
INSTALL=install


# LOCAL VARIABLES
LINTSRC=main.c gentransitions.c
LINTLIB=$(LIBDIR)/lintlib/llib-llibidl.ln
LIB=$(LIBDIR)/libidl.a
IDLCFLAGSLOC=-I$(SPECSDIR) -nc -h -k
OBJ=main.o

#####################################################################

gentransitions: gentransitions.h $(OBJ) gentransitions.o
	$(CC)  $(CFLAGS) -o gentransitions gentransitions.o $(OBJ) $(LIB)

gentransitions.h: gentransitions.idl $(SPECSDIR)/filetransition.idl
	$(IDLC) $(IDLCFLAGS) $(IDLCFLAGSLOC) gentransitions.idl

System: gentransitions

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

gentransitions.o : gentransitions.c gentransitions.h 
main.o : main.c gentransitions.h 

Checkout:
	cd $(SRCDIR)/idlc/test; make Semtest.c
	$(RM) test/out2
	-if (test "$(MACHINE)" = "vax" -o "$(MACHINE)" = "mips" ) then \
                cd test; cp out1.vax out1; \
	elif (test "$(MACHINE)" = "sequent") then \
                cd test; cp out1.vax out1; \
	elif (test "$(MACHINE)" = "next") then \
                cd test; cp out1.next out1; \
	elif (test "$(MACHINE)" = "mips") then \
                cd test; cp out1.vax out1; \
	elif (test "$(MACHINE)" = "hp9000") then \
                cd test; cp out1.hp out1; \
        else \
		cd test; cp out1.sun out1; \
        fi
	cd $(SRCDIR)/idlc/test; /lib/cpp -I$(INCDIR) Semtest.c \
		| sed '1,$$s*$(INCDIR)/**' | $(BINDIR)/gentransitions \
		  > $(SRCDIR)/gentransitions/test/out2
	sh -c 'cmp -s $(SRCDIR)/gentransitions/test/out1 $(SRCDIR)/gentransitions/test/out2 &&(echo "files test/out1 test/out2 agree"; echo "gentransitions Passed Installation Check") || (echo "*** gentransitions Failed Installation Check"; echo "test/out1 and test/out2 disagree") '

Install:
	$(RM) $(BINDEST)/gentransitions
	$(INSTALL) gentransitions $(BINDEST)

gentransitions.o: gentransitions.h gentransitions.c

Clean:
	$(RM) *.o a.out core *.list *.Cdl

Ci:
	$(CI) main.c gentransitions.idl

Co:
	$(CO) main.c gentransitions.idl

$(OBJ): gentransitions.h

DelSrc:
	$(RM) *.c *.h *.idl

Lint:
	$(LINT) $(LINTFLAGS) $(LINTINC) $(LINTLIB) $(LINTSRC)
