waf

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

wscript (913B)


      1 #! /usr/bin/env python
      2 # encoding: utf-8
      3 # Thomas Nagy, 2011 (ita)
      4 
      5 """
      6 One test for headers
      7 Just call 'waf clean test'
      8 """
      9 
     10 VERSION='0.0.1'
     11 APPNAME='cc_test'
     12 
     13 top = '.'
     14 
     15 def options(opt):
     16 	opt.load('compiler_c')
     17 
     18 def configure(conf):
     19 	conf.load('compiler_c ')
     20 
     21 def build(bld):
     22 	bld.program(source='main.c', includes='. uhu', target='bar')
     23 
     24 # ---------------------------------------------------------
     25 
     26 import shutil
     27 from waflib import Options
     28 
     29 def test(ctx):
     30 	Options.commands += ['test1', 'build', 'test2', 'build']
     31 
     32 def test1(ctx):
     33 	d = ctx.path.make_node('uhu')
     34 	d.mkdir()
     35 
     36 	bar = d.make_node('bar.h')
     37 	bar.write('int k = 32;\n')
     38 	main = ctx.path.make_node('main.c')
     39 	main.write('#include "bar.h"\nint main() { return 0; }\n')
     40 
     41 def test2(ctx):
     42 	d = ctx.path.find_node('uhu')
     43 	if d:
     44 		shutil.rmtree(d.abspath())
     45 	main = ctx.path.make_node('main.c')
     46 	main.write('//#include "bar.h"\nint main() { return 0; }\n')