waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

wscript (1605B)


      1 #! /usr/bin/env python3
      2 
      3 from waflib import Utils
      4 
      5 top = '.'
      6 out = 'bin'
      7 
      8 def options(opt):
      9 	opt.load('compiler_c')
     10 
     11 def configure(conf):
     12 	conf.load('compiler_c')
     13 
     14 def build(bld):
     15 
     16 	bld(rule='echo hi')
     17 	bld(rule='touch ${TGT}', target='foo.txt')
     18 
     19 
     20 	bld(rule='touch ${TGT}', target='aaa')
     21 	t = bld(rule='touch ${TGT}', target='bbb', source='aaa')
     22 	t = bld(rule='touch ${TGT}', target='ccc', source='bbb')
     23 	t = bld(rule='touch ${TGT}', target='ddd', source='ccc')
     24 	t = bld(rule=('touch ${TGT}', 'touch ${TGT}'), target='eee', source='ddd', chmod=Utils.O755)
     25 	t.create_task('foo')
     26 
     27 	#print( 'path from srcnode', bld.path.find_or_declare('aaa').path_from(bld.bldnode) )
     28 
     29 	# folders as nodes are best avoided
     30 	dnode = bld.path.get_bld().make_node('testdir')
     31 	bld(rule='mkdir -p ${TGT}', target=dnode)
     32 	bld(rule='touch ${TGT}', source=dnode, target=dnode.make_node('stuff'), cls_str=lambda x: 'stuff')
     33 
     34 	bld.install_files('/tmp/bar', 'wscript')
     35 	bld(features='c cprogram', source='main.c', target='app')
     36 
     37 
     38 def init(self):
     39 	print('init')
     40 
     41 def shutdown(self):
     42 	print('shutdown')
     43 
     44 def bar(ctx):
     45 	print("command ok")
     46 
     47 from waflib import Task
     48 
     49 class foo(Task.Task):
     50 	always_run = True
     51 	def run(self):
     52 		print("running foo")
     53 
     54 print("classes", Task.classes)
     55 
     56 #-----------------------------------------------
     57 # variant example below
     58 # call "../waf debug"
     59 #
     60 
     61 import os
     62 from waflib import Build, Options
     63 
     64 class debug_context(Build.BuildContext):
     65 	cmd = 'debug'
     66 	fun = 'build'
     67 	variant = 'test'
     68 	def __init__(self, start=None):
     69 		Build.BuildContext.__init__(self, start=start)
     70 
     71 # looks evil
     72 #def debug(bld):
     73 #	build(bld)
     74