VirtualBox

Changeset 534 in kBuild


Ignore:
Timestamp:
Sep 18, 2006 11:16:21 PM (19 years ago)
Author:
bird
Message:

Made it build again on linux.

Location:
trunk/src/gmake
Files:
3 edited

Legend:

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

    r532 r534  
    3030
    3131#include "make.h"
     32#include "filedef.h"
    3233#include "variable.h"
    3334#include "dep.h"
     
    4041#ifndef va_copy
    4142# define va_copy(dst, src) do {(dst) = (src);} while (0)
    42 #endif 
     43#endif
    4344
    4445
    4546/**
    4647 * Gets a variable that must exist.
    47  * Will cause a fatal failure if the variable doesn't exist. 
    48  * 
     48 * Will cause a fatal failure if the variable doesn't exist.
     49 *
    4950 * @returns Pointer to the variable.
    5051 * @param   pszName     The variable name.
     
    5556#ifndef NDEBUG
    5657    unsigned i;
    57 #endif 
     58#endif
    5859    struct variable *pVar = lookup_variable(pszName, strlen(pszName));
    5960    if (!pVar)
     
    6667    {
    6768        printf("%d != %d %s\n", pVar->value_length, i, pVar->name);
     69# ifdef _MSC_VER
    6870        __asm int 3;
     71# endif
     72        assert(0);
    6973    }
    7074#endif
     
    7478/**
    7579 * Gets a variable that must exist and can be recursive.
    76  * Will cause a fatal failure if the variable doesn't exist. 
    77  * 
     80 * Will cause a fatal failure if the variable doesn't exist.
     81 *
    7882 * @returns Pointer to the variable.
    7983 * @param   pszName     The variable name.
     
    8488#ifndef NDEBUG
    8589    unsigned i;
    86 #endif 
     90#endif
    8791    struct variable *pVar = lookup_variable(pszName, strlen(pszName));
    8892    if (!pVar)
     
    9397    {
    9498        printf("%d != %d %s\n", pVar->value_length, i, pVar->name);
     99# ifdef _MSC_VER
    95100        __asm int 3;
     101# endif
     102        assert(0);
    96103    }
    97104#endif
     
    103110 * Looks up a variable.
    104111 * The value_length field is valid upon successful return.
    105  * 
     112 *
    106113 * @returns Pointer to the variable. NULL if not found.
    107114 * @param   pszName     The variable name.
     
    118125        {
    119126            printf("%d != %d %s\n", pVar->value_length, i, pVar->name);
     127# ifdef _MSC_VER
    120128            __asm int 3;
     129# endif
     130            assert(0);
    121131        }
    122132#endif
     
    219229*/
    220230static struct variable *
    221 kbuild_get_source_tool(struct variable *pTarget, struct variable *pSource, struct variable *pType, 
     231kbuild_get_source_tool(struct variable *pTarget, struct variable *pSource, struct variable *pType,
    222232                       struct variable *pBldTrg, struct variable *pBldTrgArch, const char *pszVarName)
    223233{
     
    261271            *pszEnd = '\0';
    262272            if (!strchr(pszEnd, '$'))
    263                 pVar = define_variable_vl(pszVarName, strlen(pszVarName), psz, pszEnd - psz, 
     273                pVar = define_variable_vl(pszVarName, strlen(pszVarName), psz, pszEnd - psz,
    264274                                          1 /* duplicate */, o_file, 0 /* !recursive */);
    265275            else
     
    276286                {
    277287                    *pszExpEnd = '\0';
    278                     pVar = define_variable_vl(pszVarName, strlen(pszVarName), pszExp, 
     288                    pVar = define_variable_vl(pszVarName, strlen(pszVarName), pszExp,
    279289                                              pszExpEnd - pszExp, 1 /* duplicate */,
    280290                                              o_file, 0 /* !recursive */);
     
    302312                                                   kbuild_get_variable("type"),
    303313                                                   kbuild_get_variable("bld_trg"),
    304                                                    kbuild_get_variable("bld_trg_arch"), 
     314                                                   kbuild_get_variable("bld_trg_arch"),
    305315                                                   argv[0]);
    306316    if (pVar)
    307317         o = variable_buffer_output(o, pVar->value, pVar->value_length);
    308318    return o;
    309                                                    
     319
    310320}
    311321
     
    347357    {
    348358        pszSrc = pSource->value + pPathRoot->value_length;
    349         if (    *pszSrc == '/' 
     359        if (    *pszSrc == '/'
    350360            &&  !strncmp(pszSrc, pPathSubCur->value, pPathSubCur->value_length))
    351361            pszSrc += 1 + pPathSubCur->value_length;
    352362    }
    353     else 
     363    else
    354364        pszSrc = pSource->value;
    355365
     
    358368    if (isalpha(pszSrc[0]) && pszSrc[1] == ':')
    359369        pszSrc += 2;
    360 #endif 
     370#endif
    361371    while (*pszSrc == '/'
    362372#ifdef HAVE_DOS_PATHS
    363373           || *pszSrc == '\\'
    364 #endif 
     374#endif
    365375           )
    366376        pszSrc++;
     
    374384            ||  *pszSrcEnd == '/'
    375385#ifdef HAVE_DOS_PATHS
    376             ||  *pszSrcEnd == '\\' 
     386            ||  *pszSrcEnd == '\\'
    377387            ||  *pszSrcEnd == ':'
    378388#endif
     
    405415    *psz = '\0';
    406416
    407     /* 
     417    /*
    408418     * Define the variable in the current set and return it.
    409419     */
    410     return define_variable_vl(pszVarName, strlen(pszVarName), pszResult, cch - 1, 
     420    return define_variable_vl(pszVarName, strlen(pszVarName), pszResult, cch - 1,
    411421                              0 /* use pszResult */, o_file, 0 /* !recursive */);
    412422}
     
    417427{
    418428    struct variable *pVar = kbuild_get_object_base(kbuild_lookup_variable("target"),
    419                                                    kbuild_lookup_variable("source"), 
     429                                                   kbuild_lookup_variable("source"),
    420430                                                   argv[0]);
    421431    if (pVar)
    422432         o = variable_buffer_output(o, pVar->value, pVar->value_length);
    423433    return o;
    424                                                    
     434
    425435}
    426436
     
    444454static struct variable *
    445455kbuild_get_object_suffix(struct variable *pTarget, struct variable *pSource,
    446                          struct variable *pBldTrg, struct variable *pBldTrgArch, 
     456                         struct variable *pBldTrg, struct variable *pBldTrgArch,
    447457                         const char *pszVarName)
    448458{
     
    475485            *pszEnd = '\0';
    476486            if (!strchr(pszEnd, '$'))
    477                 pVar = define_variable_vl(pszVarName, strlen(pszVarName), psz, pszEnd - psz, 
     487                pVar = define_variable_vl(pszVarName, strlen(pszVarName), psz, pszEnd - psz,
    478488                                          1 /* duplicate */, o_file, 0 /* !recursive */);
    479489            else
     
    490500                {
    491501                    *pszExpEnd = '\0';
    492                     pVar = define_variable_vl(pszVarName, strlen(pszVarName), pszExp, 
    493                                               pszExpEnd - pszExp, 1 /* duplicate */, 
     502                    pVar = define_variable_vl(pszVarName, strlen(pszVarName), pszExp,
     503                                              pszExpEnd - pszExp, 1 /* duplicate */,
    494504                                              o_file, 0 /* !recursive */);
    495505                }
     
    515525                                                     kbuild_get_variable("source"),
    516526                                                     kbuild_get_variable("bld_trg"),
    517                                                      kbuild_get_variable("bld_trg_arch"), 
     527                                                     kbuild_get_variable("bld_trg_arch"),
    518528                                                     argv[0]);
    519529    if (pVar)
    520530         o = variable_buffer_output(o, pVar->value, pVar->value_length);
    521531    return o;
    522                                                    
     532
    523533}
    524534
     
    543553/* Fills in the SDK struct (remember to free it). */
    544554static void
    545 kbuild_get_sdks(struct kbuild_sdks *pSdks, struct variable *pTarget, struct variable *pSource, 
     555kbuild_get_sdks(struct kbuild_sdks *pSdks, struct variable *pTarget, struct variable *pSource,
    546556                struct variable *pBldType, struct variable *pBldTrg, struct variable *pBldTrgArch)
    547557{
     
    580590    pSdks->cTarget = 0;
    581591    sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)",
    582             pTarget->value, pBldType->value, 
    583             pTarget->value, pBldTrg->value, 
    584             pTarget->value, pBldTrg->value, 
     592            pTarget->value, pBldType->value,
     593            pTarget->value, pBldTrg->value,
     594            pTarget->value, pBldTrg->value,
    585595            pTarget->value, pBldTrgArch->value);
    586596    pszIterator = pSdks->apsz[1] = allocated_variable_expand(pszTmp);
     
    593603    pSdks->cSource = 0;
    594604    sprintf(pszTmp, "$(%s_SDKS) $(%s_SDKS.%s) $(%s_SDKS.%s) $(%s_SDKS.%s.%s)",
    595             pSource->value, pBldType->value, 
    596             pSource->value, pBldTrg->value, 
    597             pSource->value, pBldTrg->value, 
     605            pSource->value, pBldType->value,
     606            pSource->value, pBldTrg->value,
     607            pSource->value, pBldTrg->value,
    598608            pSource->value, pBldTrgArch->value);
    599609    pszIterator = pSdks->apsz[2] = allocated_variable_expand(pszTmp);
     
    606616    pSdks->cTargetSource = 0;
    607617    sprintf(pszTmp, "$(%s_%s_SDKS) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s) $(%s_%s_SDKS.%s.%s)",
    608             pTarget->value, pSource->value, pBldType->value, 
    609             pTarget->value, pSource->value, pBldTrg->value, 
    610             pTarget->value, pSource->value, pBldTrg->value, 
     618            pTarget->value, pSource->value, pBldType->value,
     619            pTarget->value, pSource->value, pBldTrg->value,
     620            pTarget->value, pSource->value, pBldTrg->value,
    611621            pTarget->value, pSource->value, pBldTrgArch->value);
    612622    pszIterator = pSdks->apsz[3] = allocated_variable_expand(pszTmp);
     
    619629        return;
    620630
    621     /* 
    622      * Allocate the variable array and create the variables. 
     631    /*
     632     * Allocate the variable array and create the variables.
    623633     */
    624634    pSdks->pa = (struct variable *)xmalloc(sizeof(pSdks->pa[0]) * i);
     
    770780*/
    771781static struct variable *
    772 kbuild_collect_source_prop(struct variable *pTarget, struct variable *pSource, 
     782kbuild_collect_source_prop(struct variable *pTarget, struct variable *pSource,
    773783                           struct variable *pTool, struct kbuild_sdks *pSdks,
    774784                           struct variable *pType, struct variable *pBldType,
     
    792802    Prop.value_length = strlen(pszProp);
    793803
    794     /* 
     804    /*
    795805     * Get the variables.
    796806     */
     
    943953    paVars[iVar++].pVar = kbuild_lookup_variable_fmt("%_%_%.%.%",  pTarget, pSource, &Prop, pBldTrg, pBldTrgArch);
    944954    paVars[iVar++].pVar = kbuild_lookup_variable_fmt("%_%_%.%",    pTarget, pSource, &Prop, pBldTrgCpu);
    945                                                                        
     955
    946956    paVars[iVar++].pVar = kbuild_lookup_variable_fmt("%_%_%%",     pTarget, pSource, pType, &Prop);
    947957    paVars[iVar++].pVar = kbuild_lookup_variable_fmt("%_%_%%.%",   pTarget, pSource, pType, &Prop, pBldType);
     
    960970    for (iVar = iDirection > 0 ? 0 : cVars - 1; iVar != iVarEnd; iVar += iDirection)
    961971    {
    962         paVars[iVar].cchExp = 0; 
     972        paVars[iVar].cchExp = 0;
    963973        if (!paVars[iVar].pVar)
    964974            continue;
     
    10341044    kbuild_put_sdks(&Sdks);
    10351045    return o;
    1036                                                    
     1046
    10371047}
    10381048
     
    10441054*/
    10451055static struct variable *
    1046 kbuild_set_object_name_and_dep_and_dirdep_and_PATH_target_source(struct variable *pTarget, struct variable *pSource, 
    1047                                                                  struct variable *pOutBase, struct variable *pObjSuff, 
     1056kbuild_set_object_name_and_dep_and_dirdep_and_PATH_target_source(struct variable *pTarget, struct variable *pSource,
     1057                                                                 struct variable *pOutBase, struct variable *pObjSuff,
    10481058                                                                 const char *pszVarName, struct variable **ppDep,
    10491059                                                                 struct variable **ppDirDep)
     
    10641074    *ppDep = define_variable_vl("dep", 3, pszResult, cch - 1, 1 /*dup*/, o_file, 0 /* !recursive */);
    10651075
    1066     /* 
    1067      * obj 
     1076    /*
     1077     * obj
    10681078     */
    10691079    *psz = '\0';
    1070     pObj = define_variable_vl(pszVarName, strlen(pszVarName), pszResult, psz - pszResult, 
     1080    pObj = define_variable_vl(pszVarName, strlen(pszVarName), pszResult, psz - pszResult,
    10711081                              1/* dup */, o_file, 0 /* !recursive */);
    10721082
    1073     /* 
    1074      * PATH_$(target)_$(source) - this is global! 
     1083    /*
     1084     * PATH_$(target)_$(source) - this is global!
    10751085     */
    10761086    /* calc variable name. */
     
    10991109#ifdef HAVE_DOS_PATHS
    11001110            ||  *psz == '\\'
    1101 #endif 
     1111#endif
    11021112           )
    11031113        {
     
    11061116#ifdef HAVE_DOS_PATHS
    11071117                   ||   psz[-1] == '\\'
    1108 #endif 
     1118#endif
    11091119                  )
    11101120                psz--;
     
    12641274    memcpy(psz, pVar->value, pVar->value_length); psz += pVar->value_length;
    12651275    *psz++ = ' ';
    1266     memcpy(psz, pOutput->value, pOutput->value_length + 1); 
     1276    memcpy(psz, pOutput->value, pOutput->value_length + 1);
    12671277    do_variable_definition(NILF, "_OUT_FILES", pszVal, o_file, f_simple, 0 /* !target_var */);
    12681278    free(pszVal);
    12691279
    1270     /* 
     1280    /*
    12711281    $(target)_OBJS_ += $(obj)
    12721282    */
  • trunk/src/gmake/main.c

    r532 r534  
    284284
    285285#ifdef KMK
    286 /* Process priority. 
    287     0 = no change; 
    288     1 = idle / max nice; 
    289     2 = below normal /  nice 10; 
    290     3 = normal / nice 0; 
     286/* Process priority.
     287    0 = no change;
     288    1 = idle / max nice;
     289    2 = below normal /  nice 10;
     290    3 = normal / nice 0;
    291291    4 = high / nice -10;
    292292    4 = realtime / nice -19; */
    293293int process_priority = 0;
    294 #endif 
     294#endif
    295295
    296296
     
    414414      "print-data-base" },
    415415#ifdef KMK
    416     { CHAR_MAX+5, positive_int, (char *) &process_priority, 1, 1, 0, 
     416    { CHAR_MAX+5, positive_int, (char *) &process_priority, 1, 1, 0,
    417417      (char *) &process_priority, (char *) &process_priority, "priority" },
    418418#endif
     
    515515#else  /* CONFIG_WITH_EXTENDED_NOTPARALLEL */
    516516
    517 /* Negative if we have seen the `.NOTPARALLEL' target with an 
    518    empty dependency list. 
    519 
    520    Zero if no `.NOTPARALLEL' or no file in the dependency list 
    521    is being executed. 
    522 
    523    Positive when a file in the `.NOTPARALLEL' dependency list 
     517/* Negative if we have seen the `.NOTPARALLEL' target with an
     518   empty dependency list.
     519
     520   Zero if no `.NOTPARALLEL' or no file in the dependency list
     521   is being executed.
     522
     523   Positive when a file in the `.NOTPARALLEL' dependency list
    524524   is in progress, the value is the number of notparallel files
    525525   in progress (running or queued for running).
     
    689689{
    690690#ifdef WINDOWS32
    691     DWORD dwPriority;
    692     switch (process_priority)
    693       {
    694         case 0:     return;
    695         case 1:     dwPriority = IDLE_PRIORITY_CLASS; break;
    696         case 2:     dwPriority = BELOW_NORMAL_PRIORITY_CLASS; break;
    697         case 3:     dwPriority = NORMAL_PRIORITY_CLASS; break;
    698         case 4:     dwPriority = HIGH_PRIORITY_CLASS; break;
    699         case 5:     dwPriority = REALTIME_PRIORITY_CLASS; break;
    700         default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
    701       }
    702     SetPriorityClass(GetCurrentProcess(), dwPriority);
     691  DWORD dwPriority;
     692  switch (process_priority)
     693    {
     694      case 0:     return;
     695      case 1:     dwPriority = IDLE_PRIORITY_CLASS; break;
     696      case 2:     dwPriority = BELOW_NORMAL_PRIORITY_CLASS; break;
     697      case 3:     dwPriority = NORMAL_PRIORITY_CLASS; break;
     698      case 4:     dwPriority = HIGH_PRIORITY_CLASS; break;
     699      case 5:     dwPriority = REALTIME_PRIORITY_CLASS; break;
     700      default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
     701    }
     702  SetPriorityClass(GetCurrentProcess(), dwPriority);
    703703#else /*#elif HAVE_NICE */
    704     int nice = 0;
    705     switch (process_priority)
    706       {
    707         case 0:     return;
    708         case 1:     nice = 19; break;
    709         case 2:     nice = 10; break;
    710         case 3:     nice = 0; break;
    711         case 4:     nice = -10; break;
    712         case 5:     nice = -19; break;
    713         default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
    714       }
    715     nice(nice);
    716 #endif 
     704  int nice_level = 0;
     705  switch (process_priority)
     706    {
     707      case 0:     return;
     708      case 1:     nice_level = 19; break;
     709      case 2:     nice_level = 10; break;
     710      case 3:     nice_level = 0; break;
     711      case 4:     nice_level = -10; break;
     712      case 5:     nice_level = -19; break;
     713      default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
     714    }
     715  nice (nice_level);
     716#endif
    717717}
    718 #endif 
     718#endif
    719719
    720720
     
    895895#ifdef KMK
    896896  /* WORKAROUND:
    897     With GNU Make 3.81, this kludge was necessary to get double quotes 
    898     working correctly again (worked fine with the 3.81beta1 code). 
    899     beta1 was forcing batch_mode_shell I think, so let's enforce that 
     897    With GNU Make 3.81, this kludge was necessary to get double quotes
     898    working correctly again (worked fine with the 3.81beta1 code).
     899    beta1 was forcing batch_mode_shell I think, so let's enforce that
    900900    for the kBuild shell. */
    901901  if (sh_found && strstr(default_shell, "kmk_ash")) {
     
    903903      batch_mode_shell = 1;
    904904  } else
    905 #endif 
     905#endif
    906906  /* naive test */
    907907  if (!unixy_shell && sh_found &&
     
    13311331#ifdef KMK
    13321332  set_make_priority ();
    1333 #endif 
     1333#endif
    13341334
    13351335  /* Set always_make_flag if -B was given and we've not restarted already.  */
  • trunk/src/gmake/variable.c

    r533 r534  
    109109typedef signed int int32_t;
    110110typedef signed short int int16_t;
    111 # endif 
     111# endif
    112112static inline unsigned long variable_hash_2i(register const unsigned char *var, register int length)
    113113{
     
    318318define_variable_in_set (const char *name, unsigned int length,
    319319                        char *value, unsigned int value_length, int duplicate_value,
    320                         enum variable_origin origin, int recursive, 
     320                        enum variable_origin origin, int recursive,
    321321                        struct variable_set *set, const struct floc *flocp)
    322322#else
    323323struct variable *
    324324define_variable_in_set (const char *name, unsigned int length,
    325                         char *value, enum variable_origin origin, 
    326                         int recursive, struct variable_set *set, 
     325                        char *value, enum variable_origin origin,
     326                        int recursive, struct variable_set *set,
    327327                        const struct floc *flocp)
    328 #endif 
     328#endif
    329329{
    330330  struct variable *v;
     
    386386            free (v->value);
    387387          v->value = xstrdup (value);
    388 #endif 
     388#endif
    389389          if (flocp != 0)
    390390            v->fileinfo = *flocp;
     
    426426#else
    427427  v->value = xstrdup (value);
    428 #endif 
     428#endif
    429429  if (flocp != 0)
    430430    v->fileinfo = *flocp;
     
    10861086      v->value_length = strlen (v->value);
    10871087      v->value_alloc_len = v->value_length + 1;
    1088 #endif 
     1088#endif
    10891089    }
    10901090#endif
     
    12741274#ifdef CONFIG_WITH_VALUE_LENGTH
    12751275static struct variable *
    1276 do_variable_definition_append (const struct floc *flocp, struct variable *v, char *value, 
    1277                                enum Variable_origin origin)
     1276do_variable_definition_append (const struct floc *flocp, struct variable *v, char *value,
     1277                               enum variable_origin origin)
    12781278{
    12791279  if (env_overrides && origin == o_env)
     
    12961296    v->fileinfo = *flocp;
    12971297
    1298   /* The juicy bits, append the specified value to the variable 
     1298  /* The juicy bits, append the specified value to the variable
    12991299     This is a heavily exercied code path in kBuild. */
    13001300  if (v->recursive)
     
    13221322      v->value_length = new_value_len;
    13231323    }
    1324   else 
     1324  else
    13251325    {
    13261326      /* The previous definition of the variable was simple.
     
    13511351# ifdef CONFIG_WITH_VALUE_LENGTH
    13521352  unsigned int value_len = ~0U;
    1353 # endif 
     1353# endif
    13541354
    13551355  /* Calculate the variable's new value in VALUE.  */
     
    15431543# ifdef CONFIG_WITH_VALUE_LENGTH
    15441544                                      ~0U, 1 /* duplicate_value */,
    1545 # endif 
     1545# endif
    15461546                                      origin, flavor == f_recursive,
    15471547                                      (target_var
     
    15561556      if (alloc_value)
    15571557        free (alloc_value);
    1558 # endif 
     1558# endif
    15591559    }
    15601560  else
     
    15811581  if (alloc_value)
    15821582    free (alloc_value);
    1583 #endif 
     1583#endif
    15841584
    15851585  return v;
     
    16811681#ifdef CONFIG_WITH_VALUE_LENGTH
    16821682  v->value_length = v->value_alloc_len = -1;
    1683 #endif 
     1683#endif
    16841684
    16851685  /* Expand the name, so "$(foo)bar = baz" works.  */
Note: See TracChangeset for help on using the changeset viewer.

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