325 Doname
326 doname(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic)
327 {
328 Doname result = build_dont_know;
329 Chain out_of_date_list = NULL;
330 #ifdef TEAMWARE_MAKE_CMN
331 Chain target_group;
332 #endif
333 Property old_locals = NULL;
334 register Property line;
335 Property command = NULL;
336 register Dependency dependency;
337 Name less = NULL;
338 Name true_target = target;
339 Name *automatics = NULL;
340 register int auto_count;
341 Boolean rechecking_target = false;
342 Boolean saved_commands_done;
343 Boolean restart = false;
344 Boolean save_parallel = parallel;
345 #ifdef NSE
346 Boolean save_readdep;
347 #endif
348 Boolean doing_subtree = false;
349
350 Boolean recheck_conditionals = false;
351
352 if (target->state == build_running) {
353 return build_running;
354 }
355 line = get_prop(target->prop, line_prop);
356 #ifdef TEAMWARE_MAKE_CMN
357 if (line != NULL) {
358 /*
359 * If this target is a member of target group and one of the
360 * other members of the group is running, mark this target
361 * as running.
362 */
363 for (target_group = line->body.line.target_group;
364 target_group != NULL;
365 target_group = target_group->next) {
366 if (is_running(target_group->name)) {
367 target->state = build_running;
368 add_pending(target,
369 recursion_level,
370 do_get,
371 implicit,
372 false);
373 return build_running;
374 }
375 }
376 }
377 #ifdef NSE
378 nse_check_file_backquotes(target->string);
379 #endif
380 #endif
381 /*
382 * If the target is a constructed one for a "::" target,
383 * we need to consider that.
384 */
385 if (target->has_target_prop) {
386 true_target = get_prop(target->prop,
387 target_prop)->body.target.target;
388 if (true_target->colon_splits > 0) {
389 /* Make sure we have a valid time for :: targets */
390 Property time;
391
392 time = get_prop(true_target->prop, time_prop);
393 if (time != NULL) {
394 true_target->stat.time = time->body.time.time;
395 }
396 }
397 }
398 (void) exists(true_target);
399 /*
507
508 /* Activate conditional macros for the target */
509 if (!target->added_pattern_conditionals) {
510 add_pattern_conditionals(target);
511 target->added_pattern_conditionals = true;
512 }
513 if (target->conditional_cnt > 0) {
514 old_locals = (Property) alloca(target->conditional_cnt *
515 sizeof (Property_rec));
516 set_locals(target, old_locals);
517 }
518
519 /*
520 * after making the call to dynamic_dependecies unconditional we can handle
521 * target names that are same as file name. In this case $$@ in the
522 * dependencies did not mean anything. WIth this change it expands it
523 * as expected.
524 */
525 if (!target->has_depe_list_expanded)
526 {
527 #ifdef NSE
528 save_readdep = reading_dependencies;
529 reading_dependencies= true;
530 #endif
531 dynamic_dependencies(target);
532 #ifdef NSE
533 reading_dependencies= save_readdep;
534 #endif
535 }
536
537 /*
538 * FIRST SECTION -- GO THROUGH DEPENDENCIES AND COLLECT EXPLICIT
539 * COMMANDS TO RUN
540 */
541 if ((line = get_prop(target->prop, line_prop)) != NULL) {
542 if (check_dependencies(&result,
543 line,
544 do_get,
545 target,
546 true_target,
547 doing_subtree,
548 &out_of_date_list,
549 old_locals,
550 implicit,
551 &command,
552 less,
553 rechecking_target,
554 recheck_conditionals)) {
782 if (posix)
783 {
784 if (!silent)
785 {
786 silent = (Boolean) target->silent_mode;
787 }
788 if (!ignore_errors)
789 {
790 ignore_errors = (Boolean) target->ignore_error_mode;
791 }
792 }
793
794 int doname_dyntarget = 0;
795 r_command:
796 /* Run commands if any. */
797 if ((command != NULL) &&
798 (command->body.line.command_template != NULL)) {
799 if (result != build_failed) {
800 result = run_command(command,
801 (Boolean) ((parallel || save_parallel) && !silent));
802 #ifdef NSE
803 nse_check_no_deps_no_rule(target,
804 get_prop(target->prop, line_prop), command);
805 #endif
806 }
807 switch (result) {
808 #ifdef TEAMWARE_MAKE_CMN
809 case build_running:
810 add_running(target,
811 true_target,
812 command,
813 --recursion_level,
814 auto_count,
815 automatics,
816 do_get,
817 implicit);
818 target->state = build_running;
819 if ((line = get_prop(target->prop,
820 line_prop)) != NULL) {
821 if (line->body.line.query != NULL) {
822 delete_query_chain(line->body.line.query);
823 }
824 line->body.line.query = NULL;
825 }
1053 } else if ((!parallel_ok(dependency->name, false)) &&
1054 (dependencies_running)) {
1055 /*
1056 * If we can't execute the current dependency in
1057 * parallel, hold off the dependency processing
1058 * to preserve the order of the dependencies.
1059 */
1060 break;
1061 #endif
1062 } else {
1063 timestruc_t depe_time = file_doesnt_exist;
1064
1065
1066 if (true_target->is_member) {
1067 depe_time = exists(dependency->name);
1068 }
1069 if (dependency->built ||
1070 (dependency->name->state == build_failed)) {
1071 dep_result = (Doname) dependency->name->state;
1072 } else {
1073 #ifdef NSE
1074 nse_check_sccs(target->string,
1075 dependency->name->string);
1076 nse_check_derived_src(target,
1077 dependency->name->string,
1078 line->body.line.command_template);
1079 #endif
1080 dep_result = doname_check(dependency->name,
1081 do_get,
1082 false,
1083 (Boolean) dependency->automatic);
1084 }
1085 if (true_target->is_member || dependency->name->is_member) {
1086 /* should compare only secs, cause lib members does not have nsec time resolution */
1087 if (depe_time.tv_sec != dependency->name->stat.time.tv_sec) {
1088 this_dependency_changed =
1089 dependency_changed =
1090 true;
1091 }
1092 } else {
1093 if (depe_time != dependency->name->stat.time) {
1094 this_dependency_changed =
1095 dependency_changed =
1096 true;
1097 }
1098 }
1099 dependency->built = true;
1568 prop->body.member.member = member;
1569 if (first_member == dependency) {
1570 break;
1571 }
1572 }
1573 }
1574 }
1575 Wstring wcb;
1576 /* Then scan all the dependencies again. This time we want to expand */
1577 /* shell file wildcards */
1578 for (remove = &line->body.line.dependencies, dependency = *remove;
1579 dependency != NULL;
1580 dependency = *remove) {
1581 if (dependency->name == NULL) {
1582 dependency = *remove = (*remove)->next;
1583 continue;
1584 }
1585 /* If dependency name string contains shell wildcards */
1586 /* replace the name with the expansion */
1587 if (dependency->name->wildcard) {
1588 #ifdef NSE
1589 nse_wildcard(target->string, dependency->name->string);
1590 #endif
1591 wcb.init(dependency->name);
1592 if ((start = (wchar_t *) wschr(wcb.get_string(),
1593 (int) parenleft_char)) != NULL) {
1594 /* lib(*) type pattern */
1595 library = buffer;
1596 (void) wsncpy(buffer,
1597 wcb.get_string(),
1598 start - wcb.get_string());
1599 buffer[start-wcb.get_string()] =
1600 (int) nul_char;
1601 (void) wsncpy(pattern,
1602 start + 1,
1603 (int) (dependency->name->hash.length-(start-wcb.get_string())-2));
1604 pattern[dependency->name->hash.length -
1605 (start-wcb.get_string()) - 2] =
1606 (int) nul_char;
1607 } else {
1608 library = NULL;
1609 (void) wsncpy(pattern,
1610 wcb.get_string(),
1968 if (rule->assign) {
1969 result = build_ok;
1970 do_assign(rule->command_line, target);
1971 } else if (report_dependencies_level == 0) {
1972 /* Execute command line. */
1973 #ifdef DISTRIBUTED
1974 setvar_envvar((Avo_DoJobMsg *)NULL);
1975 #else
1976 setvar_envvar();
1977 #endif
1978 result = dosys(rule->command_line,
1979 (Boolean) rule->ignore_error,
1980 (Boolean) rule->make_refd,
1981 /* ds 98.04.23 bug #4085164. make should always show error messages */
1982 false,
1983 /* BOOLEAN(rule->silent &&
1984 rule->ignore_error), */
1985 (Boolean) rule->always_exec,
1986 target,
1987 send_mtool_msgs);
1988 #ifdef NSE
1989 nse_did_recursion= false;
1990 #endif
1991 check_state(temp_file_name);
1992 #ifdef NSE
1993 nse_check_cd(line);
1994 #endif
1995 }
1996 SEND_MTOOL_MSG(
1997 append_job_result_msg(job_result_msg);
1998 if (child_pid > 0) {
1999 kill(child_pid, SIGUSR1);
2000 while (!((waitpid(child_pid, 0, 0) == -1)
2001 && (errno == ECHILD)));
2002 }
2003 child_pid = 0;
2004 (void) unlink(stdout_file);
2005 retmem_mb(stdout_file);
2006 stdout_file = NULL;
2007 );
2008 } else {
2009 result = build_ok;
2010 }
2011 if (result == build_failed) {
2012 if (silent || rule->silent) {
2013 (void) printf(catgets(catd, 1, 242, "The following command caused the error:\n%s\n"),
2014 rule->command_line->string_mb);
|
325 Doname
326 doname(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic)
327 {
328 Doname result = build_dont_know;
329 Chain out_of_date_list = NULL;
330 #ifdef TEAMWARE_MAKE_CMN
331 Chain target_group;
332 #endif
333 Property old_locals = NULL;
334 register Property line;
335 Property command = NULL;
336 register Dependency dependency;
337 Name less = NULL;
338 Name true_target = target;
339 Name *automatics = NULL;
340 register int auto_count;
341 Boolean rechecking_target = false;
342 Boolean saved_commands_done;
343 Boolean restart = false;
344 Boolean save_parallel = parallel;
345 Boolean doing_subtree = false;
346
347 Boolean recheck_conditionals = false;
348
349 if (target->state == build_running) {
350 return build_running;
351 }
352 line = get_prop(target->prop, line_prop);
353 #ifdef TEAMWARE_MAKE_CMN
354 if (line != NULL) {
355 /*
356 * If this target is a member of target group and one of the
357 * other members of the group is running, mark this target
358 * as running.
359 */
360 for (target_group = line->body.line.target_group;
361 target_group != NULL;
362 target_group = target_group->next) {
363 if (is_running(target_group->name)) {
364 target->state = build_running;
365 add_pending(target,
366 recursion_level,
367 do_get,
368 implicit,
369 false);
370 return build_running;
371 }
372 }
373 }
374 #endif
375 /*
376 * If the target is a constructed one for a "::" target,
377 * we need to consider that.
378 */
379 if (target->has_target_prop) {
380 true_target = get_prop(target->prop,
381 target_prop)->body.target.target;
382 if (true_target->colon_splits > 0) {
383 /* Make sure we have a valid time for :: targets */
384 Property time;
385
386 time = get_prop(true_target->prop, time_prop);
387 if (time != NULL) {
388 true_target->stat.time = time->body.time.time;
389 }
390 }
391 }
392 (void) exists(true_target);
393 /*
501
502 /* Activate conditional macros for the target */
503 if (!target->added_pattern_conditionals) {
504 add_pattern_conditionals(target);
505 target->added_pattern_conditionals = true;
506 }
507 if (target->conditional_cnt > 0) {
508 old_locals = (Property) alloca(target->conditional_cnt *
509 sizeof (Property_rec));
510 set_locals(target, old_locals);
511 }
512
513 /*
514 * after making the call to dynamic_dependecies unconditional we can handle
515 * target names that are same as file name. In this case $$@ in the
516 * dependencies did not mean anything. WIth this change it expands it
517 * as expected.
518 */
519 if (!target->has_depe_list_expanded)
520 {
521 dynamic_dependencies(target);
522 }
523
524 /*
525 * FIRST SECTION -- GO THROUGH DEPENDENCIES AND COLLECT EXPLICIT
526 * COMMANDS TO RUN
527 */
528 if ((line = get_prop(target->prop, line_prop)) != NULL) {
529 if (check_dependencies(&result,
530 line,
531 do_get,
532 target,
533 true_target,
534 doing_subtree,
535 &out_of_date_list,
536 old_locals,
537 implicit,
538 &command,
539 less,
540 rechecking_target,
541 recheck_conditionals)) {
769 if (posix)
770 {
771 if (!silent)
772 {
773 silent = (Boolean) target->silent_mode;
774 }
775 if (!ignore_errors)
776 {
777 ignore_errors = (Boolean) target->ignore_error_mode;
778 }
779 }
780
781 int doname_dyntarget = 0;
782 r_command:
783 /* Run commands if any. */
784 if ((command != NULL) &&
785 (command->body.line.command_template != NULL)) {
786 if (result != build_failed) {
787 result = run_command(command,
788 (Boolean) ((parallel || save_parallel) && !silent));
789 }
790 switch (result) {
791 #ifdef TEAMWARE_MAKE_CMN
792 case build_running:
793 add_running(target,
794 true_target,
795 command,
796 --recursion_level,
797 auto_count,
798 automatics,
799 do_get,
800 implicit);
801 target->state = build_running;
802 if ((line = get_prop(target->prop,
803 line_prop)) != NULL) {
804 if (line->body.line.query != NULL) {
805 delete_query_chain(line->body.line.query);
806 }
807 line->body.line.query = NULL;
808 }
1036 } else if ((!parallel_ok(dependency->name, false)) &&
1037 (dependencies_running)) {
1038 /*
1039 * If we can't execute the current dependency in
1040 * parallel, hold off the dependency processing
1041 * to preserve the order of the dependencies.
1042 */
1043 break;
1044 #endif
1045 } else {
1046 timestruc_t depe_time = file_doesnt_exist;
1047
1048
1049 if (true_target->is_member) {
1050 depe_time = exists(dependency->name);
1051 }
1052 if (dependency->built ||
1053 (dependency->name->state == build_failed)) {
1054 dep_result = (Doname) dependency->name->state;
1055 } else {
1056 dep_result = doname_check(dependency->name,
1057 do_get,
1058 false,
1059 (Boolean) dependency->automatic);
1060 }
1061 if (true_target->is_member || dependency->name->is_member) {
1062 /* should compare only secs, cause lib members does not have nsec time resolution */
1063 if (depe_time.tv_sec != dependency->name->stat.time.tv_sec) {
1064 this_dependency_changed =
1065 dependency_changed =
1066 true;
1067 }
1068 } else {
1069 if (depe_time != dependency->name->stat.time) {
1070 this_dependency_changed =
1071 dependency_changed =
1072 true;
1073 }
1074 }
1075 dependency->built = true;
1544 prop->body.member.member = member;
1545 if (first_member == dependency) {
1546 break;
1547 }
1548 }
1549 }
1550 }
1551 Wstring wcb;
1552 /* Then scan all the dependencies again. This time we want to expand */
1553 /* shell file wildcards */
1554 for (remove = &line->body.line.dependencies, dependency = *remove;
1555 dependency != NULL;
1556 dependency = *remove) {
1557 if (dependency->name == NULL) {
1558 dependency = *remove = (*remove)->next;
1559 continue;
1560 }
1561 /* If dependency name string contains shell wildcards */
1562 /* replace the name with the expansion */
1563 if (dependency->name->wildcard) {
1564 wcb.init(dependency->name);
1565 if ((start = (wchar_t *) wschr(wcb.get_string(),
1566 (int) parenleft_char)) != NULL) {
1567 /* lib(*) type pattern */
1568 library = buffer;
1569 (void) wsncpy(buffer,
1570 wcb.get_string(),
1571 start - wcb.get_string());
1572 buffer[start-wcb.get_string()] =
1573 (int) nul_char;
1574 (void) wsncpy(pattern,
1575 start + 1,
1576 (int) (dependency->name->hash.length-(start-wcb.get_string())-2));
1577 pattern[dependency->name->hash.length -
1578 (start-wcb.get_string()) - 2] =
1579 (int) nul_char;
1580 } else {
1581 library = NULL;
1582 (void) wsncpy(pattern,
1583 wcb.get_string(),
1941 if (rule->assign) {
1942 result = build_ok;
1943 do_assign(rule->command_line, target);
1944 } else if (report_dependencies_level == 0) {
1945 /* Execute command line. */
1946 #ifdef DISTRIBUTED
1947 setvar_envvar((Avo_DoJobMsg *)NULL);
1948 #else
1949 setvar_envvar();
1950 #endif
1951 result = dosys(rule->command_line,
1952 (Boolean) rule->ignore_error,
1953 (Boolean) rule->make_refd,
1954 /* ds 98.04.23 bug #4085164. make should always show error messages */
1955 false,
1956 /* BOOLEAN(rule->silent &&
1957 rule->ignore_error), */
1958 (Boolean) rule->always_exec,
1959 target,
1960 send_mtool_msgs);
1961 check_state(temp_file_name);
1962 }
1963 SEND_MTOOL_MSG(
1964 append_job_result_msg(job_result_msg);
1965 if (child_pid > 0) {
1966 kill(child_pid, SIGUSR1);
1967 while (!((waitpid(child_pid, 0, 0) == -1)
1968 && (errno == ECHILD)));
1969 }
1970 child_pid = 0;
1971 (void) unlink(stdout_file);
1972 retmem_mb(stdout_file);
1973 stdout_file = NULL;
1974 );
1975 } else {
1976 result = build_ok;
1977 }
1978 if (result == build_failed) {
1979 if (silent || rule->silent) {
1980 (void) printf(catgets(catd, 1, 242, "The following command caused the error:\n%s\n"),
1981 rule->command_line->string_mb);
|