wscript (1667B)
1 #! /usr/bin/env python 2 # encoding: utf-8 3 # Thomas Nagy, 2010 (ita) 4 5 VERSION='0.0.1' 6 APPNAME='cc_test' 7 8 """ 9 The build groups can be processed all at once (required for the progress bar) 10 or sequentially in a lazy manner. 11 12 Each time one more .c file will be added during the build and compiled and linked in app 13 14 $ waf distclean configure build build 15 'distclean' finished successfully (0.005s) 16 Setting top to : /dynamic_build 17 Setting out to : /dynamic_build/build 18 Checking for 'gcc' (c compiler) : ok 19 'configure' finished successfully (0.091s) 20 21 Waf: Entering directory `/dynamic_build/build' 22 [1/1] foo_3.c: -> build/foo_3.c 23 [2/4] c: main.c -> build/main.c.1.o 24 [3/4] c: build/foo_3.c -> build/foo_3.c.1.o 25 [4/4] cprogram: build/main.c.1.o build/foo_3.c.1.o -> build/app 26 Waf: Leaving directory `/dynamic_build/build' 27 'build' finished successfully (5.169s) 28 29 Waf: Entering directory `/dynamic_build/build' 30 [1/1] foo_17.c: -> build/foo_17.c 31 [3/5] c: build/foo_17.c -> build/foo_17.c.1.o 32 [5/5] cprogram: build/main.c.1.o build/foo_17.c.1.o build/foo_3.c.1.o -> build/app 33 Waf: Leaving directory `/dynamic_build/build' 34 'build' finished successfully (5.144s) 35 """ 36 37 top = '.' 38 39 def options(opt): 40 opt.load('compiler_c') 41 42 def configure(conf): 43 conf.load('compiler_c') 44 45 46 def build(bld): 47 import random 48 rnd = random.randint(0, 25) 49 bld( 50 rule = "sleep 2 && (echo 'int num%d = %d;' > ${TGT})" % (rnd, rnd), 51 target = 'foo_%d.c' % rnd, 52 ) 53 54 bld.add_group() 55 56 it = bld.path.get_bld().ant_glob('*.c', remove=False, quiet=True, generator=True) 57 src = ['main.c', it] 58 bld(features='c cprogram', source=src, target='app') 59