- Timestamp:
- May 25, 2007 3:27:53 AM (18 years ago)
- Location:
- trunk/src/gmakenew
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmakenew/Makefile.kmk
r914 r921 94 94 EXPERIMENTAL \ 95 95 CONFIG_WITH_TOUPPER_TOLOWER \ 96 CONFIG_WITH_EXPLICIT_MULTITARGET \ 96 97 \ 97 98 KMK \ -
trunk/src/gmakenew/file.c
r910 r921 778 778 for (d = file->also_make; d != 0; d = d->next) 779 779 d->file->command_state = state; 780 781 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 782 if (file->multi_head) 783 { 784 assert (file == file->multi_head); 785 for (file = file->multi_head; file != 0; file = file->multi_next) 786 file->command_state = state; 787 } 788 #endif 780 789 } 781 790 … … 898 907 if (!f->is_target) 899 908 puts (_("# Not a target:")); 900 printf ("%s:%s", f->name, f->double_colon ? ":" : ""); 909 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 910 if (f->multi_head) 911 { 912 const struct file *f2; 913 if (f->multi_head == f) 914 { 915 int multi_maybe = -1; 916 assert (!f->multi_maybe); 917 assert (!f->double_colon); 918 919 printf ("%s", f->name); 920 for (f2 = f->multi_next; f2 != 0; f2 = f2->multi_next) 921 { 922 printf (" %s%s", f2->multi_maybe != multi_maybe 923 ? f2->multi_maybe ? "+| " : "+ " : "", 924 f2->name); 925 multi_maybe = f2->multi_maybe; 926 } 927 putchar (':'); 928 } 929 else 930 printf ("%s:%s", f->name, f->double_colon ? ":" : ""); 931 } 932 else 933 #endif 934 printf ("%s:%s", f->name, f->double_colon ? ":" : ""); 901 935 902 936 /* Print all normal dependencies; note any order-only deps. */ … … 917 951 918 952 putchar ('\n'); 953 954 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 955 if (f->multi_head && f->multi_head != f) 956 { 957 const struct file *f2; 958 fputs (_("# In multi target list:"), stdout); 959 for (f2 = f->multi_head; f2 != 0; f2 = f2->multi_next) 960 printf (" %s%s", f2->name, f == f2 ? "(*)" : ""); 961 putchar ('\n'); 962 if (f->multi_maybe) 963 puts (_("# File is an optional multi target member.")); 964 } 965 #endif 919 966 920 967 if (f->precious) -
trunk/src/gmakenew/filedef.h
r903 r921 61 61 the same file. Otherwise this is null. */ 62 62 struct file *double_colon; 63 64 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 65 /* For a target of an explicit multi target rule, this points to the 66 primary target. Otherwise this is null. */ 67 struct file *multi_head; 68 /* Pointer to next target of an explicit multi target rule. */ 69 struct file *multi_next; 70 #endif 63 71 64 72 short int update_status; /* Status of the last attempt to update, … … 95 103 unsigned int considered:1; /* equal to 'considered' if file has been 96 104 considered on current scan of goal chain */ 105 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 106 unsigned int multi_maybe:1; /* Nonzero if this file may not always be 107 touched/created by the multi target rule. */ 108 #endif 109 97 110 }; 98 111 -
trunk/src/gmakenew/read.c
r919 r921 1981 1981 const char **targets = 0, **target_percents = 0; 1982 1982 struct commands *cmds; 1983 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 1984 struct file *prev_file = 0; 1985 enum multitarget_mode { m_unsettled, m_no, m_yes, m_yes_maybe } 1986 multi_mode = !two_colon && !pattern ? m_unsettled : m_no; 1987 #endif 1983 1988 1984 1989 /* If we've already snapped deps, that means we're in an eval being … … 2049 2054 } 2050 2055 2056 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 2057 /* Check for the explicit multitarget mode operators. For this to be 2058 identified as an excplicit multiple target rule, the first + or +| 2059 operator *must* appear between the first two files. If not found as 2060 the 2nd file or if found as the 1st file, the rule will be rejected 2061 as a potential multiple first target rule. For the subsequent files 2062 the operator is only required to switch between maybe and non-maybe 2063 mode: 2064 `primary + 2nd 3rd +| 4th-maybe + 5th-for-sure: deps; cmds' */ 2065 if (multi_mode != m_no && name[0] == '+' 2066 && (name[1] == '\0' || (name[1] == '|' && name[2] == '\0'))) 2067 { 2068 if (!prev_file) 2069 multi_mode = m_no; /* first */ 2070 else 2071 { 2072 if (multi_mode == m_unsettled) 2073 prev_file->multi_head = prev_file; 2074 multi_mode = name[1] == '\0' ? m_yes : m_yes_maybe; 2075 continue; 2076 } 2077 } 2078 else if (multi_mode == m_unsettled && prev_file) 2079 multi_mode = m_no; 2080 #endif 2081 2051 2082 /* If this is a static pattern rule: 2052 2083 `targets: target%pattern: dep%pattern; cmds', … … 2163 2194 f->updating = 1; 2164 2195 } 2196 2197 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 2198 /* If this is an explicit multi target rule, add it to the 2199 target chain and set the multi_maybe flag according to 2200 the current mode. */ 2201 2202 if (multi_mode >= m_yes) 2203 { 2204 f->multi_maybe = multi_mode == m_yes_maybe; 2205 prev_file->multi_next = f; 2206 assert (prev_file->multi_head != 0); 2207 f->multi_head = prev_file->multi_head; 2208 } 2209 prev_file = f; 2210 #endif 2165 2211 } 2166 2212 else -
trunk/src/gmakenew/remake.c
r919 r921 750 750 } 751 751 752 DBF (DB_BASIC, _("Must remake target `%s'.\n")); 752 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 753 if (ISDB(DB_BASIC) && file->multi_head && file->multi_head != file) 754 DBS (DB_BASIC, (_("Must remake target `%s' - primary target `%s'.\n"), file->name, file->multi_head->name)); 755 else 756 #endif 757 DBF (DB_BASIC, _("Must remake target `%s'.\n")); 753 758 754 759 /* It needs to be remade. If it's VPATH and not reset via GPATH, toss the … … 917 922 918 923 if (ran && file->update_status != -1) 919 /* We actually tried to update FILE, which has 920 updated its also_make's as well (if it worked). 921 If it didn't work, it wouldn't work again for them. 922 So mark them as updated with the same status. */ 923 for (d = file->also_make; d != 0; d = d->next) 924 { 925 d->file->command_state = cs_finished; 926 d->file->updated = 1; 927 d->file->update_status = file->update_status; 928 929 if (ran && !d->file->phony) 930 /* Fetch the new modification time. 931 We do this instead of just invalidating the cached time 932 so that a vpath_search can happen. Otherwise, it would 933 never be done because the target is already updated. */ 934 f_mtime (d->file, 0); 935 } 924 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 925 { 926 #endif 927 /* We actually tried to update FILE, which has 928 updated its also_make's as well (if it worked). 929 If it didn't work, it wouldn't work again for them. 930 So mark them as updated with the same status. */ 931 for (d = file->also_make; d != 0; d = d->next) 932 { 933 d->file->command_state = cs_finished; 934 d->file->updated = 1; 935 d->file->update_status = file->update_status; 936 937 if (ran && !d->file->phony) 938 /* Fetch the new modification time. 939 We do this instead of just invalidating the cached time 940 so that a vpath_search can happen. Otherwise, it would 941 never be done because the target is already updated. */ 942 f_mtime (d->file, 0); 943 } 944 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 945 /* Same as above but for explicit multi target rules. */ 946 if (file->multi_head) 947 { 948 struct file *f2; 949 assert (file == file->multi_head); 950 for (f2 = file->multi_next; f2 != 0; f2 = f2->multi_next) 951 { 952 f2->command_state = cs_finished; 953 f2->updated = 1; 954 f2->update_status = file->update_status; 955 956 if (!f2->phony) 957 f_mtime (f2, 0); 958 } 959 } 960 } 961 #endif 936 962 else if (file->update_status == -1) 937 963 /* Nothing was done for FILE, but it needed nothing done. … … 1116 1142 remake_file (struct file *file) 1117 1143 { 1144 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 1145 /* Always operate on the primary file. */ 1146 if (file->multi_head && file->multi_head != file) 1147 file = file->multi_head; 1148 #endif 1149 1118 1150 if (file->cmds == 0) 1119 1151 {
Note:
See TracChangeset
for help on using the changeset viewer.