The main function.

def main():
    """The main function."""

    # Prepare and run cmdline-parser.
    cmdlineParser = argparse.ArgumentParser(
                    description="Fixes the input files used for pre-processing of Boost.MPL headers.")
    cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true',
                               help="Be a little bit more verbose.")
    cmdlineParser.add_argument("--check-only", dest='checkonly', action='store_true',
                               help="Only checks if fixing is required.")
    cmdlineParser.add_argument(dest='sourceDir', metavar="<source-dir>",
                               type=to_existing_absolute_path,
                               help="The source-directory of Boost.")
    args = cmdlineParser.parse_args()

    # Some verbose debug output.
    if args.verbose:
        print "Arguments extracted from command-line:"
        print "  verbose           = ", args.verbose
        print "  check-only        = ", args.checkonly
        print "  source directory  = ", args.sourceDir

    # The directories for header- and source files of Boost.MPL.    
    # NOTE: Assuming 'args.sourceDir' is the source-directory of the entire boost project.
    headerDir = os.path.join( args.sourceDir, "boost", "mpl" )
    sourceDir = os.path.join( args.sourceDir, "libs", "mpl", "preprocessed" )
    # Check that the header/source-directories exist.
    if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ):
        # Maybe 'args.sourceDir' is not the source-directory of the entire boost project
        # but instead of the Boost.MPL git-directory, only?
        headerDir = os.path.join( args.sourceDir, "include", "boost", "mpl" )
        sourceDir = os.path.join( args.sourceDir, "preprocessed" )
        if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ):
            cmdlineParser.print_usage()
            print "error: Cannot find Boost.MPL header/source files in given Boost source-directory!"
            sys.exit(0)

    # Some verbose debug output.
    if args.verbose:
        print "Chosen header-directory: ", headerDir
        print "Chosen source-directory: ", sourceDir

    if args.checkonly:
        # Check input files for generating pre-processed headers.
        result = check_input_files(headerDir, sourceDir, verbose = args.verbose)
        if result:
            print "Fixing the input-files used for pre-processing of Boost.MPL headers IS required."
        else:
            print "Fixing the input-files used for pre-processing of Boost.MPL headers is NOT required."
    else:
        # Fix input files for generating pre-processed headers.
        fix_input_files(headerDir, sourceDir, verbose = args.verbose)