#*****************************************************************
#**                                                             **
#**             (C) Copyright 1992 the Regents of the           **
#**        University of California.  All Rights Reserved.      **
#**                                                             **
#**        This work was produced under the sponsorship of      **
#**         the U.S. Department of Energy.  The Government      **
#**                retains certain rights therein.              **
#**                                                             **
#**                         Written by                          **
#**         Distributed Programming Environments Project        **
#**           Computer Software and Networking Division,        **
#**                   Livermore Computer Center,                **
#**            Lawrence Livermore National Laboratory           **
#**                                                             **
#*****************************************************************

#	sccsid:		"@(#)Makefile	1.11 10/26/92 09:29:29 LLNL "

#
#	Make messages.h and messages.o from errorfile
#

#
# Note:  this make file should only be invoked by make files above
# this one in the ELROS tree.
#
# The following macro must be appropriately defined.
#
#   RO_RUNTIME_DIR - directory path to ELROS runtime
#

include ../../Make.Defaults

#
# Paths and files
#
INCLPATH=	$(RO_RUNTIME_DIR)/include
I	=	$(INCLPATH)/elros/

MSG_HDR	=	$(I)messages.h
MSG_OBJ	=	../messages.o
MSG_IN	=	../errorfile

DISTFILES=	Makefile message_build.c message_verify.c

#
# Targets
#
verified_messages:	$(MSG_IN) $(MSG_OBJ) message_verify
	message_verify

message_verify:		message_verify.c $(MSG_HDR) $(MSG_OBJ)
	$(CC) $(COPTS) -I$(INCLPATH) message_verify.c
	$(LD) -o message_verify message_verify.$(OSUFFIX) $(MSG_OBJ) $(CLIBS)

$(MSG_OBJ):	messages.c $(MSG_HDR)
	$(CC) $(COPTS) $(RO_SWITCHES) -I$(INCLPATH) messages.c
	$(MV) messages.o $(MSG_OBJ)

messages.c $(MSG_HDR):	$(MSG_IN) message_build
	message_build $(MSG_IN) messages.c $(MSG_HDR)

message_build:	message_build.c
	$(CC) -o message_build message_build.c

#
# For the "package" target, the following macro must be defined as a 
# command line argument.
#
#    RO_DIST_DIR - directory where distribution files are to be copied
#
package: $(DISTFILES)
	$(CP) -p $(DISTFILES) $(RO_DIST_DIR)

#
# For the "install" target, the following macro must be appropriately
# defined.
#
#   RO_INSTALL_DIR - directory where installed files should be copied
#
MY_INSTALL_DIR=	$(RO_INSTALL_DIR)/runtime/messages

install: $(DISTFILES) $(MY_INSTALL_DIR)
	$(RM) $(MY_INSTALL_DIR)/*
	$(FOR) i in $(DISTFILES); $(DO) ( \
		$(CP) $$i $(MY_INSTALL_DIR); \
		$(CHMOD) 444 $(MY_INSTALL_DIR)/$$i; \
	); $(DONE)
