1#!/bin/sh
2#ident "@(#)mkdep-aix.sh	1.1 02/10/11 "
3###########################################################################
4# Copyright 2002 by J. Schilling
5###########################################################################
6#
7# Create dependency list with AIX cc
8#
9###########################################################################
10#
11# This script will probably not work correctly with a list of C-files
12# but as we don't need it with 'smake' or 'gmake' it seems to be sufficient.
13#
14# Note that AIX cc will create a file foo.u for every foo.c file. The file
15# foo.u is located in the directory where cc is run.
16# For this reason, there may be problems of other software likes to create
17# foo.u during compilation. Please report problems.
18#
19###########################################################################
20# This program is free software; you can redistribute it and/or modify
21# it under the terms of the GNU General Public License as published by
22# the Free Software Foundation; either version 2, or (at your option)
23# any later version.
24#
25# This program is distributed in the hope that it will be useful,
26# but WITHOUT ANY WARRANTY; without even the implied warranty of
27# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28# GNU General Public License for more details.
29#
30# You should have received a copy of the GNU General Public License
31# along with this program; see the file COPYING.  If not, write to
32# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
33###########################################################################
34FILES=
35UFILES=
36trap 'rm -f $UFILES ; exit 1' 1 2 15
37
38for i in "$@"; do
39
40	case "$i" in
41
42	-*)	# ignore options
43		;;
44	*.c)	if [ ! -z "$FILES" ]; then
45			FILES="$FILES "
46		fi
47		b=`basename $i ''`
48		FILES="$FILES$b"
49		;;
50	esac
51done
52
53UFILES=`echo "$FILES" | sed -e 's;\([^.]*\)\.c;\1.u;g'`
54
55rm -f $UFILES
56cc -M -E > /dev/null "$@"
57cat $UFILES
58rm -f $UFILES
59