Changeset 1128 for trunk/src/kmk
- Timestamp:
- Sep 27, 2007, 12:32:26 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kbuild.c
r1071 r1128 417 417 } 418 418 419 419 420 /** 420 421 * Gets a variable that must exist and can be recursive. … … 447 448 } 448 449 450 451 /** 452 * Gets a variable that doesn't have to exit, but if it does can be recursive. 453 * 454 * @returns Pointer to the variable. 455 * NULL if not found. 456 * @param pszName The variable name. 457 */ 458 static struct variable * 459 kbuild_query_recursive_variable(const char *pszName) 460 { 461 #ifndef NDEBUG 462 unsigned i; 463 #endif 464 struct variable *pVar = lookup_variable(pszName, strlen(pszName)); 465 if (pVar) 466 { 467 #ifndef NDEBUG 468 i = strlen(pVar->value); 469 if (i != pVar->value_length) 470 { 471 printf("%d != %d %s\n", pVar->value_length, i, pVar->name); 472 # ifdef _MSC_VER 473 __debugbreak(); 474 # endif 475 assert(0); 476 } 477 #endif 478 } 479 return pVar; 480 } 481 482 449 483 /** 450 484 * Converts the specified variable into a 'simple' one. … … 466 500 return pVar; 467 501 } 502 468 503 469 504 /** … … 498 533 } 499 534 535 500 536 /** 501 537 * Looks up a variable and applies default a path to all relative paths. … … 515 551 } 516 552 553 517 554 /** Same as kbuild_lookup_variable except that a '%s' in the name string 518 * will be substituted with the values of the variables in the va list. 555 * will be substituted with the values of the variables in the va list. */ 519 556 static struct variable * 520 557 kbuild_lookup_variable_fmt_va(struct variable *pDefPath, const char *pszNameFmt, va_list va) … … 569 606 } 570 607 608 571 609 /** Same as kbuild_lookup_variable except that a '%s' in the name string 572 610 * will be substituted with the values of the variables in the ellipsis. */ … … 581 619 return pVar; 582 620 } 621 583 622 584 623 /** … … 654 693 return NULL; 655 694 } 695 656 696 657 697 /* … … 693 733 } 694 734 735 695 736 /* Implements _SOURCE_TOOL. */ 696 737 char * … … 708 749 709 750 } 751 710 752 711 753 /* This has been extended a bit, it's now identical to _SOURCE_TOOL. … … 737 779 } 738 780 781 739 782 /* */ 740 783 char * … … 872 915 } 873 916 917 874 918 /* Implements _OBJECT_BASE. */ 875 919 char * … … 900 944 unsigned cTargetSource; 901 945 }; 946 902 947 903 948 /* Fills in the SDK struct (remember to free it). */ … … 1010 1055 } 1011 1056 1057 1012 1058 /* releases resources allocated in the kbuild_get_sdks. */ 1013 1059 static void … … 1019 1065 free(pSdks->pa); 1020 1066 } 1067 1021 1068 1022 1069 /* this kind of stuff: … … 1395 1442 } 1396 1443 1444 1397 1445 /* get a source property. Doesn't respect the default path. */ 1398 1446 char * … … 1434 1482 } 1435 1483 1484 1436 1485 /* 1437 1486 dep := $(obj)$(SUFF_DEP) … … 1621 1670 $(target)_$(source)_CMDS_ := $(TOOL_$(tool)_COMPILE_$(type)_CMDS) 1622 1671 $(target)_$(source)_OUTPUT_ := $(TOOL_$(tool)_COMPILE_$(type)_OUTPUT) 1672 $(target)_$(source)_OUTPUT_MAYBE_ := $(TOOL_$(tool)_COMPILE_$(type)_OUTPUT_MAYBE) 1623 1673 $(target)_$(source)_DEPEND_ := $(TOOL_$(tool)_COMPILE_$(type)_DEPEND) $(deps) $(source) 1624 1674 $(target)_$(source)_DEPORD_ := $(TOOL_$(tool)_COMPILE_$(type)_DEPORD) $(dirdep) 1625 1675 */ 1626 cch = sizeof("TOOL_") + pTool->value_length + sizeof("_COMPILE_") + pType->value_length + sizeof("_OUTPUT ");1676 cch = sizeof("TOOL_") + pTool->value_length + sizeof("_COMPILE_") + pType->value_length + sizeof("_OUTPUT_MAYBE"); 1627 1677 psz = pszSrcVar = alloca(cch); 1628 1678 memcpy(psz, "TOOL_", sizeof("TOOL_") - 1); psz += sizeof("TOOL_") - 1; … … 1632 1682 pszSrc = psz; 1633 1683 1634 cch = pTarget->value_length + 1 + pSource->value_length + sizeof("_OUTPUT_ ");1684 cch = pTarget->value_length + 1 + pSource->value_length + sizeof("_OUTPUT_MAYBE_"); 1635 1685 psz = pszDstVar = alloca(cch); 1636 1686 memcpy(psz, pTarget->value, pTarget->value_length); psz += pTarget->value_length; … … 1648 1698 pVar = kbuild_get_recursive_variable(pszSrcVar); 1649 1699 pOutput = do_variable_definition(NILF, pszDstVar, pVar->value, o_file, f_simple, 0 /* !target_var */); 1700 1701 memcpy(pszSrc, "_OUTPUT_MAYBE", sizeof("_OUTPUT_MAYBE")); 1702 memcpy(pszDst, "_OUTPUT_MAYBE_", sizeof("_OUTPUT_MAYBE_")); 1703 pVar = kbuild_query_recursive_variable(pszSrcVar); 1704 pOutput = do_variable_definition(NILF, pszDstVar, pVar ? pVar->value : "", o_file, f_simple, 0 /* !target_var */); 1650 1705 1651 1706 memcpy(pszSrc, "_DEPEND", sizeof("_DEPEND"));
Note:
See TracChangeset
for help on using the changeset viewer.