import ntpath


def cleanUpPath(path):
    """
    This function:
    1) Removes extra beginning/trailing quotes, spaces and newlines.
    2) Normalizes the paths.
    3) Appends './' to all paths. All paths are assumed to be relative to the Makefile.

    Returns a clean up path.
    """
    # Remove extra quotes and spaces
    cleanPath = path.strip()
    cleanPath = cleanPath.strip("\"")
    # The normalize operation needs to happen before prepend project directory 
    # variable operation. After appending the placeholder variable to the output 
    # is not a standard path so the normalize operation does not work correctly
    cleanPath = ntpath.normpath(cleanPath)
    # Append project dir
    if cleanPath != ".":
        cleanPath = ntpath.join('./', cleanPath)
    # Replace backslashes with slashes
    cleanPath = cleanPath.replace('\\', '/')
    return cleanPath