source: trunk/minix/commands/scripts/mkdep.sh@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 876 bytes
RevLine 
[9]1#!/bin/sh
2#
3# mkdep 1.1 - Generate Makefile dependencies. Author: Kees J. Bot
4#
5# Does what 'cc -M' should do, but no compiler gets it right, they all
6# strip the leading path of the '.o' file.)
7#
8# Added option to generate .depend files in subdirectories of given dir.
9# Jorrit N. Herder
10
11case $# in
12
13# Display help ...
140)
15 echo "Usage: mkdep 'cpp command' file ..." >&2
16 echo " mkdep directory" >&2
17;;
18
19# Create .depend files ...
201)
21 echo "Creating .depend files in $1"
22 for dir in `find $1 -type d ! -name CVS`
23 do
24 touch $dir/.depend
25 done
26
27;;
28
29
30# Get dependencies ...
31*)
32 cpp="$1"; shift
33
34 for f
35 do
36 : < "$f" || exit
37
38 o=`expr "$f" : '\(.*\)\..*'`.o
39
40 echo
41
42 $cpp "$f" | \
43 sed -e '/^#/!d
44 s/.*"\(.*\)".*/\1/
45 s:^\./::' \
46 -e "s:^:$o\: :" | \
47 sort -u
48 done
49esac
50
51exit 0
52
53#
54# $PchId: mkdep.sh,v 1.3 1998/07/23 21:24:38 philip Exp $
55#
Note: See TracBrowser for help on using the repository browser.