######################################################################### 
#									# 
#   File: scorpion/src/idlc/backend/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
INCDIR=/usr/local/scorpion/include
BINDIR=/usr/local/scorpion/bin
LIBDIR=/usr/local/scorpion/lib
SPECSDIR=/usr/local/scorpion/src/specs

CC=cc
IDLC=$(BINDIR)/idlc
PC=pc
IDLCFLAGS=-v
CFLAGS=-I$(INCDIR)
PFLAGS=
CP=cp
MV=mv
RM=rm -f
LEX=lex
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
PROTMASK=755
OWNER=bin
GROUP=local/scorpion
INSTALL=install -c -m $(PROTMASK) -o $(OWNER) -g $(GROUP) -s

# LOCAL VARIABLES
CANDIR=$(SPECSDIR)/Candle
UNCCANDIR=../specs
LIB=$(LIBDIR)/libidl.a $(LIBDIR)/liberr.a
LINTLIB=$(LIBDIR)/lintlib/llib-llibidl.ln $(LIBDIR)/lintlib/llib-lliberr.ln
IDLCFLAGSLOC=-I$(CANDIR) -I$(SPECSDIR) -I$(UNCCANDIR) -nc -h -k
SRC=main.c gencfile.c gencfile2.c misc.c error.c flags.c  attr.c\
	genpfile.c class.c  csetseq.c stat.c macros.h Backend.idl

OBJ=main.o gencfile.o gencfile2.o misc.o error.o flags.o  attr.o\
	genpfile.o class.o csetseq.o stat.o

LINTSRC=main.c gencfile.c gencfile2.c misc.c error.c flags.c  attr.c \
 	  genpfile.c class.c  csetseq.c stat.c Backend.c

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

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

System :  IDLcg

Install:
	$(RM) $(LIBDEST)/IDLcg
	$(INSTALL) IDLcg $(LIBDEST)

Backend.h: Backend.idl $(CANDIR)/CandleSyntax.idl $(CANDIR)/CandleSemantic.idl \
	   $(CANDIR)/CandleRep.idl \
	   $(CANDIR)/Candle.idl $(CANDIR)/CandleContext.idl \
	   $(UNCCANDIR)/UNCCandleSyntax.idl $(UNCCANDIR)/UNCCandleSemantic.idl \
	   $(UNCCANDIR)/UNCCandleRep.idl $(CANDIR)/UNCCandle.idl \
	   $(CANDIR)/CandleRep.idl
		$(IDLC) $(IDLCFLAGS) $(IDLCFLAGSLOC) Backend.idl

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

Backend.o : Backend.c Backend.h
attr.o : attr.c Backend.h 
class.o : class.c Backend.h macros.h error.h 
csetseq.o : csetseq.c Backend.h macros.h error.h 
error.o : error.c error.h 
flags.o : flags.c Backend.h macros.h error.h 
gencfile.o : gencfile.c Backend.h macros.h error.h misc.h genpfile.h gencfile2.h
gencfile2.o : gencfile2.c Backend.h macros.h error.h 
genpfile.o : genpfile.c Backend.h macros.h error.h flags.h gencfile2.h 
main.o : main.c Backend.h macros.h error.h misc.h gencfile.h genpfile.h gencfile2.h flags.h 
misc.o : misc.c Backend.h macros.h error.h gencfile.h 
stat.o : stat.c Backend.h macros.h error.h 

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

$(OBJ): Backend.h macros.h

# Do not know if Backend.c and Backend.h can be deleted.
Ci: 
	$(CI) $(SRC) Backend.h Backend.c
Co: 
	$(CO) $(SRC) Backend.h Backend.c
Copy:
	mkdir $(COPYDIR)/backend
	$(CP) $(SRC) Backend.c Backend.h README $(COPYDIR)/backend

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

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