# *************************************************************
#	DATA: a replacement for library IS? (made at DIT/UPM)
# 	      (basic subset implemented by hand).
# *************************************************************
#***********************************
# (C) Copyright 1994; dit/upm
#  Distributed under the conditions stated in the
#  TOPO General Public License (see file LICENSE)
#***********************************

SPEC=	test
TNAME=	test_lbc
DNAME=	test_ldc

LOTLIB=	data
GLDLIB=	data.gld

INCDIRS= -I$(TOPOINC)
LIBDIRS= -L$(TOPOINC)
CFLAGS=-g $(INCDIRS)
CLIBS= -lotos -lkaos

OBJS=	$(SPEC).o $(TNAME).o $(DNAME).o bool.o nat.o int.o
TRGT=	$(SPEC)

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

$(DNAME).o:	$(DNAME).hh
$(TNAME).o:	$(TNAME).hh $(DNAME).hh
$(SPEC).o:	$(TNAME).hh $(DNAME).hh

$(DNAME).c $(DNAME).hh:	$(SPEC).lot $(GLDLIB) $(SPEC).ctx
	$(TOPOBIN)/topo $(SPEC) -v -d

$(TNAME).c $(TNAME).hh:	$(SPEC).lot $(GLDLIB) $(SPEC).ctx
	$(TOPOBIN)/topo $(SPEC) -v -t -g

$(SPEC).ctx:
	$(TOPOBIN)/toposet $(SPEC) -l $(LOTLIB)
	$(TOPOBIN)/toposet $(SPEC) -glad $(GLDLIB)
	$(TOPOBIN)/toposet $(SPEC) -dname $(DNAME)
	$(TOPOBIN)/toposet $(SPEC) -tname $(TNAME)

bool.o:	bool.hh
nat.o:	bool.hh nat.hh
int.o:	bool.hh nat.hh int.hh

clean tidy::
	rm -f *~ core topocore
	rm -f $(OBJS)
	rm -f $(SPEC).com

clean::
	$(TOPOBIN)/topo $(SPEC) -clean

tidy::
	rm -f $(TRGT)
	$(TOPOBIN)/topo $(SPEC) -tidy
	rm -f $(SPEC).ctx
	$(TOPOBIN)/topo $(LOTLIB) -tidy

#-----------------------------------------------------------------------
HDRS=	          $(TNAME).hh $(DNAME).hh bool.hh nat.hh int.hh
SRCS=	$(SPEC).c $(TNAME).c $(DNAME).c bool.c nat.c int.c

LINTFLAGS= -abhx $(INCDIRS)
LINTLIBS= $(TOPOLIB)/llib-lotos.ln $(TOPOLIB)/llib-lkaos.ln

lint:	$(SRCS) $(HDRS)
	$(LINT) $(LINTFLAGS) $(LINTLIBS) $(SRCS)
