#!/bin/sh
# $Log: mkstruct,v $
# Revision 1.45  1997/07/08 12:20:21  jont
# [Bug #20089]
# Remove use of .compound files
#
# Revision 1.44  1997/05/14  10:50:52  matthew
# Adding gui_test_compiler
#
# Revision 1.43  1997/04/23  12:47:03  jont
# [Bug #20011]
# Remove stuff to do with MLWimages which is no longer needed
#
# Revision 1.42  1997/04/02  14:26:38  johnh
# Added 2 subcompounds (demos and break-trace) of MLWgui_tests.
#
# Revision 1.41  1997/04/01  09:00:57  daveb
# Added MLWgui_tests and its sub-compounds.
#
# Revision 1.40  1997/01/31  11:36:57  jont
# [Bug #0]
# Link linux to linux_elf in licshar
#
# Revision 1.39  1997/01/07  14:01:06  matthew
# Adding benchmarks directory
#
# Revision 1.38  1996/12/18  16:58:33  daveb
# Moved MLW/src/test_suite to MLW/test_suite.
#
# Revision 1.37  1996/10/17  12:57:55  jont
# Merging in license server stuff
#
# Revision 1.36.2.2  1996/10/08  13:54:12  nickb
# Add MLWrts_license .compound files.
#
# Revision 1.36.2.1  1996/10/07  16:37:56  hope
# branched from 1.36
#
# Revision 1.36  1996/08/08  12:43:30  andreww
# Adding entry for the latest subcompound MLWtest_suite-debugger.
#
# Revision 1.35  1996/06/10  14:59:21  jont
# Add stuff to deal with MLWtest_suite-{basis,hsell}
#
# Revision 1.34  1996/04/19  10:19:46  jont
# initbasis moves to basis
#
# Revision 1.33  1995/10/19  13:52:56  daveb
# Added symbolic link for app-defaults/MLWorks-fonts.
#
# Revision 1.32  1995/07/28  08:37:46  matthew
# Removing mention of MLWlibrary
#
# Revision 1.31  1995/07/26  15:39:16  matthew
# Adding mswindows and gui directories
#
# Revision 1.30  1995/02/23  14:13:16  brianm
# Add new compound MLWinitbasis
#
# Revision 1.29  1995/02/22  12:43:18  brianm
# Add new compound MLWforeign
#
# Revision 1.28  1995/02/08  14:13:04  jont
# Remove parser directory link creation, no longer needed
# Also remove creation of .compound files in moribund directories
# i386-images and mips-images
#
# Revision 1.27  1994/12/08  18:01:28  jont
# Add new compounds MLWunix and MLWwin_nt. Add new link system
#
# Revision 1.26  1994/09/15  17:29:25  jont
# Add creation of parser link to i386-images
#
# Revision 1.25  1994/09/06  15:59:21  daveb
# Add creation of .compound for MLWdemo.
#
# Revision 1.24  1994/09/01  10:57:03  jont
# Add creation of .compound for MLWi386
# Add creation of .compound for MLWi386-images
#
# Revision 1.23  1994/06/09  15:17:31  nickh
# Better .compound awareness
#
# Revision 1.22  1994/03/08  11:50:40  daveb
# Added scripts to list of compounds.
#
# Revision 1.21  1994/03/03  15:07:39  daveb
# Merging Jon's change back in, after I foolishly deleted it.
#
# Revision 1.20  1994/03/03  11:19:13  daveb
# Removed bogus reference to src/rts/storeman/auditing
#
# Revision 1.19  1994/03/02  12:39:44  daveb
# Added commands to create .compound files in each directory.
# Tried to do this with awk, but it complained about too many open files.
#
# Revision 1.18  1994/03/02  11:51:42  jont
# Add link in mips-images
#
# Revision 1.17  1994/02/04  11:18:30  daveb
# Converted to Hope.  Doesn't create the file hierarchy anymore, just
# adds the necessary symbolic links.
#
# Revision 1.16  1992/08/26  16:57:25  davidt
# Put in some extra tests to avoid errors when trying to
# create directories which already exists. Also made it
# be a bit quieter when it isn't creating anything.
#
# Revision 1.15  1992/08/26  14:39:00  matthew
# Added parser/ml-tables directory and link in images directory
#
# Revision 1.14  1992/08/14  11:08:19  richard
# Corrected links in storeman directory.
#
# Revision 1.13  1992/08/11  07:59:53  richard
# Added rts/storeman directories.
#
# Revision 1.12  1992/08/10  19:21:27  davidt
# Changed to use the dirs file to get the list of directories.
#
# Revision 1.11  1992/08/10  12:36:04  davidt
# Add test directory to list of directories.
#
# Revision 1.10  1992/08/06  13:01:12  jont
# Added creation of images directory
#
# Revision 1.9  1992/06/18  12:08:03  jont
# Added debugger and interpreter directories
#
# Revision 1.8  1991/11/13  14:54:11  jont
# Added creation of rts and sparc
#
# Revision 1.7  91/11/11  16:42:42  jont
# Added rts to list of manufactured directories
# 
# Revision 1.6  91/08/22  09:29:56  jont
# Added lexer to RCS structure
# 
# Revision 1.5  91/08/07  18:41:09  jont
# Added harp directory, and linked mir to it
# 
# Revision 1.4  91/07/09  17:35:46  jont
# Added new directories and protection for already existing ones
# 
# Revision 1.3  91/06/21  12:36:06  jont
# Stop copying lexer, now in coall
# 
# Revision 1.2  91/06/13  11:32:23  jont
# tidied up a bit
# 
# Copyright 2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

if [ "$#" -ne 0 ]; then
  echo Usage: mkstruct
  exit 1
fi

PWD=`pwd`
top=`basename $PWD`
ok=0

if [ "$top" = "MLW" ]; then
    ok=1
fi
if [ -d "MLW" ]; then
    ok=1
    cd MLW || ok=0
fi

if [ $ok -eq 1 ]; then
    # Keep as relative as possible.
    [ \! -h src/machine ]       && ln -s sparc src/machine
    [ \! -h src/mir ]           && ln -s harp src/mir
    [ \! -h src/winsys ]        && ln -s motif src/winsys
    [ \! -h src/system ]        && ln -s unix src/system
    [ \! -h src/app-defaults/MLWorks-fonts ]  && \
         ln -s MLWorks-normal-fonts src/app-defaults/MLWorks-fonts
    [ \! -h src/rts/license/licshar/makedefs/linux_elf ] && \
         ln -s linux src/rts/license/licshar/makedefs/linux_elf
else
    echo mkstruct: Expecting to find MLW directory.
fi

exit
