コード例 #1
0
    def gen_step_post_conditions(s, command, deps, extra_deps):

        all_deps = deps + extra_deps

        # Extract the build directory from the command so we can create a
        # unique rule name

        tokens = command.split()
        cd_idx = tokens.index('cd')
        build_dir = tokens[cd_idx + 1]

        rule = build_dir + '-post-conditions-commands-rule'
        rule = rule.replace('-', '_')

        # Stamp the build directory

        outputs = [build_dir + '/.postconditions.stamp']

        # Rules

        targets = make_execute(
            w=s.w,
            outputs=outputs,
            rule=rule,
            command=command,
            deps=all_deps,
            touch_target=True,
        )

        return targets
コード例 #2
0
    def gen_step_debug(s, target, command, build_id):

        # Rules

        debug_rule = build_id + '-debug-rule'
        debug_rule = debug_rule.replace('-', '_')

        make_execute(
            w=s.w,
            outputs=[target],
            rule=debug_rule,
            command=command,
            touch_target=False,
        )

        # Track debug targets for list command

        s.debug_targets.update({build_id: target})
コード例 #3
0
ファイル: make_backend.py プロジェクト: varunnagpaal/mflowgen
  def gen_step_execute( s, outputs, command, deps, extra_deps,
                                                     phony=False ):

    all_deps = deps + extra_deps

    # Extract the build directory from the command so we can create a
    # unique rule name

    tokens    = command.split()
    cd_idx    = tokens.index( 'cd' )
    build_dir = tokens[ cd_idx + 1 ]

    rule = build_dir + '-commands-rule'
    rule = rule.replace( '-', '_' )

    # Stamp all outputs from execute

    outputs = [ stamp( o, '.execstamp.' ) for o in outputs ]

    # Update timestamps for pre-existing outputs so timestamp-based
    # dependency checking works

    command = 'mkdir -p ' + build_dir + '/outputs && ' + \
              command + ' && touch -c ' + build_dir + '/outputs/*'

    # Stamp the build directory

    outputs.insert( 0, build_dir + '/.execstamp' )

    # Rules

    targets = make_execute(
      w            = s.w,
      outputs      = outputs,
      rule         = rule,
      command      = command,
      deps         = all_deps,
      touch_target = not phony,
    )

    return targets
コード例 #4
0
    def gen_step_execute(s, outputs, command, deps, extra_deps, phony=False):

        all_deps = deps + extra_deps

        # Extract the build directory from the command so we can create a
        # unique rule name

        tokens = command.split()
        cd_idx = tokens.index('cd')
        build_dir = tokens[cd_idx + 1]

        #.....................................................................
        # Built-in toggle for enabling/disabling this rule
        #.....................................................................
        # This is a hack -- Add a knob for Makefiles to enable/disable this
        # rule. The goal and primary use case in mind here is to allow users
        # to copy in pre-built steps and have the build system think its
        # dependencies have all already been satisfied. We cannot just "touch"
        # files from earlier steps to make it seem like they are done, since
        # downstream steps may need those files. The only way we see to make
        # pre-built steps always look "done" without impacting earlier steps
        # is to break the dependency. Specifically, if the "directory" and
        # "collect-inputs" substeps are removed, then a pre-built step will
        # always look "done". So we add a knob here that checks if the step
        # build directory has a ".prebuilt" file and if so, ignores this rule.
        dst_dir = build_dir
        s.w.write('ifeq ("$(wildcard {}/.prebuilt)","")'.format(dst_dir))
        s.w.newline()
        s.w.newline()
        #.....................................................................

        rule = build_dir + '-commands-rule'
        rule = rule.replace('-', '_')

        # Stamp all outputs from execute

        outputs = [stamp(o, '.execstamp.') for o in outputs]

        # Update timestamps for pre-existing outputs so timestamp-based
        # dependency checking works

        command = 'mkdir -p ' + build_dir + '/outputs && ' + \
                  command + ' && touch -c ' + build_dir + '/outputs/*'

        # Stamp the build directory

        outputs.insert(0, build_dir + '/.execstamp')

        # Rules

        targets = make_execute(
            w=s.w,
            outputs=outputs,
            rule=rule,
            command=command,
            deps=all_deps,
            touch_target=not phony,
        )

        #.....................................................................
        # Built-in toggle for enabling/disabling this rule
        #.....................................................................
        # Clean up from the above
        s.w.write('endif')
        s.w.newline()
        s.w.newline()
        #.....................................................................

        return targets