xref: /titanic_52/usr/src/cmd/sgs/tools/bld_lint.sh (revision 1dd08564e4a3aafe66b00aee6f222b0885346fe8)
17c478bd9Sstevel@tonic-gate#! /usr/bin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
65aefb655Srie# Common Development and Distribution License (the "License").
75aefb655Srie# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
225aefb655Srie
237c478bd9Sstevel@tonic-gate#
24*1dd08564Sab196087# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate# Use is subject to license terms.
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateDASHES="============================================================"
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateMACH=	`uname -p`
337c478bd9Sstevel@tonic-gate
345aefb655Srieif [ $MACH = "sparc" ]
357c478bd9Sstevel@tonic-gatethen
367c478bd9Sstevel@tonic-gate	MACH64="sparcv9"
375aefb655Srieelif [ $MACH = "i386" ]
385aefb655Sriethen
395aefb655Srie	MACH64="amd64"
407c478bd9Sstevel@tonic-gateelse
417c478bd9Sstevel@tonic-gate	MACH64="unknown"
427c478bd9Sstevel@tonic-gatefi
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gateLOG=lint.$MACH.log
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate#
475aefb655Srie# Keep the first run as a backup, so that subsequent runs can diff against it.
487c478bd9Sstevel@tonic-gate#
497c478bd9Sstevel@tonic-gateif [ -f $LOG ]
507c478bd9Sstevel@tonic-gatethen
517c478bd9Sstevel@tonic-gate	if [ ! -f $LOG.bak ]
527c478bd9Sstevel@tonic-gate	then
537c478bd9Sstevel@tonic-gate		mv $LOG $LOG.bak
547c478bd9Sstevel@tonic-gate	else
557c478bd9Sstevel@tonic-gate		rm -f $LOG
567c478bd9Sstevel@tonic-gate	fi
577c478bd9Sstevel@tonic-gatefi
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate#
607c478bd9Sstevel@tonic-gate# Grab the lint.out from all of our directories.
617c478bd9Sstevel@tonic-gate#
627c478bd9Sstevel@tonic-gatefor ii in $*
637c478bd9Sstevel@tonic-gatedo
647c478bd9Sstevel@tonic-gate	if [ $ii = ".WAIT" ]
657c478bd9Sstevel@tonic-gate	then
667c478bd9Sstevel@tonic-gate		continue
677c478bd9Sstevel@tonic-gate	fi
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gate	# Concatinate the lint.out to our log file.
70*1dd08564Sab196087#	echo $ii/$MACH >> $LOG
717c478bd9Sstevel@tonic-gate	echo $DASHES >> $LOG
727c478bd9Sstevel@tonic-gate	cat $ii/$MACH/lint.out >> $LOG
737c478bd9Sstevel@tonic-gate	echo "\n" >> $LOG
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate	# If there is a 64-bit directory, tack that on as well.
767c478bd9Sstevel@tonic-gate	if [ -f $ii/$MACH64/lint.out ]
777c478bd9Sstevel@tonic-gate	then
78*1dd08564Sab196087#		echo $ii/$MACH64 >> $LOG
797c478bd9Sstevel@tonic-gate		echo $DASHES >> $LOG
807c478bd9Sstevel@tonic-gate		cat $ii/$MACH64/lint.out >> $LOG
817c478bd9Sstevel@tonic-gate		echo "\n" >> $LOG
827c478bd9Sstevel@tonic-gate	fi
837c478bd9Sstevel@tonic-gatedone
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gate#
865aefb655Srie# If there is a backup log, diff the current one against it.
877c478bd9Sstevel@tonic-gate#
887c478bd9Sstevel@tonic-gateif [ -f $LOG.bak ]
897c478bd9Sstevel@tonic-gatethen
907c478bd9Sstevel@tonic-gate	echo "Running diff on log file..."
917c478bd9Sstevel@tonic-gate	diff $LOG.bak $LOG
927c478bd9Sstevel@tonic-gatefi
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gateexit 0
95