/usr/bin/fakecc is in undertaker 1.3b-1.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #! /usr/bin/python
#
#   fakecc - a compile-to-/dev/null c compiler
#
# Copyright (C) 2012 Christoph Egger <siccegge@informatik.uni-erlangen.de>
# Copyright (C) 2012 Reinhard Tartler <tartler@informatik.uni-erlangen.de>
# Copyright (C) 2012 Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
import os
import subprocess
from optparse import OptionParser, BadOptionError, AmbiguousOptionError
class PassThroughOptionParser(OptionParser):
    """
    An unknown option pass-through implementation of OptionParser.
    When unknown arguments are encountered, bundle with largs and try again,
    until rargs is depleted.
    sys.exit(status) will still be called if a known argument is passed
    incorrectly (e.g. missing arguments or bad argument types, etc.)
    """
    def _process_args(self, largs, rargs, values):
        while rargs:
            try:
                OptionParser._process_args(self, largs, rargs, values)
            except (BadOptionError, AmbiguousOptionError), exception:
                largs.append(exception.opt_str)
def invoke_gcc(argv):
    # strip off all -m calls, they will most likely break on foreign
    # architectures
    argv = [o for o in argv[1:] if not o.startswith("-m")]
    argv = [o for o in argv if not o.startswith("-Wa,-m")] # assembler options
    if "-G" in argv:
        # x86 gcc does not undertand the -G option, eat it and its paramo
        index = argv.index("-G")
        del argv[index+1]
        del argv[index]
    argv = [o for o in argv if not o.startswith("-G")] # score e.g. uses -G0
    print "calling gcc %s" % " ".join(argv)
    os.execvp("gcc", ["gcc"] + argv)
def main(argv):
    for special in ("kernel/bounds.c", "scripts/mod/empty.c", "-",
                    "-print-file-name=include"):
        if special in argv:
            invoke_gcc(argv)
    parser = PassThroughOptionParser(usage="%prog [options] <filename>")
    parser.add_option('-v', '--verbose', dest='verbose', action='count')
    parser.add_option("-o", '--output', dest='output', action='store',
                      type="string", default=None)
    parser.add_option('-c', '--compile', dest='compile', action='store_true',
                      default=False)
    parser.add_option("-W", dest='wflag', action='append', type="string",
                      default=None)
    parser.add_option('-p', dest='p_opt', action='append', default=[])
    parser.add_option('-G', dest='g_opt', action='store', default="")
    (opts, args) = parser.parse_args()
    files = []
    objects = []
    if len(argv) == 1:
        # no arguments given
        print "usage: see gcc manual"
        sys.exit(0)
    if opts.p_opt:
        for flag in opts.p_opt:
            if flag.startswith('ipe'):
                continue
            elif flag.startswith('g'):
                continue
            else:
                print "Ignoring unhandled option %s" % flag
    if opts.output:
        objects.append(opts.output)
    elif opts.compile and args[0].endswith('.c'):
        objects.append('%s.o' % args[0][:-2])
    else:
        objects.append('a.out')
    if opts.wflag:
        for flag in opts.wflag:
            if flag.startswith('p,-MD,'):
                files.append(flag.split(',', 3)[2])
    for filename in objects:
        os.system("gcc -x c -c /dev/null -o %s" % filename)
    for filename in files:
        with open(filename, 'w') as f:
            f.write('')
if __name__ == '__main__':
    import sys
    main(sys.argv)
 |