wscript 1.6 KB

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