1 # Copyright (C) 2010 The Android Open Source Project
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 # This script is used to convert a dependency file generated by a cygwin-less
17 # GCC compiler program into something that can be parsed into a cygwin-based
20 # More specifically, it's going to translate stuff like:
22 # D:/Stuff/source.o: \
24 # C:/NDK/sysroot/include/string.h \
25 # C:/NDK/sysroot/include/malloc.h
29 # /cygdrive/d/Stuff/source.o: \
30 # /cygdrive/d/Stuff/source.h \
31 # /cygdrive/c/NDK/sysroot/include/string.h \
32 # /cygdrive/c/NDK/sysroot/include/malloc.h
36 # TODO: We could determine this dynamically before calling this script
37 CYGDRIVE_PREFIX = "/cygdrive/"
43 for (nn = 1; nn <= NF; nn++) {
44 if ($nn ~ /^[A-Za-z]:/) {
45 LINE = LINE SEP CYGDRIVE_PREFIX tolower(substr($nn,1,1)) "/" substr($nn,4)
51 # Any leading space on the original line should be preserved
53 if (match($0,"^[[:space:]]+")) {
54 MARGIN=substr($0,RSTART,RLENGTH)
56 printf("%s%s\n", MARGIN, LINE)