| 716 | } |
| 717 | |
| 718 | static void do_dependency(const char *file) |
| 719 | { |
| 720 | const char * const * moption; |
| 721 | struct stat buf; |
| 722 | char *alloc; |
| 723 | char *altpath; |
| 724 | char *path; |
| 725 | char *lasts; |
| 726 | char separator; |
| 727 | int cmdlen; |
| 728 | int pathlen; |
| 729 | int filelen; |
| 730 | int totallen; |
| 731 | int ret; |
| 732 | |
| 733 | /* Initialize the separator */ |
| 734 | |
| 735 | #ifdef HOST_CYGWIN |
| 736 | separator = (g_winnative || g_winpath) ? '\\' : '/'; |
| 737 | #else |
| 738 | separator = g_winnative ? '\\' : '/'; |
| 739 | #endif |
| 740 | |
| 741 | moption = g_moptions[get_compiler(g_cc)]; |
| 742 | |
| 743 | /* Copy the compiler into the command buffer */ |
| 744 | |
| 745 | cmdlen = strlen(g_cc); |
| 746 | if (cmdlen >= MAX_BUFFER) |
| 747 | { |
| 748 | fprintf(stderr, "ERROR: Compiler string is too long [%d/%d]: %s\n", |
| 749 | cmdlen, MAX_BUFFER, g_cc); |
| 750 | exit(EXIT_FAILURE); |
| 751 | } |
| 752 | |
| 753 | strcpy(g_command, g_cc); |
| 754 | |
| 755 | /* Copy " -MT " */ |
| 756 | |
| 757 | if (g_objpath) |
| 758 | { |
| 759 | char tmp[NAME_MAX + 6]; |
| 760 | char *dupname; |
| 761 | char *objname; |
| 762 | char *dotptr; |
| 763 | const char *expanded; |
| 764 | |
| 765 | dupname = strdup(file); |
| 766 | if (!dupname) |
| 767 | { |
| 768 | fprintf(stderr, "ERROR: Failed to dup: %s\n", file); |
| 769 | exit(EXIT_FAILURE); |
| 770 | } |
| 771 | |
| 772 | /* Check g_altpath. If only the CURRENT path is included, |
| 773 | * the obj target use its own full path. |
| 774 | */ |
| 775 |
no test coverage detected