waf

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

wscript (1527B)


      1 #! /usr/bin/env python
      2 # encoding: utf-8
      3 # Thomas Nagy, 2006-2010 (ita)
      4 
      5 VERSION='0.0.1'
      6 APPNAME='cc_test'
      7 
      8 top = '.'
      9 
     10 import waflib.Configure
     11 waflib.Configure.autoconfig = True
     12 
     13 def options(opt):
     14 	opt.load('compiler_c')
     15 
     16 def configure(conf):
     17 	conf.load('compiler_c')
     18 
     19 def build(bld):
     20 
     21 	bld(rule='echo "int ko = $$RANDOM;" > ${TGT}', target='faa.h', always=True, shell=True, name='z2')
     22 	bld.program(source='a.c main.c', target='foo', includes='.')
     23 
     24 # sort the tasks in reverse order to force the 'faa.h' creation in last position
     25 from waflib import Task, Errors, Logs
     26 old = Task.set_file_constraints
     27 def meth(lst):
     28 	try:
     29 		lst.sort(cmp=lambda x, y: cmp(x.__class__.__name__, y.__class__.__name__))
     30 	except:
     31 		lst.sort(key=lambda x: x.__class__.__name__) # python3
     32 	old(lst)
     33 Task.set_file_constraints = meth
     34 
     35 def are_implicit_nodes_ready(self):
     36 	"""remove this method if/when the main one is enabled"""
     37 	bld = self.generator.bld
     38 	try:
     39 		cache = bld.dct_implicit_nodes
     40 	except:
     41 		bld.dct_implicit_nodes = cache = {}
     42 
     43 	try:
     44 		dct = cache[bld.current_group]
     45 	except KeyError:
     46 		dct = cache[bld.current_group] = {}
     47 		for tsk in bld.cur_tasks:
     48 			for x in tsk.outputs:
     49 				dct[x] = tsk
     50 
     51 	modified = False
     52 	for x in bld.node_deps.get(self.uid(), []):
     53 		if x in dct:
     54 			self.run_after.add(dct[x])
     55 			modified = True
     56 
     57 	if modified:
     58 		for tsk in self.run_after:
     59 			if not tsk.hasrun:
     60 				Logs.warn('task %r is not ready...', self)
     61 				raise Errors.TaskNotReady('not ready')
     62 Task.Task.are_implicit_nodes_ready = are_implicit_nodes_ready
     63