#
# Synchronisation libraries Makefile
#
# $Source: /proj/kroc/develop/examples/stdout/RCS/Makefile,v $
#
# $Id: Makefile,v 1.4 1997/03/30 20:55:48 djb1 Exp $
#
# (C) Copyright 1996, Dave Beckett <D.J.Beckett@ukc.ac.uk>,
# University of Kent at Canterbury, England
#

LIBDIR=../../lib
INCDIR=$(LIBDIR)

STDOUT_SRCS=stdout.occ
STDOUT_OBJS=stdout.o
STDOUT_TCOS=stdout.tco
STDOUT_LIB=stdout.lib
STDOUT_C_LIB=libstdout.a
STDOUT_INC=stdout.inc

STDIN_SRCS=stdin.occ
STDIN_OBJS=stdin.o
STDIN_TCOS=stdin.tco
STDIN_LIB=stdin.lib
STDIN_C_LIB=libstdin.a
STDIN_INC=stdin.inc

SRCS=$(STDOUT_SRCS)
OBJS=$(STDOUT_OBJS)
TCOS=$(STDOUT_TCOS)
LIBS=$(STDOUT_LIB) $(STDOUT_C_LIB)

#SRCS=$(STDOUT_SRCS) $(STDIN_SRCS)
#OBJS=$(STDOUT_OBJS) $(STDIN_OBJS)
#TCOS=$(STDOUT_TCOS) $(STDIN_TCOS)
#LIBS=$(STDOUT_LIB) $(STDOUT_C_LIB)\
#	$(STDIN_LIB) $(STDIN_C_LIB)

RANLIB=ranlib
#RANLIB=

.SUFFIXES: .occ
.occ.o:
	kroc -c $<

build: $(LIBS)
install: install_stdout_lib install_stdout_inc install_libstdout
#install: install_stdout_lib install_stdout_inc install_libstdout\
#	install_stdin_lib install_stdin_inc install_libstdin

test:
	@echo "Nothing to $@"

clean:
	-rm -f $(OBJS) $(TCOS) $(LIBS) *~ *.kt8 *.s *.o *.tco

install_stdout_lib: $(LIBDIR)/$(STDOUT_LIB)
$(LIBDIR)/$(STDOUT_LIB): $(STDOUT_LIB) 
	cp $(STDOUT_LIB) $(LIBDIR)/$(STDOUT_LIB)

install_stdout_inc: $(INCDIR)/$(STDOUT_INC)
$(INCDIR)/$(STDOUT_INC): $(STDOUT_INC) 
	cp $(STDOUT_INC) $(INCDIR)/$(STDOUT_INC)

install_libstdout: $(LIBDIR)/$(STDOUT_C_LIB)
$(LIBDIR)/$(STDOUT_C_LIB): $(STDOUT_C_LIB)
	cp $(STDOUT_C_LIB) $(LIBDIR)/$(STDOUT_C_LIB)
	@if [ "X$(RANLIB)" != "X" ]; then \
	  echo Running $(RANLIB) on $(LIBDIR)/$(STDOUT_C_LIB); \
	  $(RANLIB) $(LIBDIR)/$(STDOUT_C_LIB); \
	fi

install_stdin_lib: $(LIBDIR)/$(STDIN_LIB)
$(LIBDIR)/$(STDIN_LIB): $(STDIN_LIB) 
	cp $(STDIN_LIB) $(LIBDIR)/$(STDIN_LIB)

install_stdin_inc: $(INCDIR)/$(STDIN_INC)
$(INCDIR)/$(STDIN_INC): $(STDIN_INC) 
	cp $(STDIN_INC) $(INCDIR)/$(STDIN_INC)

install_libstdin: $(LIBDIR)/$(STDIN_C_LIB)
$(LIBDIR)/$(STDIN_C_LIB): $(STDIN_C_LIB)
	cp $(STDIN_C_LIB) $(LIBDIR)/$(STDIN_C_LIB)
	@if [ "X$(RANLIB)" != "X" ]; then \
	  echo Running $(RANLIB) on $(LIBDIR)/$(STDIN_C_LIB); \
	  $(RANLIB) $(LIBDIR)/$(STDIN_C_LIB); \
	fi

$(STDOUT_LIB): stdout.lbb $(STDOUT_OBJS)
	-rm -f stdout.lib
	ilibr -f stdout.lbb -o stdout.lib

$(STDOUT_C_LIB): $(STDOUT_LIB) $(STDOUT_OBJS)
	-rm -f $(STDOUT_C_LIB)
	ar rc $(STDOUT_C_LIB) $(STDOUT_OBJS) 
	@if [ "X$(RANLIB)" != "X" ]; then \
	  echo Running $(RANLIB) on $@; \
	  $(RANLIB) $@; \
	fi

$(STDIN_LIB): stdin.lbb $(STDIN_OBJS)
	-rm -f stdin.lib
	ilibr -f stdin.lbb -o stdin.lib

$(STDIN_C_LIB): $(STDIN_LIB) $(STDIN_OBJS)
	-rm -f $(STDIN_C_LIB)
	ar rc $(STDIN_C_LIB) $(STDIN_OBJS)
	@if [ "X$(RANLIB)" != "X" ]; then \
	  echo Running $(RANLIB) on $@; \
	  $(RANLIB) $@; \
	fi
