build: a library is only empty if it has no deps
[kamenim/samba.git] / buildtools / wafsamba / wafsamba.py
1 # a waf tool to add autoconf-like macros to the configure section
2 # and for SAMBA_ macros for building libraries, binaries etc
3
4 import Build, os, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil, Logs, Constants
5 from Configure import conf
6 from Logs import debug
7 from samba_utils import SUBST_VARS_RECURSIVE
8
9 # bring in the other samba modules
10 from samba_optimisation import *
11 from samba_utils import *
12 from samba_autoconf import *
13 from samba_patterns import *
14 from samba_pidl import *
15 from samba_errtable import *
16 from samba_asn1 import *
17 from samba_autoproto import *
18 from samba_python import *
19 from samba_deps import *
20 from samba_bundled import *
21 import samba_install
22 import samba_conftests
23 import samba_abi
24 import tru64cc
25 import irixcc
26 import generic_cc
27 import samba_dist
28
29 O644 = 420
30
31 # some systems have broken threading in python
32 if os.environ.get('WAF_NOTHREADS') == '1':
33     import nothreads
34
35 LIB_PATH="shared"
36
37 os.putenv('PYTHONUNBUFFERED', '1')
38
39
40 if Constants.HEXVERSION < 0x105016:
41     Logs.error('''
42 Please use the version of waf that comes with Samba, not
43 a system installed version. See http://wiki.samba.org/index.php/Waf
44 for details.
45
46 Alternatively, please use ./autogen-waf.sh, and then
47 run ./configure and make as usual. That will call the right version of waf.
48 ''')
49     sys.exit(1)
50
51
52 @conf
53 def SAMBA_BUILD_ENV(conf):
54     '''create the samba build environment'''
55     conf.env.BUILD_DIRECTORY = conf.blddir
56     mkdir_p(os.path.join(conf.blddir, LIB_PATH))
57     mkdir_p(os.path.join(conf.blddir, 'python/samba/dcerpc'))
58     # this allows all of the bin/shared and bin/python targets
59     # to be expressed in terms of build directory paths
60     mkdir_p(os.path.join(conf.blddir, 'default'))
61     for p in ['python','shared']:
62         link_target = os.path.join(conf.blddir, 'default/' + p)
63         if not os.path.lexists(link_target):
64             os.symlink('../' + p, link_target)
65
66     # get perl to put the blib files in the build directory
67     blib_bld = os.path.join(conf.blddir, 'default/pidl/blib')
68     blib_src = os.path.join(conf.srcdir, 'pidl/blib')
69     mkdir_p(blib_bld + '/man1')
70     mkdir_p(blib_bld + '/man3')
71     if os.path.islink(blib_src):
72         os.unlink(blib_src)
73     elif os.path.exists(blib_src):
74         shutil.rmtree(blib_src)
75
76
77 def ADD_INIT_FUNCTION(bld, subsystem, target, init_function):
78     '''add an init_function to the list for a subsystem'''
79     if init_function is None:
80         return
81     bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function)
82     cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
83     if not subsystem in cache:
84         cache[subsystem] = []
85     cache[subsystem].append( { 'TARGET':target, 'INIT_FUNCTION':init_function } )
86 Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
87
88
89
90 #################################################################
91 def SAMBA_LIBRARY(bld, libname, source,
92                   deps='',
93                   public_deps='',
94                   includes='',
95                   public_headers=None,
96                   header_path=None,
97                   pc_files=None,
98                   vnum=None,
99                   cflags='',
100                   external_library=False,
101                   realname=None,
102                   autoproto=None,
103                   group='main',
104                   depends_on='',
105                   local_include=True,
106                   vars=None,
107                   install_path=None,
108                   install=True,
109                   needs_python=False,
110                   target_type='LIBRARY',
111                   bundled_extension=True,
112                   link_name=None,
113                   abi_file=None,
114                   abi_match=None,
115                   hide_symbols=False,
116                   enabled=True):
117     '''define a Samba library'''
118
119     if not enabled:
120         SET_TARGET_TYPE(bld, libname, 'DISABLED')
121         return
122
123     source = bld.EXPAND_VARIABLES(source, vars=vars)
124
125     # remember empty libraries, so we can strip the dependencies
126     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
127         SET_TARGET_TYPE(bld, libname, 'EMPTY')
128         return
129
130     if target_type != 'PYTHON' and BUILTIN_LIBRARY(bld, libname):
131         obj_target = libname
132     else:
133         obj_target = libname + '.objlist'
134
135     # first create a target for building the object files for this library
136     # by separating in this way, we avoid recompiling the C files
137     # separately for the install library and the build library
138     bld.SAMBA_SUBSYSTEM(obj_target,
139                         source         = source,
140                         deps           = deps,
141                         public_deps    = public_deps,
142                         includes       = includes,
143                         public_headers = public_headers,
144                         header_path    = header_path,
145                         cflags         = cflags,
146                         group          = group,
147                         autoproto      = autoproto,
148                         depends_on     = depends_on,
149                         needs_python   = needs_python,
150                         hide_symbols   = hide_symbols,
151                         local_include  = local_include)
152
153     if libname == obj_target:
154         return
155
156     if not SET_TARGET_TYPE(bld, libname, target_type):
157         return
158
159     # the library itself will depend on that object target
160     deps += ' ' + public_deps
161     deps = TO_LIST(deps)
162     deps.append(obj_target)
163
164     if target_type == 'PYTHON':
165         bundled_name = libname
166     else:
167         bundled_name = BUNDLED_NAME(bld, libname, bundled_extension)
168
169     features = 'cc cshlib symlink_lib install_lib'
170     if target_type == 'PYTHON':
171         features += ' pyext'
172     elif needs_python:
173         features += ' pyembed'
174     if abi_file:
175         features += ' abi_check'
176
177     if abi_file:
178         abi_file = os.path.join(bld.curdir, abi_file)
179
180     bld.SET_BUILD_GROUP(group)
181     t = bld(
182         features        = features,
183         source          = [],
184         target          = bundled_name,
185         samba_cflags    = CURRENT_CFLAGS(bld, libname, cflags),
186         depends_on      = depends_on,
187         samba_deps      = deps,
188         samba_includes  = includes,
189         local_include   = local_include,
190         vnum            = vnum,
191         install_path    = None,
192         samba_inst_path = install_path,
193         name            = libname,
194         samba_realname  = realname,
195         samba_install   = install,
196         abi_file        = abi_file,
197         abi_match       = abi_match
198         )
199
200     if link_name:
201         t.link_name = link_name
202
203     if pc_files is not None:
204         bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
205
206 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
207
208
209 #################################################################
210 def SAMBA_BINARY(bld, binname, source,
211                  deps='',
212                  includes='',
213                  public_headers=None,
214                  header_path=None,
215                  modules=None,
216                  ldflags=None,
217                  cflags='',
218                  autoproto=None,
219                  use_hostcc=False,
220                  use_global_deps=True,
221                  compiler=None,
222                  group='binaries',
223                  manpages=None,
224                  local_include=True,
225                  subsystem_name=None,
226                  needs_python=False,
227                  vars=None,
228                  install=True,
229                  install_path=None):
230     '''define a Samba binary'''
231
232     if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
233         return
234
235     features = 'cc cprogram symlink_bin install_bin'
236     if needs_python:
237         features += ' pyembed'
238
239     obj_target = binname + '.objlist'
240
241     source = bld.EXPAND_VARIABLES(source, vars=vars)
242     source = unique_list(TO_LIST(source))
243
244     # first create a target for building the object files for this binary
245     # by separating in this way, we avoid recompiling the C files
246     # separately for the install binary and the build binary
247     bld.SAMBA_SUBSYSTEM(obj_target,
248                         source         = source,
249                         deps           = deps,
250                         includes       = includes,
251                         cflags         = cflags,
252                         group          = group,
253                         autoproto      = autoproto,
254                         subsystem_name = subsystem_name,
255                         needs_python   = needs_python,
256                         local_include  = local_include,
257                         use_hostcc     = use_hostcc,
258                         use_global_deps= use_global_deps)
259
260     bld.SET_BUILD_GROUP(group)
261
262     # the binary itself will depend on that object target
263     deps = TO_LIST(deps)
264     deps.append(obj_target)
265
266     t = bld(
267         features       = features,
268         source         = [],
269         target         = binname,
270         samba_cflags   = CURRENT_CFLAGS(bld, binname, cflags),
271         samba_deps     = deps,
272         samba_includes = includes,
273         local_include  = local_include,
274         samba_modules  = modules,
275         top            = True,
276         samba_subsystem= subsystem_name,
277         install_path   = None,
278         samba_inst_path= install_path,
279         samba_install  = install
280         )
281
282     # setup the subsystem_name as an alias for the real
283     # binary name, so it can be found when expanding
284     # subsystem dependencies
285     if subsystem_name is not None:
286         bld.TARGET_ALIAS(subsystem_name, binname)
287
288 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
289
290
291 #################################################################
292 def SAMBA_MODULE(bld, modname, source,
293                  deps='',
294                  includes='',
295                  subsystem=None,
296                  init_function=None,
297                  autoproto=None,
298                  autoproto_extra_source='',
299                  aliases=None,
300                  cflags='',
301                  internal_module=True,
302                  local_include=True,
303                  vars=None,
304                  enabled=True):
305     '''define a Samba module.'''
306
307     # we add the init function regardless of whether the module
308     # is enabled or not, as we need to generate a null list if
309     # all disabled
310     bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
311
312     if internal_module or BUILTIN_LIBRARY(bld, modname):
313         # treat internal modules as subsystems for now
314         SAMBA_SUBSYSTEM(bld, modname, source,
315                         deps=deps,
316                         includes=includes,
317                         autoproto=autoproto,
318                         autoproto_extra_source=autoproto_extra_source,
319                         cflags=cflags,
320                         local_include=local_include,
321                         enabled=enabled)
322         return
323
324     if not enabled:
325         SET_TARGET_TYPE(bld, modname, 'DISABLED')
326         return
327
328     source = bld.EXPAND_VARIABLES(source, vars=vars)
329     source = unique_list(TO_LIST(source))
330
331     # remember empty modules, so we can strip the dependencies
332     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
333         SET_TARGET_TYPE(bld, modname, 'EMPTY')
334         return
335
336     if not SET_TARGET_TYPE(bld, modname, 'MODULE'):
337         return
338
339     if subsystem is not None:
340         deps += ' ' + subsystem
341
342     bld.SET_BUILD_GROUP('main')
343     bld(
344         features       = 'cc',
345         source         = source,
346         target         = modname,
347         samba_cflags   = CURRENT_CFLAGS(bld, modname, cflags),
348         samba_includes = includes,
349         local_include  = local_include,
350         samba_deps     = TO_LIST(deps)
351         )
352
353     if autoproto is not None:
354         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
355
356 Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
357
358
359 #################################################################
360 def SAMBA_SUBSYSTEM(bld, modname, source,
361                     deps='',
362                     public_deps='',
363                     includes='',
364                     public_headers=None,
365                     header_path=None,
366                     cflags='',
367                     cflags_end=None,
368                     group='main',
369                     init_function_sentinal=None,
370                     heimdal_autoproto=None,
371                     heimdal_autoproto_options=None,
372                     heimdal_autoproto_private=None,
373                     autoproto=None,
374                     autoproto_extra_source='',
375                     depends_on='',
376                     local_include=True,
377                     local_include_first=True,
378                     subsystem_name=None,
379                     enabled=True,
380                     use_hostcc=False,
381                     use_global_deps=True,
382                     vars=None,
383                     hide_symbols=False,
384                     needs_python=False):
385     '''define a Samba subsystem'''
386
387     if not enabled:
388         SET_TARGET_TYPE(bld, modname, 'DISABLED')
389         return
390
391     # remember empty subsystems, so we can strip the dependencies
392     if ((source == '') or (source == [])) and deps == '' and public_deps == '':
393         SET_TARGET_TYPE(bld, modname, 'EMPTY')
394         return
395
396     if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
397         return
398
399     source = bld.EXPAND_VARIABLES(source, vars=vars)
400     source = unique_list(TO_LIST(source))
401
402     deps += ' ' + public_deps
403
404     bld.SET_BUILD_GROUP(group)
405
406     features = 'cc'
407     if needs_python:
408         features += ' pyext'
409
410     t = bld(
411         features       = features,
412         source         = source,
413         target         = modname,
414         samba_cflags   = CURRENT_CFLAGS(bld, modname, cflags, hide_symbols=hide_symbols),
415         depends_on     = depends_on,
416         samba_deps     = TO_LIST(deps),
417         samba_includes = includes,
418         local_include  = local_include,
419         local_include_first  = local_include_first,
420         samba_subsystem= subsystem_name,
421         samba_use_hostcc = use_hostcc,
422         samba_use_global_deps = use_global_deps
423         )
424
425     if cflags_end is not None:
426         t.samba_cflags.extend(TO_LIST(cflags_end))
427
428     if heimdal_autoproto is not None:
429         bld.HEIMDAL_AUTOPROTO(heimdal_autoproto, source, options=heimdal_autoproto_options)
430     if heimdal_autoproto_private is not None:
431         bld.HEIMDAL_AUTOPROTO_PRIVATE(heimdal_autoproto_private, source)
432     if autoproto is not None:
433         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
434     if public_headers is not None:
435         bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
436     return t
437
438
439 Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
440
441
442 def SAMBA_GENERATOR(bld, name, rule, source='', target='',
443                     group='generators', enabled=True,
444                     public_headers=None,
445                     header_path=None,
446                     vars=None):
447     '''A generic source generator target'''
448
449     if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
450         return
451
452     if not enabled:
453         return
454
455     bld.SET_BUILD_GROUP(group)
456     t = bld(
457         rule=rule,
458         source=bld.EXPAND_VARIABLES(source, vars=vars),
459         target=target,
460         shell=isinstance(rule, str),
461         on_results=True,
462         before='cc',
463         ext_out='.c',
464         name=name)
465
466     if public_headers is not None:
467         bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
468     return t
469 Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
470
471
472
473 @runonce
474 def SETUP_BUILD_GROUPS(bld):
475     '''setup build groups used to ensure that the different build
476     phases happen consecutively'''
477     bld.p_ln = bld.srcnode # we do want to see all targets!
478     bld.env['USING_BUILD_GROUPS'] = True
479     bld.add_group('setup')
480     bld.add_group('build_compiler_source')
481     bld.add_group('base_libraries')
482     bld.add_group('generators')
483     bld.add_group('compiler_prototypes')
484     bld.add_group('compiler_libraries')
485     bld.add_group('build_compilers')
486     bld.add_group('build_source')
487     bld.add_group('prototypes')
488     bld.add_group('main')
489     bld.add_group('binaries')
490     bld.add_group('final')
491 Build.BuildContext.SETUP_BUILD_GROUPS = SETUP_BUILD_GROUPS
492
493
494 def SET_BUILD_GROUP(bld, group):
495     '''set the current build group'''
496     if not 'USING_BUILD_GROUPS' in bld.env:
497         return
498     bld.set_group(group)
499 Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
500
501
502
503 @conf
504 def ENABLE_TIMESTAMP_DEPENDENCIES(conf):
505     """use timestamps instead of file contents for deps
506     this currently doesn't work"""
507     def h_file(filename):
508         import stat
509         st = os.stat(filename)
510         if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file')
511         m = Utils.md5()
512         m.update(str(st.st_mtime))
513         m.update(str(st.st_size))
514         m.update(filename)
515         return m.digest()
516     Utils.h_file = h_file
517
518
519
520 t = Task.simple_task_type('copy_script', 'rm -f ${LINK_TARGET} && ln -s ${SRC[0].abspath(env)} ${LINK_TARGET}',
521                           shell=True, color='PINK', ext_in='.bin')
522 t.quiet = True
523
524 @feature('copy_script')
525 @before('apply_link')
526 def copy_script(self):
527     tsk = self.create_task('copy_script', self.allnodes[0])
528     tsk.env.TARGET = self.target
529
530 def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
531     '''used to copy scripts from the source tree into the build directory
532        for use by selftest'''
533
534     source = bld.path.ant_glob(pattern)
535
536     bld.SET_BUILD_GROUP('build_source')
537     for s in TO_LIST(source):
538         iname = s
539         if installname != None:
540             iname = installname
541         target = os.path.join(installdir, iname)
542         tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target))
543         mkdir_p(tgtdir)
544         t = bld(features='copy_script',
545                 source       = s,
546                 target       = target,
547                 always       = True,
548                 install_path = None)
549         t.env.LINK_TARGET = target
550
551 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
552
553
554 def install_file(bld, destdir, file, chmod=O644, flat=False,
555                  python_fixup=False, destname=None, base_name=None):
556     '''install a file'''
557     destdir = bld.EXPAND_VARIABLES(destdir)
558     if not destname:
559         destname = file
560         if flat:
561             destname = os.path.basename(destname)
562     dest = os.path.join(destdir, destname)
563     if python_fixup:
564         # fixup the python path it will use to find Samba modules
565         inst_file = file + '.inst'
566         bld.SAMBA_GENERATOR('python_%s' % destname,
567                             rule="sed 's|\(sys.path.insert.*\)bin/python\(.*\)$|\\1${PYTHONDIR}\\2|g' < ${SRC} > ${TGT}",
568                             source=file,
569                             target=inst_file)
570         file = inst_file
571     if base_name:
572         file = os.path.join(base_name, file)
573     bld.install_as(dest, file, chmod=chmod)
574
575
576 def INSTALL_FILES(bld, destdir, files, chmod=O644, flat=False,
577                   python_fixup=False, destname=None, base_name=None):
578     '''install a set of files'''
579     for f in TO_LIST(files):
580         install_file(bld, destdir, f, chmod=chmod, flat=flat,
581                      python_fixup=python_fixup, destname=destname,
582                      base_name=base_name)
583 Build.BuildContext.INSTALL_FILES = INSTALL_FILES
584
585
586 def INSTALL_WILDCARD(bld, destdir, pattern, chmod=O644, flat=False,
587                      python_fixup=False, exclude=None, trim_path=None):
588     '''install a set of files matching a wildcard pattern'''
589     files=TO_LIST(bld.path.ant_glob(pattern))
590     if trim_path:
591         files2 = []
592         for f in files:
593             files2.append(os_path_relpath(f, trim_path))
594         files = files2
595
596     if exclude:
597         for f in files[:]:
598             if fnmatch.fnmatch(f, exclude):
599                 files.remove(f)
600     INSTALL_FILES(bld, destdir, files, chmod=chmod, flat=flat,
601                   python_fixup=python_fixup, base_name=trim_path)
602 Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
603
604
605 def INSTALL_DIRS(bld, destdir, dirs):
606     '''install a set of directories'''
607     destdir = bld.EXPAND_VARIABLES(destdir)
608     dirs = bld.EXPAND_VARIABLES(dirs)
609     for d in TO_LIST(dirs):
610         bld.install_dir(os.path.join(destdir, d))
611 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS
612
613
614 def PUBLIC_HEADERS(bld, public_headers, header_path=None):
615     '''install some headers
616
617     header_path may either be a string that is added to the INCLUDEDIR,
618     or it can be a dictionary of wildcard patterns which map to destination
619     directories relative to INCLUDEDIR
620     '''
621     dest = '${INCLUDEDIR}'
622     if isinstance(header_path, str):
623         dest += '/' + header_path
624     for h in TO_LIST(public_headers):
625         hdest = dest
626         if isinstance(header_path, list):
627             for (p1, dir) in header_path:
628                 found_match=False
629                 lst = TO_LIST(p1)
630                 for p2 in lst:
631                     if fnmatch.fnmatch(h, p2):
632                         if dir:
633                             hdest = os.path.join(hdest, dir)
634                         found_match=True
635                         break
636                 if found_match: break
637         if h.find(':') != -1:
638             hs=h.split(':')
639             INSTALL_FILES(bld, hdest, hs[0], flat=True, destname=hs[1])
640         else:
641             INSTALL_FILES(bld, hdest, h, flat=True)
642 Build.BuildContext.PUBLIC_HEADERS = PUBLIC_HEADERS
643
644
645 def subst_at_vars(task):
646     '''substiture @VAR@ style variables in a file'''
647     src = task.inputs[0].srcpath(task.env)
648     tgt = task.outputs[0].bldpath(task.env)
649
650     f = open(src, 'r')
651     s = f.read()
652     f.close()
653     # split on the vars
654     a = re.split('(@\w+@)', s)
655     out = []
656     back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
657     for v in a:
658         if re.match('@\w+@', v):
659             vname = v[1:-1]
660             if not vname in task.env and vname.upper() in task.env:
661                 vname = vname.upper()
662             if not vname in task.env:
663                 Logs.error("Unknown substitution %s in %s" % (v, task.name))
664                 sys.exit(1)
665             v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
666             # now we back substitute the allowed pc vars
667             for (b, m) in back_sub:
668                 s = task.env[b]
669                 if s == v[0:len(s)]:
670                     v = m + v[len(s):]
671         out.append(v)
672     contents = ''.join(out)
673     f = open(tgt, 'w')
674     s = f.write(contents)
675     f.close()
676     return 0
677
678
679
680 def PKG_CONFIG_FILES(bld, pc_files, vnum=None):
681     '''install some pkg_config pc files'''
682     dest = '${PKGCONFIGDIR}'
683     dest = bld.EXPAND_VARIABLES(dest)
684     for f in TO_LIST(pc_files):
685         base=os.path.basename(f)
686         t = bld.SAMBA_GENERATOR('PKGCONFIG_%s' % base,
687                                 rule=subst_at_vars,
688                                 source=f+'.in',
689                                 target=f)
690         if vnum:
691             t.env.PACKAGE_VERSION = vnum
692         INSTALL_FILES(bld, dest, f, flat=True, destname=base)
693 Build.BuildContext.PKG_CONFIG_FILES = PKG_CONFIG_FILES
694
695
696
697 #############################################################
698 # give a nicer display when building different types of files
699 def progress_display(self, msg, fname):
700     col1 = Logs.colors(self.color)
701     col2 = Logs.colors.NORMAL
702     total = self.position[1]
703     n = len(str(total))
704     fs = '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n, n, msg)
705     return fs % (self.position[0], self.position[1], col1, fname, col2)
706
707 def link_display(self):
708     if Options.options.progress_bar != 0:
709         return Task.Task.old_display(self)
710     fname = self.outputs[0].bldpath(self.env)
711     return progress_display(self, 'Linking', fname)
712 Task.TaskBase.classes['cc_link'].display = link_display
713
714 def samba_display(self):
715     if Options.options.progress_bar != 0:
716         return Task.Task.old_display(self)
717
718     targets    = LOCAL_CACHE(self, 'TARGET_TYPE')
719     if self.name in targets:
720         target_type = targets[self.name]
721         type_map = { 'GENERATOR' : 'Generating',
722                      'PROTOTYPE' : 'Generating'
723                      }
724         if target_type in type_map:
725             return progress_display(self, type_map[target_type], self.name)
726
727     fname = self.inputs[0].bldpath(self.env)
728     if fname[0:3] == '../':
729         fname = fname[3:]
730     ext_loc = fname.rfind('.')
731     if ext_loc == -1:
732         return Task.Task.old_display(self)
733     ext = fname[ext_loc:]
734
735     ext_map = { '.idl' : 'Compiling IDL',
736                 '.et'  : 'Compiling ERRTABLE',
737                 '.asn1': 'Compiling ASN1',
738                 '.c'   : 'Compiling' }
739     if ext in ext_map:
740         return progress_display(self, ext_map[ext], fname)
741     return Task.Task.old_display(self)
742
743 Task.TaskBase.classes['Task'].old_display = Task.TaskBase.classes['Task'].display
744 Task.TaskBase.classes['Task'].display = samba_display