1# this file will clean up ONE makefile dependency rule in a file.  It must
2# be run on every rule as it is generated by the compiler.
3
4# older sed may convert newline character from 0x0d+0x0a to 0x0a
5# latest sed keeps \r (0x0d) characters of input file, so just '$' doesn't work
6# remove all 0x0d characters
7s/\r//g
8
9# change all back slashes
10sX\\X/Xg
11
12# replace slash at end of line with a backslash
13sX/$X\\Xg
14
15# eliminate quotes
16sX"XXg
17
18# change all runs of white space to a single tab
19s/[ 	][ 	]*/	/g
20
21# change drive path
22sX\([a-zA-Z]\+\):\/X\/cygdrive\/\1\/Xg
23
24# We supplement this below to remove the actual target source file itself, since sometimes
25# people change a .c file into a .cpp file (or vice versa), and this would break things.
26# The actual source file is already a dependency of the object, so no need to list it again.
27# only do on first three lines
281,3 s/[^ 	]*[.]c	//
291,3 s/[^ 	]*[.]cp	//
301,3 s/[^ 	]*[.]cpp	//
311,3 s/[^ 	]*[.]s	//
32
33# delete empty lines
34/^[ 	]*$/d
35/^[ 	]*\\$/d
36
37# lines containing a : followed by white space remove leading white space
38/^[ 	].*:[ 	]/s/^[ 	][ 	]*//
39