Changeset 1701 for trunk/src/kmk
- Timestamp:
- Sep 2, 2008, 4:06:18 AM (17 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/Makefile.am
r1598 r1701 102 102 -DCONFIG_WITH_PREPEND_ASSIGNMENT \ 103 103 -DCONFIG_WITH_LOCAL_VARIABLES \ 104 -DCONFIG_WITH_2ND_TARGET_EXPANSION \ 104 105 \ 105 106 -DKMK \ -
trunk/src/kmk/Makefile.kmk
r1694 r1701 137 137 CONFIG_WITH_PREPEND_ASSIGNMENT \ 138 138 CONFIG_WITH_LOCAL_VARIABLES \ 139 CONFIG_WITH_2ND_TARGET_EXPANSION \ 139 140 \ 140 141 KMK \ … … 476 477 $(MAKE) -f $(kmk_PATH)/testcase-includedep.kmk 477 478 479 test_2ndtargetexp: 480 $(MAKE) -f $(kmk_PATH)/testcase-2ndtargetexp.kmk 481 478 482 test_30_continued_on_failure_worker: 479 483 this_executable_does_not_exist.exe … … 491 495 492 496 493 test_all: test_math test_stack test_shell test_if1of test_local test_includedep test_ 30_continued_on_failure494 497 test_all: test_math test_stack test_shell test_if1of test_local test_includedep test_2ndtargetexp test_30_continued_on_failure 498 -
trunk/src/kmk/file.c
r934 r1701 189 189 f->last = new; 190 190 } 191 192 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 193 /* Check if the name needs 2nd expansion or not. */ 194 if (second_target_expansion && strchr (name, '$') != NULL) 195 new->need_2nd_target_expansion = 1; 196 #endif 191 197 192 198 return new; … … 333 339 } 334 340 } 341 342 343 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 344 /* Performs secondary target name expansion and then renames 345 the file using rename_file. */ 346 static void 347 do_2nd_target_expansion (struct file *f) 348 { 349 char *tmp_name = allocated_variable_expand (f->name); 350 const char *name = strcache_add (tmp_name); 351 free (tmp_name); 352 rename_file (f, name); 353 } 354 #endif /* CONFIG_WITH_2ND_TARGET_EXPANSION */ 335 355 336 356 … … 654 674 expand_deps (f); 655 675 676 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 677 /* Perform 2nd target expansion on files which requires this. This will 678 be re-inserting (delete+insert) hash table entries so we have to use 679 hash_dump(). */ 680 file_slot_0 = (struct file **) hash_dump (&files, 0, 0); 681 file_end = file_slot_0 + files.ht_fill; 682 for (file_slot = file_slot_0; file_slot < file_end; file_slot++) 683 for (f = *file_slot; f != 0; f = f->prev) 684 if (f->need_2nd_target_expansion) 685 do_2nd_target_expansion (f); 686 free (file_slot_0); 687 688 /* Disable second target expansion now since we won't expand files 689 entered after this point. (saves CPU cycles in enter_file()). */ 690 second_target_expansion = 0; 691 #endif /* CONFIG_WITH_2ND_TARGET_EXPANSION */ 692 656 693 /* For every target that's not .SUFFIXES, expand its dependencies. 657 694 We must use hash_dump (), because within this loop we might add new files -
trunk/src/kmk/filedef.h
r922 r1701 107 107 by the explicit multi target rule. */ 108 108 #endif 109 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 110 unsigned int need_2nd_target_expansion:1; /* Nonzero if this file needs 111 second expansion of its name. Whether it 112 can receive this is decided at parse time, 113 and the expanding done in snap_deps. */ 114 #endif 109 115 110 116 }; -
trunk/src/kmk/main.c
r1535 r1701 562 562 int second_expansion; 563 563 564 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 565 /* Nonzero if we have seen the '.SECONDTARGETEXPANSION' target. 566 This turns on secondary expansion of targets. */ 567 568 int second_target_expansion; 569 #endif 570 564 571 #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL 565 572 /* Nonzero if we have seen the `.NOTPARALLEL' target. -
trunk/src/kmk/make.h
r1535 r1701 500 500 extern int warn_undefined_variables_flag, posix_pedantic, not_parallel; 501 501 extern int second_expansion, clock_skew_detected, rebuilding_makefiles; 502 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 503 extern int second_target_expansion; 504 #endif 502 505 #ifdef CONFIG_PRETTY_COMMAND_PRINTING 503 506 extern int pretty_command_printing; -
trunk/src/kmk/read.c
r1693 r1701 2530 2530 else if (streq (name, ".SECONDEXPANSION")) 2531 2531 second_expansion = 1; 2532 #ifdef CONFIG_WITH_2ND_TARGET_EXPANSION 2533 else if (streq (name, ".SECONDTARGETEXPANSION")) 2534 second_target_expansion = 1; 2535 #endif 2532 2536 2533 2537 implicit_percent = find_percent_cached (&name);
Note:
See TracChangeset
for help on using the changeset viewer.