VirtualBox

Changeset 2955 in kBuild


Ignore:
Timestamp:
Sep 21, 2016 7:05:53 PM (8 years ago)
Author:
bird
Message:

kDepObj: Added -e<ignored .ext> option for avoid circular dependencies when compiling the precompiled header file (pch).

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kDepPre/kDepPre.c

    r2413 r2955  
    465465    if (!i)
    466466    {
    467         depOptimize(fFixCase, 0 /* fQuiet */);
     467        depOptimize(fFixCase, 0 /* fQuiet */, NULL /*pszIgnoredExt*/);
    468468        fprintf(pOutput, "%s:", pszTarget);
    469469        depPrint(pOutput);
  • trunk/src/kObjCache/kObjCache.c

    r2627 r2955  
    11011101        FatalMsg("Failed to open dependency file '%s': %s\n", pszFilename, strerror(errno));
    11021102
    1103     depOptimize(fFixCase, fQuiet);
     1103    depOptimize(fFixCase, fQuiet, NULL /*pszIgnoredExt*/);
    11041104
    11051105    /* Make object file name with unix slashes. */
  • trunk/src/kmk/kmkbuiltin/kDepIDB.c

    r2856 r2955  
    865865    if (!i)
    866866    {
    867         depOptimize(fFixCase, fQuiet);
     867        depOptimize(fFixCase, fQuiet, NULL /*pszIgnoredExt*/);
    868868        fprintf(pOutput, "%s:", pszTarget);
    869869        depPrint(pOutput);
  • trunk/src/kmk/kmkbuiltin/kDepObj.c

    r2896 r2955  
    974974static void usage(const char *a_argv0)
    975975{
    976     printf("usage: %s -o <output> -t <target> [-fqs] <OMF-file>\n"
     976    printf("usage: %s -o <output> -t <target> [-fqs] [-e <ignore-ext>] <OMF or COFF file>\n"
    977977           "   or: %s --help\n"
    978978           "   or: %s --version\n",
     
    992992    int         fStubs = 0;
    993993    int         fFixCase = 0;
     994    const char *pszIgnoreExt = NULL;
    994995    /* Argument parsing. */
    995996    int         fInput = 0;             /* set when we've found input argument. */
     
    10101011        if (argv[i][0] == '-')
    10111012        {
     1013            const char *pszValue;
    10121014            const char *psz = &argv[i][1];
    1013             if (*psz == '-')
     1015            char chOpt;
     1016            chOpt = *psz++;
     1017            if (chOpt == '-')
    10141018            {
    1015                 if (!strcmp(psz, "-quiet"))
    1016                     psz = "q";
    1017                 else if (!strcmp(psz, "-help"))
    1018                     psz = "?";
    1019                 else if (!strcmp(psz, "-version"))
    1020                     psz = "V";
     1019                /* Convert long to short option. */
     1020                if (!strcmp(psz, "quiet"))
     1021                    chOpt = 'q';
     1022                else if (!strcmp(psz, "help"))
     1023                    chOpt = '?';
     1024                else if (!strcmp(psz, "version"))
     1025                    chOpt = 'V';
     1026                else
     1027                {
     1028                    fprintf(stderr, "%s: syntax error: Invalid argument '%s'.\n", argv[0], argv[i]);
     1029                    usage(argv[0]);
     1030                    return 2;
     1031                }
     1032                psz = "";
    10211033            }
    10221034
    1023             switch (*psz)
     1035            /*
     1036             * Requires value?
     1037             */
     1038            switch (chOpt)
     1039            {
     1040                case 'o':
     1041                case 't':
     1042                case 'e':
     1043                    if (*psz)
     1044                        pszValue = psz;
     1045                    else if (++i < argc)
     1046                        pszValue = argv[i];
     1047                    else
     1048                    {
     1049                        fprintf(stderr, "%s: syntax error: The '-%c' option takes a value.\n", chOpt);
     1050                        return 2;
     1051                    }
     1052                    break;
     1053
     1054                default:
     1055                    pszValue = NULL;
     1056                    break;
     1057            }
     1058
     1059
     1060            switch (chOpt)
    10241061            {
    10251062                /*
     
    10281065                case 'o':
    10291066                {
    1030                     pszOutput = &argv[i][2];
    10311067                    if (pOutput)
    10321068                    {
    10331069                        fprintf(stderr, "%s: syntax error: only one output file!\n", argv[0]);
    1034                         return 1;
     1070                        return 2;
    10351071                    }
    1036                     if (!*pszOutput)
    1037                     {
    1038                         if (++i >= argc)
    1039                         {
    1040                             fprintf(stderr, "%s: syntax error: The '-o' argument is missing the filename.\n", argv[0]);
    1041                             return 1;
    1042                         }
    1043                         pszOutput = argv[i];
    1044                     }
     1072                    pszOutput = pszValue;
    10451073                    if (pszOutput[0] == '-' && !pszOutput[1])
    10461074                        pOutput = stdout;
     
    10651093                        return 1;
    10661094                    }
    1067                     pszTarget = &argv[i][2];
    1068                     if (!*pszTarget)
    1069                     {
    1070                         if (++i >= argc)
    1071                         {
    1072                             fprintf(stderr, "%s: syntax error: The '-t' argument is missing the target name.\n", argv[0]);
    1073                             return 1;
    1074                         }
    1075                         pszTarget = argv[i];
    1076                     }
     1095                    pszTarget = pszValue;
    10771096                    break;
    10781097                }
     
    11021121                {
    11031122                    fStubs = 1;
     1123                    break;
     1124                }
     1125
     1126                /*
     1127                 * Extension to ignore.
     1128                 */
     1129                case 'e':
     1130                {
     1131                    if (pszIgnoreExt)
     1132                    {
     1133                        fprintf(stderr, "%s: syntax error: The '-e' option can only be used once!\n");
     1134                        return 2;
     1135                    }
     1136                    pszIgnoreExt = pszValue;
    11041137                    break;
    11051138                }
     
    11211154                    fprintf(stderr, "%s: syntax error: Invalid argument '%s'.\n", argv[0], argv[i]);
    11221155                    usage(argv[0]);
    1123                     return 1;
     1156                    return 2;
    11241157            }
    11251158        }
     
    11791212    if (!i)
    11801213    {
    1181         depOptimize(fFixCase, fQuiet);
     1214        depOptimize(fFixCase, fQuiet, pszIgnoreExt);
    11821215        fprintf(pOutput, "%s:", pszTarget);
    11831216        depPrint(pOutput);
  • trunk/src/lib/kDep.c

    r2950 r2955  
    187187 * 'Optimizes' and corrects the dependencies.
    188188 */
    189 void depOptimize(int fFixCase, int fQuiet)
     189void depOptimize(int fFixCase, int fQuiet, const char *pszIgnoredExt)
    190190{
    191191    /*
    192192     * Walk the list correct the names and re-insert them.
    193193     */
    194     PDEP pDepOrg = g_pDeps;
    195     PDEP pDep = g_pDeps;
     194    size_t  cchIgnoredExt = pszIgnoredExt ? strlen(pszIgnoredExt) : 0;
     195    PDEP    pDepOrg = g_pDeps;
     196    PDEP    pDep = g_pDeps;
    196197    g_pDeps = NULL;
    197198    for (; pDep; pDep = pDep->pNext)
     
    214215            continue;
    215216        pszFilename = pDep->szFilename;
     217
     218        /*
     219         * Skip pszIgnoredExt if given.
     220         */
     221        if (   pszIgnoredExt
     222            && pDep->cchFilename > cchIgnoredExt
     223            && memcmp(&pDep->szFilename[pDep->cchFilename - cchIgnoredExt], pszIgnoredExt, cchIgnoredExt) == 0)
     224            continue;
    216225
    217226#if K_OS != K_OS_OS2 && K_OS != K_OS_WINDOWS
  • trunk/src/lib/kDep.h

    r2851 r2955  
    4848
    4949extern PDEP depAdd(const char *pszFilename, size_t cchFilename);
    50 extern void depOptimize(int fFixCase, int fQuiet);
     50extern void depOptimize(int fFixCase, int fQuiet, const char *pszIgnoredExt);
    5151extern void depPrint(FILE *pOutput);
    5252extern void depPrintStubs(FILE *pOutput);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette