示例#1
0
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir,
            path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith('.c'):
            cc = 'CC'
            name = 'COMPILE_CFLAGS'
        else:
            cc = 'CXX'
            name = 'COMPILE_CXXFLAGS'

        if name not in build_vars:
            return

        # Drop the first flag since that is the pathname of the compiler.
        flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]

        print(' '.join(shell_quote(arg)
                       for arg in util.sanitize_cflags(flags)))
示例#2
0
    def _get_dir_flags(self, directory):
        if directory in self._flags:
            return self._flags[directory]

        from mozbuild.util import resolve_target_to_make

        make_dir, make_target = resolve_target_to_make(
            self.environment.topobjdir, directory)
        if make_dir is None and make_target is None:
            raise Exception('Cannot figure out the make dir and target for ' +
                            directory)

        build_vars = util.get_build_vars(directory, self._cmd)

        # We only care about the following build variables.
        for name in ('COMPILE_CFLAGS', 'COMPILE_CXXFLAGS', 'COMPILE_CMFLAGS',
                     'COMPILE_CMMFLAGS'):
            if name not in build_vars:
                continue

            build_vars[name] = util.sanitize_cflags(
                shell_split(build_vars[name]))

        self._flags[directory] = build_vars
        return self._flags[directory]
示例#3
0
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir, path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith(".c"):
            cc = "CC"
            name = "COMPILE_CFLAGS"
        else:
            cc = "CXX"
            name = "COMPILE_CXXFLAGS"

        if name not in build_vars:
            return

        # Drop the first flag since that is the pathname of the compiler.
        flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]

        print(" ".join(shell_quote(arg) for arg in util.sanitize_cflags(flags)))
示例#4
0
    def compileflags(self, what):
        from mozbuild.util import resolve_target_to_make
        from mozbuild.compilation import util

        if not util.check_top_objdir(self.topobjdir):
            return 1

        path_arg = self._wrap_path_argument(what)

        make_dir, make_target = resolve_target_to_make(self.topobjdir,
            path_arg.relpath())

        if make_dir is None and make_target is None:
            return 1

        build_vars = util.get_build_vars(make_dir, self)

        if what.endswith('.c'):
            name = 'COMPILE_CFLAGS'
        else:
            name = 'COMPILE_CXXFLAGS'

        if name not in build_vars:
            return

        print(' '.join(shell_quote(arg)
                       for arg in util.sanitize_cflags(shell_split(build_vars[name]))))
示例#5
0
def compileflags(command_context, what):
    from mozbuild.util import resolve_target_to_make
    from mozbuild.compilation import util

    if not util.check_top_objdir(command_context.topobjdir):
        return 1

    path_arg = command_context._wrap_path_argument(what)

    make_dir, make_target = resolve_target_to_make(command_context.topobjdir,
                                                   path_arg.relpath())

    if make_dir is None and make_target is None:
        return 1

    build_vars = util.get_build_vars(make_dir, command_context)

    if what.endswith(".c"):
        cc = "CC"
        name = "COMPILE_CFLAGS"
    else:
        cc = "CXX"
        name = "COMPILE_CXXFLAGS"

    if name not in build_vars:
        return

    # Drop the first flag since that is the pathname of the compiler.
    flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]

    print(" ".join(shell_quote(arg) for arg in util.sanitize_cflags(flags)))
示例#6
0
    def _get_dir_flags(self, directory):
        if directory in self._flags:
            return self._flags[directory]

        from mozbuild.util import resolve_target_to_make

        make_dir, make_target = resolve_target_to_make(self.environment.topobjdir, directory)
        if make_dir is None and make_target is None:
            raise Exception('Cannot figure out the make dir and target for ' + directory)

        build_vars = util.get_build_vars(directory, self._cmd)

        # We only care about the following build variables.
        for name in ('COMPILE_CFLAGS', 'COMPILE_CXXFLAGS',
                     'COMPILE_CMFLAGS', 'COMPILE_CMMFLAGS'):
            if name not in build_vars:
                continue

            build_vars[name] = util.sanitize_cflags(shell_split(build_vars[name]))

        self._flags[directory] = build_vars
        return self._flags[directory]