1 # SPDX-License-Identifier: MIT
3 # Copyright The SCons Foundation
6 Phony compiler for testing SCons.
8 Copies its source file to the target file, dropping lines that match
9 a pattern, so we can recognize the tool has made a modification.
11 The first argument is the language (cc, c__, g77, etc.).
13 Recognizes a -x option to append the language to 'mygcc.out'
16 Intended for use as $CC, $CXX, etc.
23 compiler
= sys
.argv
[1].encode('utf-8')
24 opts
, args
= getopt
.getopt(sys
.argv
[2:], 'co:xf:K:')
29 with
open('mygcc.out', 'ab') as logfile
:
30 logfile
.write(compiler
+ b
"\n")
32 with
open(out
, 'wb') as ofp
, open(args
[0], 'rb') as ifp
:
34 if not line
.startswith(b
'#' + compiler
):
37 if __name__
== '__main__':