1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
#!/bin/sh
#
# @(#)makeinc 1.4 05/05/01 Copyright 1998 J. Schilling
###########################################################################
# Copyright 1998 by J. Schilling
###########################################################################
#
# Automake script for the Schily (SING) makefile system
#
###########################################################################
#
# Creates the following files:
#
# ./RULES/os-sunos.id
# ./RULES/os-sunos.def
# ./DEFAULTS/Defaults.sunos
# ./RULES/sun4c-sunos-gcc.rul
#
###########################################################################
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only.
# (the "License"). You may not use this file except in compliance
# with the License.
#
# See the file CDDL.Schily.txt in this distribution for details.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file CDDL.Schily.txt from this distribution.
###########################################################################
MAILADDR=schilling@fokus.fhg.de
###########################################################################
# Option processing
###########################################################################
case $1 in
-r)
shift
SRCROOT=$1
shift
;;
esac
if [ $# -lt 1 ]; then
echo 'Usage: makeinc [-r srcroot] filename' 1>&2
exit 1
fi
###########################################################################
# Find SRCROOT if not specified via option
###########################################################################
if [ .$SRCROOT = . ]; then
SRCROOT=.
loop=1
while [ $loop -lt 100 ]; do
if [ ! -d $SRCROOT ]; then
# Abort on ENAMETOOLONG
break
fi
if [ -r $SRCROOT/RULES/rules.top ]; then
break
fi
if [ "$SRCROOT" = . ]; then
SRCROOT=".."
else
SRCROOT="$SRCROOT/.."
fi
loop="`expr $loop + 1`"
done
if [ ! -r $SRCROOT/RULES/rules.top ]; then
echo "Cannot find SRCROOT directory" 1>&2
exit 1
fi
fi
###########################################################################
# Real start of automake script
###########################################################################
echo 'NOTICE: Automake script called'
if [ -r $1 ]; then
echo "WARNING: requested file '$1' already exists"
exit
fi
echo "IMPORTANT: Please report your architecture to $MAILADDR"
echo
echo "Trying to create missing rule file '$1'"
sleep 1
echo
CC=cc
gcc -v 2> /dev/null && CC=gcc
echo "CC: $CC"
MANSTYLE=sysv
if [ -r /usr/man/*man7*/man* -o -r /usr/share/man/*man7*/man* \
-o -r /usr/man/*man7*/ascii* -o -r /usr/share/man/*man7*/ascii* ]; then
MANSTYLE=bsd
fi
echo "MANSTYLE: $MANSTYLE"
case $1 in
*os-*.id)
echo $1
OSNAME=`echo $1 | sed -e 's;\(.*\)os-\(.*\)\.id;\2;'`
echo '###########################################################################' > $1
echo "# OS specific MACRO definitions for $OSNAME" >> $1
echo "# This file is auto generated and may be wrong" >> $1
echo '###########################################################################' >> $1
echo "O_ARCH= $OSNAME" >> $1
echo '-O_ARCH= -$(O_ARCH)' >> $1
;;
*os-*.def)
echo $1
OSNAME=`echo $1 | sed -e 's;\(.*\)os-\(.*\)\.def;\2;'`
echo '###########################################################################' > $1
echo "# Global os definitions for $OSNAME" >> $1
echo "# This file is auto generated and may be wrong" >> $1
echo '###########################################################################' >> $1
echo "MANSTYLE= $MANSTYLE" >> $1
;;
*Defaults.*)
echo $1
OSNAME=`echo $1 | sed -e 's;\(.*\)\.\(.*\);\2;'`
echo '###########################################################################' > $1
echo "# global definitions for $OSNAME Systems" >> $1
echo "# This file is auto generated and may be wrong" >> $1
echo '###########################################################################' >> $1
if [ $CC = gcc ]; then
cat $SRCROOT/TEMPLATES/Defaults.gcc >> $1
else
cat $SRCROOT/TEMPLATES/Defaults.xcc >> $1
fi
echo >> $1
echo '###########################################################################' >> $1
echo "# Do compilattion with minimal warnings" >> $1
echo '###########################################################################' >> $1
echo "CWARNOPTS=" >> $1
;;
*-*-*cc.rul)
ARCH=`echo $1 | sed -e 's;\(.*\)/\(.*\)-\(.*\)-\(.*\).rul;\2;'`
OSNAME=`echo $1 | sed -e 's;\(.*\)/\(.*\)-\(.*\)-\(.*\).rul;\3;'`
CCOM=`echo $1 | sed -e 's;\(.*\)/\(.*\)-\(.*\)-\(.*\).rul;\4;'`
DIR=`echo $1 | sed -e "s;\(.*\)/$ARCH-$OSNAME-$CCOM.rul;\1;"`
echo "ARCH: $ARCH"
echo "OSNAME: $OSNAME"
echo "CCOM: $CCOM"
echo "DIR: $DIR"
echo $1
echo "Trying to find similar architecture for '$1'"
similar=`ls $DIR/*-$OSNAME-$CCOM.rul 2>/dev/null| head -1`
SARCH=`echo $similar | sed -e "s;\(.*\)/\(.*\)-$OSNAME-$CCOM.rul;\2;"`
if [ .$similar != . ]; then
echo 'Found similar architecture ' "'$similar'"
echo 'creating symlink:' ln -s $SARCH-$OSNAME-$CCOM.rul $1
echo "Please send a mail to $MAILADDR to report whether this works or not"
sleep 10
ln -s $SARCH-$OSNAME-$CCOM.rul $1 || cp $SARCH-$OSNAME-$CCOM.rul $1
exit
else
echo '###########################################################################' > $1
echo "# global definitions for $OSNAME Systems" >> $1
echo "# This file is auto generated and may be wrong" >> $1
echo '###########################################################################' >> $1
if [ $CCOM = gcc ]; then
echo 'Using generic GCC machine configuration file'
cat $SRCROOT/TEMPLATES/temp-gcc.rul >> $1
else
echo 'Using generic dumb cc machine configuration file'
cat $SRCROOT/TEMPLATES/temp-xcc.rul >> $1
fi
fi
;;
#######################################################################
# This entry is not really needed...
#######################################################################
*TARGETS/Targetdirs*)
echo "Linking $1 to $SRCROOT/TARGETS/Targetdirs"
ln -s Targetdirs $1
;;
*)
echo "Unknown rule to build: '$1'."
exit 1
;;
esac
echo "Please send a mail to $MAILADDR to report whether this works or not"
sleep 10
|