Exemple #1
0
    def build_object(self, target_name, out_filename, in_filename,
                     include_dirs, compiler_flags):
        ui.debug("building object " + out_filename)

        with ui.ident:
            prerequisites = self.__fetch_includes(target_name, in_filename,
                                                  include_dirs, compiler_flags)
            prerequisites.append(in_filename)

            ui.debug("appending prerequisites from pake modules: {!s}".format(
                fsutils.pake_files))

            prerequisites.extend(fsutils.pake_files)

            ui.debug("prerequisites: {!r}".format(prerequisites))

            if fsutils.is_any_newer_than(prerequisites, out_filename):
                fsutils.mkdir_recursive(os.path.dirname(out_filename))

                cmd = configurations.compiler(
                ) + " " + self.__prepare_compiler_flags(
                    include_dirs, compiler_flags
                ) + " -c -o " + out_filename + " " + in_filename
                if command_line.args.verbose:
                    ui.step(configurations.compiler(), cmd)
                else:
                    ui.step(configurations.compiler(), in_filename)

                shell.execute(cmd)
Exemple #2
0
    def build_object(self, target_name, out_filename, in_filename, include_dirs,
                     compiler_flags):

        abs_source = os.path.join(os.getcwd(), in_filename)

        ui.debug("building object " + out_filename)

        with ui.ident:
            prerequisites = self.__fetch_includes(target_name, abs_source,
                                                  include_dirs, compiler_flags)
            prerequisites.append(in_filename)

            ui.debug("appending prerequisites from pake modules: {!s}"
                     .format(fsutils.pake_files))

            prerequisites.extend(fsutils.pake_files)

            ui.debug("prerequisites: {!r}".format(prerequisites))

            if fsutils.is_any_newer_than(prerequisites, out_filename):
                fsutils.mkdir_recursive(os.path.dirname(out_filename));

                cmd = configurations.compiler() + " " + self.__prepare_compiler_flags(include_dirs, compiler_flags) + " -c -o " + out_filename + " " + abs_source
                if command_line.args.verbose:
                    ui.step(configurations.compiler(), cmd)
                else:
                    ui.step(configurations.compiler(), in_filename)

                shell.execute(cmd)
Exemple #3
0
    def __fetch_includes(self, target_name, in_filename, include_dirs, compiler_flags):
        ui.debug("getting includes for " + in_filename)

        with ui.ident:
            cache_file = self.cache_directory(target_name) + in_filename + ".includes"
            includes = None
            if os.path.exists(cache_file) and fsutils.is_newer_than(cache_file, in_filename):
                includes = marshal.load(open(cache_file, "rb"))
            else:
                fsutils.mkdir_recursive(os.path.dirname(cache_file));
                includes = self.__scan_includes(in_filename, include_dirs, compiler_flags)
                marshal.dump(includes, open(cache_file, "wb"))

        return includes
Exemple #4
0
    def __fetch_includes(self, target_name, in_filename, include_dirs,
                         compiler_flags):
        ui.debug("getting includes for " + in_filename)

        with ui.ident:
            cache_file = self.cache_directory(
                target_name) + in_filename + ".includes"
            includes = None
            if os.path.exists(cache_file) and fsutils.is_newer_than(
                    cache_file, in_filename):
                includes = marshal.load(open(cache_file, "rb"))
            else:
                fsutils.mkdir_recursive(os.path.dirname(cache_file))
                includes = self.__scan_includes(in_filename, include_dirs,
                                                compiler_flags)
                marshal.dump(includes, open(cache_file, "wb"))

        return includes