# **********************************************************************
#	GLAD: General Language to Annotate Data, code generation.
# **********************************************************************
#***********************************
# (C) Copyright 1992-1993; dit/upm
#  Distributed under the conditions stated in the
#  TOPO General Public License (see file LICENSE)
#***********************************
# $Id: makefile,v 1.16 1995/01/11 12:05:58 lotos Exp $
#***********************************

TOOL=	glad
TRGT=	glad

INCDIRS= -I$(EPSINC) -I$(TOPOINC)
LIBDIRS= -L$(EPSLIB) -L$(TOPOLIB)
CFLAGS= $(CF_DBX) $(INCDIRS)
CLIBS= -lcast -lrag

DESC=	glad.desc process.desc token.desc support.desc input.desc basic.desc
HDRS=	glad.hh process.hh token.hh support.hh input.hh basic.hh
CODE=	glad.c process.c token.c support.c input.c basic.c
OBJS=	glad.o process.o token.o support.o input.o basic.o gram.o rag.o


$(TRGT):	$(OBJS)
	$(CC) $(CFLAGS) $(LIBDIRS) -o $@ $(OBJS) $(CLIBS)

COLOURS_H=	$(TOPOINC)/colours.h
COLOURS_C=	$(TOPOINC)/colours.c
GLAD_HH=	basic.hh glad.hh
SUPPORT_HH=	nodes.h grc.h support.hh $(COLOURS_H)

glad.o:		$(GLAD_HH) $(SUPPORT_HH) process.hh
process.o:	$(GLAD_HH) $(SUPPORT_HH) token.hh process.hh
token.o:	$(GLAD_HH) input.hh $(SUPPORT_HH) token.hh
support.o:	$(GLAD_HH) $(SUPPORT_HH) annots.c $(COLOURS_C)
input.o:	$(GLAD_HH) input.hh
basic.o:	$(GLAD_HH) basic.hh
gram.o:		$(GLAD_HH) $(SUPPORT_HH) token.hh
rag.o:		$(GLAD_HH) $(SUPPORT_HH) process.hh

install::	$(TRGT)
	cp $(TRGT) $(TOPOBIN)/$(TRGT)
	chmod a+x $(TOPOBIN)/$(TRGT)

install::	internal.gld
	cp internal.gld $(TOPOSTDLIB)/internal.gld

install::	lexical.gld
	cp lexical.gld $(TOPOSTDLIB)/lexical.gld

install::
	touch install

gram.c:	gram.y
	-chmod u+w $@
	-$(YACC) $(YFLAGS) gram.y && mv y.tab.c $@

clean::
	-rm -f $(TRGT)
	-rm -f $(OBJS)
	-rm -f *~ core

#------------------------------------------------------------------
