# 
# Mach Operating System
# Copyright (c) 1992 Carnegie Mellon University
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
# CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
# 
# Carnegie Mellon requests users of this software to return to
# 
#  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
#  School of Computer Science
#  Carnegie Mellon University
#  Pittsburgh PA 15213-3890
# 
# any improvements or extensions that they make and grant Carnegie Mellon 
# the rights to redistribute these changes.
#  
# HISTORY
# $Log:	Makefile-mklinks,v $
# Revision 2.4  92/04/08  23:18:50  rpd
# 	Changed to link directly to the proper directory,
# 	instead of indirecting through an @sys link.
# 	[92/03/23            rpd]
# 
# 	Remove machine link before making it.
# 	[92/03/19            jvh]
# 
# Revision 2.3  92/03/05  22:45:40  rpd
# 	Changed to use double-colon rules.
# 	[92/02/28            rpd]
# 
# Revision 2.2  92/02/20  13:35:04  elf
# 	Created from Makefile-common.
# 	[92/02/10            rpd]
# 

# Makefile-mklinks has definitions and rules useful to Makefiles
# which must create 'machine' links in the install or release directories.


# The mkilinks target can be used to create 'machine' links
# in the install directory.  It is normally used with
#
#	MKILINKS = ...
#
#	install :: mkilinks ...

mkilinks ::
	@-for dir in ${MKILINKS;.*;${INSTALLDIR}/&}; do \
	  [ -d $${dir}/machine ] || \
	  { echo "linking $${dir}/machine"; \
	    ${RM} $${dir}/machine; \
	    ln -s ${cpu} $${dir}/machine; } \
	done

# The mkrlinks target can be used to create 'machine' links
# in the release directory.  It is normally used with
#
#	MKRLINKS = ${MKILINKS}
#
#	release :: mkrlinks ...

mkrlinks ::
	@-for dir in ${MKRLINKS;.*;${TRELEASEDIR}/&}; do \
	  [ -d $${dir}/machine ] || \
	  { echo "linking $${dir}/machine"; \
	    ${RM} $${dir}/machine; \
	    ln -s ${cpu} $${dir}/machine; } \
	done

# The mkhilinks and mkhrlinks targets are similar, except
# that they use HOST_INSTALLDIR and HOST_TRELEASEDIR.

mkhilinks ::
	@-for dir in ${MKHILINKS;.*;${HOST_INSTALLDIR}/&}; do \
	  [ -d $${dir}/machine ] || \
	  { echo "linking $${dir}/machine"; \
	    ${RM} $${dir}/machine; \
	    ln -s ${cpu} $${dir}/machine; } \
	done

mkhrlinks ::
	@-for dir in ${MKHRLINKS;.*;${HOST_TRELEASEDIR}/&}; do \
	  [ -d $${dir}/machine ] || \
	  { echo "linking $${dir}/machine"; \
	    ${RM} $${dir}/machine; \
	    ln -s ${cpu} $${dir}/machine; } \
	done
