xref: /onnv-gate/usr/src/cmd/sgs/tools/bld_lint.sh (revision 6951:59445bec7ef4)
10Sstevel@tonic-gate#! /usr/bin/sh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
61618Srie# Common Development and Distribution License (the "License").
71618Srie# You may not use this file except in compliance with the License.
80Sstevel@tonic-gate#
90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate# See the License for the specific language governing permissions
120Sstevel@tonic-gate# and limitations under the License.
130Sstevel@tonic-gate#
140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate#
200Sstevel@tonic-gate# CDDL HEADER END
210Sstevel@tonic-gate#
221618Srie
230Sstevel@tonic-gate#
24*6951Sab196087# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
250Sstevel@tonic-gate# Use is subject to license terms.
260Sstevel@tonic-gate#
270Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate#
290Sstevel@tonic-gate
300Sstevel@tonic-gateDASHES="============================================================"
310Sstevel@tonic-gate
320Sstevel@tonic-gateMACH=	`uname -p`
330Sstevel@tonic-gate
341618Srieif [ $MACH = "sparc" ]
350Sstevel@tonic-gatethen
360Sstevel@tonic-gate	MACH64="sparcv9"
371618Srieelif [ $MACH = "i386" ]
381618Sriethen
391618Srie	MACH64="amd64"
400Sstevel@tonic-gateelse
410Sstevel@tonic-gate	MACH64="unknown"
420Sstevel@tonic-gatefi
430Sstevel@tonic-gate
440Sstevel@tonic-gateLOG=lint.$MACH.log
450Sstevel@tonic-gate
460Sstevel@tonic-gate#
471618Srie# Keep the first run as a backup, so that subsequent runs can diff against it.
480Sstevel@tonic-gate#
490Sstevel@tonic-gateif [ -f $LOG ]
500Sstevel@tonic-gatethen
510Sstevel@tonic-gate	if [ ! -f $LOG.bak ]
520Sstevel@tonic-gate	then
530Sstevel@tonic-gate		mv $LOG $LOG.bak
540Sstevel@tonic-gate	else
550Sstevel@tonic-gate		rm -f $LOG
560Sstevel@tonic-gate	fi
570Sstevel@tonic-gatefi
580Sstevel@tonic-gate
590Sstevel@tonic-gate#
600Sstevel@tonic-gate# Grab the lint.out from all of our directories.
610Sstevel@tonic-gate#
620Sstevel@tonic-gatefor ii in $*
630Sstevel@tonic-gatedo
640Sstevel@tonic-gate	if [ $ii = ".WAIT" ]
650Sstevel@tonic-gate	then
660Sstevel@tonic-gate		continue
670Sstevel@tonic-gate	fi
680Sstevel@tonic-gate
690Sstevel@tonic-gate	# Concatinate the lint.out to our log file.
70*6951Sab196087#	echo $ii/$MACH >> $LOG
710Sstevel@tonic-gate	echo $DASHES >> $LOG
720Sstevel@tonic-gate	cat $ii/$MACH/lint.out >> $LOG
730Sstevel@tonic-gate	echo "\n" >> $LOG
740Sstevel@tonic-gate
750Sstevel@tonic-gate	# If there is a 64-bit directory, tack that on as well.
760Sstevel@tonic-gate	if [ -f $ii/$MACH64/lint.out ]
770Sstevel@tonic-gate	then
78*6951Sab196087#		echo $ii/$MACH64 >> $LOG
790Sstevel@tonic-gate		echo $DASHES >> $LOG
800Sstevel@tonic-gate		cat $ii/$MACH64/lint.out >> $LOG
810Sstevel@tonic-gate		echo "\n" >> $LOG
820Sstevel@tonic-gate	fi
830Sstevel@tonic-gatedone
840Sstevel@tonic-gate
850Sstevel@tonic-gate#
861618Srie# If there is a backup log, diff the current one against it.
870Sstevel@tonic-gate#
880Sstevel@tonic-gateif [ -f $LOG.bak ]
890Sstevel@tonic-gatethen
900Sstevel@tonic-gate	echo "Running diff on log file..."
910Sstevel@tonic-gate	diff $LOG.bak $LOG
920Sstevel@tonic-gatefi
930Sstevel@tonic-gate
940Sstevel@tonic-gateexit 0
95