Changeset 306 for tbroadcast


Ignore:
Timestamp:
Nov 10, 2006, 11:23:41 AM (18 years ago)
Author:
garonne
Message:

add the recursive make option

Location:
tbroadcast/HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tbroadcast/HEAD/python/tbroadcast.py

    r261 r306  
    492492      #sys.exit(-1)
    493493
     494   
     495    def generate_make (self, file, command):
     496        print 'generate_make'
     497        makefile = open (file, 'w+')
     498        self.recursive_make (self.current_package, command, makefile, len(self.packages))
     499        makefile.close ()
     500       
     501    def recursive_make (self, package, command, makefile, indice,actions=list()):
     502        lines = self.generate_action_make (package, command, indice)
     503        makefile.write (lines)
     504        print lines               
     505        for pkg in self.packages[package] ['uses']:
     506            if pkg not in actions:
     507                actions.append(pkg)
     508                indice = indice - 1
     509                self.recursive_make(pkg, command,makefile, indice, actions)       
     510       
     511    def generate_action_make (self, package, command, indice):
     512        lines = package + ' :: '       
     513        # add dependencies
     514        for pkg in self.packages[package] ['uses']:
     515            lines = lines + ' ' + pkg           
     516
     517        # add the action itself
     518        newcommand = string.replace (command, '<package>', package)
     519        lines = lines + '\n'
     520        lines = lines +  '\t@echo "#--------------------------------------------------------------"\n'
     521        lines = lines +  '\t@echo "# ('+str(indice)+'/'+str(len(self.packages))+') Now trying ['+newcommand+'] in '+ self.packages[package]['path']+'"\n'
     522        lines = lines +  '\t@echo "#--------------------------------------------------------------"\n'
     523        lines = lines + '\t@cd ' + self.packages[package]['path']           
     524        lines = lines + ' ; ' + newcommand               
     525        lines = lines + '\n\n'
     526        return lines
     527       
    494528#--------- EoF --------#
  • tbroadcast/HEAD/scripts/tbroadcast

    r259 r306  
    2424    print '#   -global               : Reach packages in all CMTPATH/CMTPROJECTPATH items'   
    2525    print '#   -ignore_cycles        : Suppress automatically the cycles'
     26    print '#   -make=<file>          : Generate a recursive Make, see: http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html'
    2627    print '#   -nb=<num_worker>      : Change the total number of threads[default is 20]'
    2728    print '#   -output=<location>    : Output directory to store output files with the form <package>_output.log'
     
    4849    error         = None
    4950    file          = None
     51    make          = None
     52    makefile      = 'Makefile'
    5053   
    5154    if len(sys.argv) == 1:
     
    8487                 elif option == '-print':
    8588                         print_graph = True   
     89                 elif option == '-make':       
     90                     make     = True
     91                     makefile = string.split(arg,'=')[1]
    8692             else:
    8793                  command = arg
     
    94100    elif print_graph:
    95101        master.print_dependencies ()
     102    elif make:
     103        master.generate_make (makefile, command)   
    96104    else:
    97105        master.execute_all (command)
Note: See TracChangeset for help on using the changeset viewer.