Changeset 558 for trunk/src


Ignore:
Timestamp:
Sep 29, 2006, 6:14:09 PM (19 years ago)
Author:
bird
Message:

fixed kbuild_get_object_suffix bug wrt to generated sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/kbuild.c

    r544 r558  
    226226 */
    227227static struct variable *
    228 kbuild_first_prop(struct variable *pTarget, struct variable *pSource, 
     228kbuild_first_prop(struct variable *pTarget, struct variable *pSource,
    229229                  struct variable *pTool, struct variable *pType,
    230                   struct variable *pBldTrg, struct variable *pBldTrgArch, 
     230                  struct variable *pBldTrg, struct variable *pBldTrgArch,
    231231                  const char *pszPropF1, const char *pszPropF2, const char *pszVarName)
    232232{
     
    326326                       struct variable *pBldTrg, struct variable *pBldTrgArch, const char *pszVarName)
    327327{
    328     struct variable *pVar = kbuild_first_prop(pTarget, pSource, NULL, pType, pBldTrg, pBldTrgArch, 
     328    struct variable *pVar = kbuild_first_prop(pTarget, pSource, NULL, pType, pBldTrg, pBldTrgArch,
    329329                                              "TOOL", "TOOL", pszVarName);
    330330    if (!pVar)
     
    366366*/
    367367static struct variable *
    368 kbuild_get_object_suffix(struct variable *pTarget, struct variable *pSource, 
    369                          struct variable *pTool, struct variable *pType, 
     368kbuild_get_object_suffix(struct variable *pTarget, struct variable *pSource,
     369                         struct variable *pTool, struct variable *pType,
    370370                         struct variable *pBldTrg, struct variable *pBldTrgArch, const char *pszVarName)
    371371{
     
    412412    struct variable *pPathSubCur = kbuild_get_variable("PATH_SUB_CURRENT");
    413413    const char *pszSrcPrefix = NULL;
     414    size_t      cchSrcPrefix = 0;
    414415    const char *pszSrcEnd;
    415416    char *pszSrc;
     
    427428        pszSrc = pSource->value + pPathTarget->value_length;
    428429        pszSrcPrefix = "gen/";
     430        cchSrcPrefix = sizeof("gen/") - 1;
     431        if (    *pszSrc == '/'
     432            &&  !strncmp(pszSrc + 1, pTarget->value, pTarget->value_length)
     433            &&   (   pszSrc[pTarget->value_length + 1] == '/'
     434                  || pszSrc[pTarget->value_length + 1] == '\0'))
     435            pszSrc += 1 + pTarget->value_length;
    429436    }
    430437    else if (    pSource->value_length > pPathRoot->value_length
     
    433440        pszSrc = pSource->value + pPathRoot->value_length;
    434441        if (    *pszSrc == '/'
    435             &&  !strncmp(pszSrc, pPathSubCur->value, pPathSubCur->value_length))
     442            &&  !strncmp(pszSrc + 1, pPathSubCur->value, pPathSubCur->value_length)
     443            &&   (   pszSrc[pPathSubCur->value_length + 1] == '/'
     444                  || pszSrc[pPathSubCur->value_length + 1] == '\0'))
    436445            pszSrc += 1 + pPathSubCur->value_length;
    437446    }
     
    479488        + pTarget->value_length
    480489        + 1 /* slash */
     490        + cchSrcPrefix
    481491        + pszSrcEnd - pszSrc
    482492        + 1;
     
    487497    memcpy(psz, pTarget->value, pTarget->value_length); psz += pTarget->value_length;
    488498    *psz++ = '/';
     499    if (pszSrcPrefix)
     500    {
     501        memcpy(psz, pszSrcPrefix, cchSrcPrefix);
     502        psz += cchSrcPrefix;
     503    }
    489504    memcpy(psz, pszSrc, pszSrcEnd - pszSrc); psz += pszSrcEnd - pszSrc;
    490505    *psz = '\0';
     
    591606    pSdks->cTargetSource = 0;
    592607    sprintf(pszTmp, "$(%s_%s_SDKS) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s.%s)",
    593             pTarget->value, pSource->value, 
     608            pTarget->value, pSource->value,
    594609            pTarget->value, pSource->value, pBldType->value,
    595610            pTarget->value, pSource->value, pBldTrg->value,
Note: See TracChangeset for help on using the changeset viewer.