dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / adbgen / common / adbgen.sh
blob80861900c923bab48eddd1f69907d1cdf491982c
1 #! /bin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
8 # with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # CDDL HEADER END
24 # Copyright (c) 1998 by Sun Microsystems, Inc.
25 # All rights reserved.
27 # ident "%Z%%M% %I% %E% SMI"
29 USAGE="adbgen [-d] [-m ilp32|lp64] [-w] <adb macro file>"
30 cflags=
31 mflag=-milp32
32 subdir=
34 while getopts dwm: c
36 case $c in
38 DEBUG=:
41 case $OPTARG in
42 ilp32)
43 mflag=-milp32
45 lp64)
46 mflag=-mlp64
47 cflags=-xarch=v9
48 subdir=sparcv9
49 /usr/bin/optisa sparcv9 > /dev/null
50 if [ $? -ne 0 ]
51 then
52 echo adbgen -mlp64 must be run on 64-bit system
56 echo $USAGE
57 exit 2
59 esac
62 flag=-w
64 \?)
65 echo $USAGE
66 exit 2
68 esac
69 done
70 shift `expr $OPTIND - 1`
72 ADBDIR=/usr/lib/adb
73 PATH=$PATH:$ADBDIR
74 for file in $*
76 if [ `expr "XX$file" : ".*\.adb"` -eq 0 ]
77 then
78 echo File $file invalid.
79 exit 1
81 if [ $# -gt 1 ]
82 then
83 echo $file:
85 file=`expr "XX$file" : "XX\(.*\)\.adb"`
86 if adbgen1 $flag $mflag < $file.adb > $file.adb.c
87 then
88 if ${CC:-cc} -w -D${ARCH:-`uname -m`} $cflags \
89 -I/usr/platform/${ARCH:-`uname -m`}/include \
90 -o $file.run $file.adb.c $ADBDIR/$subdir/adbsub.o
91 then
92 $file.run | adbgen3 | adbgen4 > $file
93 $DEBUG rm -f $file.run $file.adb.C $file.adb.c $file.adb.o
94 else
95 $DEBUG rm -f $file.run $file.adb.C $file.adb.c $file.adb.o
96 echo compile failed
97 exit 1
99 else
100 $DEBUG rm -f $file.adb.C
101 echo adbgen1 failed
102 exit 1
104 done