-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcc-M
More file actions
executable file
·39 lines (36 loc) · 778 Bytes
/
Copy pathcc-M
File metadata and controls
executable file
·39 lines (36 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/sh
# cc-M - replacement for cc -M
# $Id$
# NOTE! only handles .c files (no .l or .y)
flags=
for file in $*
do
case $file in
-D*|-U*|-I*)
flags="$flags $file"
;;
-*)
;;
*)
echo "# # $file"
# on some systems (AIX/RT) system defines are done by cc passing -D flags!!
# /lib/cpp $flags < $file | grep '^# 1 "[^"]'
cc -E $flags $file | grep '^#'
;;
esac
done | awk '
/# # / {
file = $3
lf = length(file)
ext = substr(file,lf,1)
left = file
print left "\t" file
next
}
$0 ~ /^# 1 / && NF >= 3 { print left "\t" substr($3,2,length($3) - 2) }
$1 == "#line" && NF >= 3 { print left "\t" substr($3,2,length($3) - 2) }' | \
(IFS=" ";
while read LEFT RIGHT; do
O=`basename $LEFT .c`.o
echo ${O}: $RIGHT
done)