Changes in tools/autotool.py [2689a0b:ec07933] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    r2689a0b rec07933  
    182182                             "Please contact the developers of HelenOS."])
    183183
     184def get_target(config):
     185        target = None
     186        gnu_target = None
     187        clang_target = None
     188        helenos_target = None
     189        cc_args = []
     190       
     191        if (config['PLATFORM'] == "abs32le"):
     192                check_config(config, "CROSS_TARGET")
     193                target = config['CROSS_TARGET']
     194               
     195                if (config['CROSS_TARGET'] == "arm32"):
     196                        gnu_target = "arm-linux-gnueabi"
     197                        clang_target = "arm-unknown-linux"
     198                        helenos_target = "arm-helenos-gnueabi"
     199               
     200                if (config['CROSS_TARGET'] == "ia32"):
     201                        gnu_target = "i686-pc-linux-gnu"
     202                        clang_target = "i386-unknown-linux"
     203                        helenos_target = "i686-pc-helenos"
     204               
     205                if (config['CROSS_TARGET'] == "mips32"):
     206                        gnu_target = "mipsel-linux-gnu"
     207                        clang_target = "mipsel-unknown-linux"
     208                        helenos_target = "mipsel-helenos"
     209                        common['CC_ARGS'].append("-mabi=32")
     210       
     211        if (config['PLATFORM'] == "amd64"):
     212                target = config['PLATFORM']
     213                gnu_target = "amd64-linux-gnu"
     214                clang_target = "x86_64-unknown-linux"
     215                helenos_target = "amd64-helenos"
     216       
     217        if (config['PLATFORM'] == "arm32"):
     218                target = config['PLATFORM']
     219                gnu_target = "arm-linux-gnueabi"
     220                clang_target = "arm-unknown-linux"
     221                helenos_target = "arm-helenos-gnueabi"
     222       
     223        if (config['PLATFORM'] == "ia32"):
     224                target = config['PLATFORM']
     225                gnu_target = "i686-pc-linux-gnu"
     226                clang_target = "i386-unknown-linux"
     227                helenos_target = "i686-pc-helenos"
     228       
     229        if (config['PLATFORM'] == "ia64"):
     230                target = config['PLATFORM']
     231                gnu_target = "ia64-pc-linux-gnu"
     232                helenos_target = "ia64-pc-helenos"
     233       
     234        if (config['PLATFORM'] == "mips32"):
     235                check_config(config, "MACHINE")
     236                cc_args.append("-mabi=32")
     237               
     238                if ((config['MACHINE'] == "msim") or (config['MACHINE'] == "lmalta")):
     239                        target = config['PLATFORM']
     240                        gnu_target = "mipsel-linux-gnu"
     241                        clang_target = "mipsel-unknown-linux"
     242                        helenos_target = "mipsel-helenos"
     243               
     244                if ((config['MACHINE'] == "bmalta")):
     245                        target = "mips32eb"
     246                        gnu_target = "mips-linux-gnu"
     247                        clang_target = "mips-unknown-linux"
     248                        helenos_target = "mips-helenos"
     249       
     250        if (config['PLATFORM'] == "mips64"):
     251                check_config(config, "MACHINE")
     252                cc_args.append("-mabi=64")
     253               
     254                if (config['MACHINE'] == "msim"):
     255                        target = config['PLATFORM']
     256                        gnu_target = "mips64el-linux-gnu"
     257                        clang_target = "mips64el-unknown-linux"
     258                        helenos_target = "mips64el-helenos"
     259       
     260        if (config['PLATFORM'] == "ppc32"):
     261                target = config['PLATFORM']
     262                gnu_target = "ppc-linux-gnu"
     263                clang_target = "powerpc-unknown-linux"
     264                helenos_target = "ppc-helenos"
     265       
     266        if (config['PLATFORM'] == "sparc32"):
     267                target = config['PLATFORM'];
     268                gnu_target = "sparc-leon3-linux-gnu"
     269                helenos_target = "sparc-leon3-helenos"
     270       
     271        if (config['PLATFORM'] == "sparc64"):
     272                target = config['PLATFORM']
     273                gnu_target = "sparc64-linux-gnu"
     274                clang_target = "sparc-unknown-linux"
     275                helenos_target = "sparc64-helenos"
     276       
     277        return (target, cc_args, gnu_target, clang_target, helenos_target)
     278
    184279def check_app(args, name, details):
    185280        "Check whether an application can be executed"
     
    260355        check_app([common['OBJDUMP'], "--version"], "GNU Objdump utility", details)
    261356        check_app([common['STRIP'], "--version"], "GNU strip", details)
     357
     358def check_python():
     359        "Check for Python dependencies"
     360       
     361        try:
     362                sys.stderr.write("Checking for PyYAML ... ")
     363                import yaml
     364        except ImportError:
     365                print_error(["PyYAML is missing.",
     366                             "",
     367                             "Please make sure that it is installed in your",
     368                             "system (usually part of PyYAML package)."])
     369       
     370        sys.stderr.write("ok\n")
    262371
    263372def decode_value(value):
     
    563672        outmk.write('#########################################\n')
    564673        outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
     674        outmk.write('## Generated by: tools/autotool.py     ##\n')
    565675        outmk.write('#########################################\n\n')
    566676       
     
    580690        outhd.write('/***************************************\n')
    581691        outhd.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
     692        outhd.write(' * Generated by: tools/autotool.py     *\n')
    582693        outhd.write(' ***************************************/\n\n')
    583694       
     
    617728        else:
    618729                cross_prefix = "/usr/local/cross"
     730       
     731        # HelenOS cross-compiler prefix
     732        if ('CROSS_HELENOS_PREFIX' in os.environ):
     733                cross_helenos_prefix = os.environ['CROSS_HELENOS_PREFIX']
     734        else:
     735                cross_helenos_prefix = "/usr/local/cross-helenos"
    619736       
    620737        # Prefix binutils tools on Solaris
     
    640757                common['CC_ARGS'] = []
    641758                if (config['COMPILER'] == "gcc_cross"):
    642                         if (config['PLATFORM'] == "abs32le"):
    643                                 check_config(config, "CROSS_TARGET")
    644                                 target = config['CROSS_TARGET']
    645                                
    646                                 if (config['CROSS_TARGET'] == "arm32"):
    647                                         gnu_target = "arm-linux-gnueabi"
    648                                
    649                                 if (config['CROSS_TARGET'] == "ia32"):
    650                                         gnu_target = "i686-pc-linux-gnu"
    651                                
    652                                 if (config['CROSS_TARGET'] == "mips32"):
    653                                         gnu_target = "mipsel-linux-gnu"
    654                                         common['CC_ARGS'].append("-mabi=32")
    655                        
    656                         if (config['PLATFORM'] == "amd64"):
    657                                 target = config['PLATFORM']
    658                                 gnu_target = "amd64-linux-gnu"
    659                        
    660                         if (config['PLATFORM'] == "arm32"):
    661                                 target = config['PLATFORM']
    662                                 gnu_target = "arm-linux-gnueabi"
    663                        
    664                         if (config['PLATFORM'] == "ia32"):
    665                                 target = config['PLATFORM']
    666                                 gnu_target = "i686-pc-linux-gnu"
    667                        
    668                         if (config['PLATFORM'] == "ia64"):
    669                                 target = config['PLATFORM']
    670                                 gnu_target = "ia64-pc-linux-gnu"
    671                        
    672                         if (config['PLATFORM'] == "mips32"):
    673                                 check_config(config, "MACHINE")
    674                                 common['CC_ARGS'].append("-mabi=32")
    675                                
    676                                 if ((config['MACHINE'] == "lgxemul") or (config['MACHINE'] == "msim")):
    677                                         target = config['PLATFORM']
    678                                         gnu_target = "mipsel-linux-gnu"
    679                                
    680                                 if (config['MACHINE'] == "bgxemul"):
    681                                         target = "mips32eb"
    682                                         gnu_target = "mips-linux-gnu"
    683                        
    684                         if (config['PLATFORM'] == "mips64"):
    685                                 check_config(config, "MACHINE")
    686                                 common['CC_ARGS'].append("-mabi=64")
    687                                
    688                                 if (config['MACHINE'] == "msim"):
    689                                         target = config['PLATFORM']
    690                                         gnu_target = "mips64el-linux-gnu"
    691                        
    692                         if (config['PLATFORM'] == "ppc32"):
    693                                 target = config['PLATFORM']
    694                                 gnu_target = "ppc-linux-gnu"
    695                        
    696                         if (config['PLATFORM'] == "sparc64"):
    697                                 target = config['PLATFORM']
    698                                 gnu_target = "sparc64-linux-gnu"
     759                        target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
     760                       
     761                        if (target is None) or (gnu_target is None):
     762                                print_error(["Unsupported compiler target for GNU GCC.",
     763                                             "Please contact the developers of HelenOS."])
    699764                       
    700765                        path = "%s/%s/bin" % (cross_prefix, target)
     
    706771                        check_common(common, "GCC")
    707772                        common['CC'] = common['GCC']
     773                        common['CC_ARGS'].extend(cc_args)
     774               
     775                if (config['COMPILER'] == "gcc_helenos"):
     776                        target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
     777                       
     778                        if (target is None) or (helenos_target is None):
     779                                print_error(["Unsupported compiler target for GNU GCC.",
     780                                             "Please contact the developers of HelenOS."])
     781                       
     782                        path = "%s/%s/bin" % (cross_helenos_prefix, target)
     783                        prefix = "%s-" % helenos_target
     784                       
     785                        check_gcc(path, prefix, common, PACKAGE_CROSS)
     786                        check_binutils(path, prefix, common, PACKAGE_CROSS)
     787                       
     788                        check_common(common, "GCC")
     789                        common['CC'] = common['GCC']
     790                        common['CC_ARGS'].extend(cc_args)
    708791               
    709792                if (config['COMPILER'] == "gcc_native"):
     
    721804               
    722805                if (config['COMPILER'] == "clang"):
     806                        target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
     807                       
     808                        if (target is None) or (gnu_target is None) or (clang_target is None):
     809                                print_error(["Unsupported compiler target for clang.",
     810                                             "Please contact the developers of HelenOS."])
     811                       
     812                        path = "%s/%s/bin" % (cross_prefix, target)
     813                        prefix = "%s-" % gnu_target
     814                       
     815                        check_app(["clang", "--version"], "clang compiler", "preferably version 1.0 or newer")
     816                        check_gcc(path, prefix, common, PACKAGE_GCC)
     817                        check_binutils(path, prefix, common, PACKAGE_BINUTILS)
     818                       
     819                        check_common(common, "GCC")
    723820                        common['CC'] = "clang"
    724                         check_app([common['CC'], "--version"], "Clang compiler", "preferably version 1.0 or newer")
    725                         check_gcc(None, "", common, PACKAGE_GCC)
    726                         check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
     821                        common['CC_ARGS'].extend(cc_args)
     822                        common['CC_ARGS'].append("-target")
     823                        common['CC_ARGS'].append(clang_target)
     824                        common['CLANG_TARGET'] = clang_target
     825               
     826                check_python()
    727827               
    728828                # Platform-specific utilities
     
    750850                sandbox_leave(owd)
    751851       
     852        common['AUTOGEN'] = "%s/autogen.py" % os.path.dirname(os.path.abspath(sys.argv[0]))
     853
    752854        create_makefile(MAKEFILE, common)
    753855        create_header(HEADER, maps)
Note: See TracChangeset for help on using the changeset viewer.