1#!/bin/sh - 2# 3# Copyright (c) 1991 The Regents of the University of California. 4# All rights reserved. 5# 6# %sccs.include.redist.sh% 7# 8# @(#)mkdep.gcc.sh 5.2 (Berkeley) 04/12/91 9# 10 11PATH=/bin:/usr/bin:/usr/ucb 12export PATH 13 14D=.depend # default dependency file is .depend 15append=0 16 17while : 18 do case "$1" in 19 # -a appends to the depend file 20 -a) 21 append=1 22 shift ;; 23 24 # -f allows you to select a makefile name 25 -f) 26 D=$2 27 shift; shift ;; 28 29 # the -p flag produces "program: program.c" style dependencies 30 # so .o's don't get produced 31 -p) 32 SED='s;\.o;;' 33 shift ;; 34 -*) 35 shift ;; 36 *) 37 break ;; 38 esac 39done 40 41if [ $# = 0 ] ; then 42 echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...' 43 exit 1 44fi 45 46TMP=/tmp/mkdep$$ 47 48trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 49 50cpp -M $* > $TMP 51 52if [ $? != 0 ]; then 53 echo 'mkdep: compile failed.' 54 rm -f $TMP 55 exit 1 56fi 57 58if [ $append = 1 ]; then 59 cat $TMP >> $D 60 rm -f $TMP 61else 62 mv $TMP $D 63fi 64exit 0 65