github.com/hwaf/hwaf@v0.0.0-20140814122253-5465f73b20f1/py-hwaftools/orch/features/feature_makemake.py (about) 1 #!/usr/bin/env python 2 ''' 3 Features to do a "make" double-pump. 4 5 This feature rely on the "prepare" step to have run. It produces "build" and "install" steps. 6 7 ''' 8 9 from waflib.TaskGen import feature 10 import waflib.Logs as msg 11 12 from orch.wafutil import exec_command 13 import orch.features 14 15 orch.features.register_defaults( 16 'makemake', 17 build_cmd = 'make', 18 build_cmd_options = '', 19 build_target = '', 20 build_target_path = '{build_dir}/{build_target}', 21 22 install_cmd = 'make install', 23 install_cmd_options = '', # please don't set DESTDIR implicitly 24 install_target = '', 25 install_target_path = '{install_dir}/{install_target}', 26 ) 27 28 @feature('makemake') 29 def feature_makemake(tgen): 30 31 def build(task): 32 cmdstr = '{build_cmd} {build_cmd_options}' 33 cmd = tgen.worch.format(cmdstr) 34 return exec_command(task, cmd) 35 tgen.step('build', 36 rule = build, 37 source = tgen.control_node('prepare'), 38 target = tgen.worch.build_target_path) 39 40 def install(task): 41 cmdstr = '{install_cmd} {install_cmd_options}' 42 cmd = tgen.worch.format(cmdstr) 43 return exec_command(task, cmd) 44 tgen.step('install', 45 rule = install, 46 source = tgen.control_node('build'), 47 target = tgen.make_node(tgen.worch.install_target_path))