Changeset 2955 in kBuild
- Timestamp:
- Sep 21, 2016 7:05:53 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kDepPre/kDepPre.c
r2413 r2955 465 465 if (!i) 466 466 { 467 depOptimize(fFixCase, 0 /* fQuiet */ );467 depOptimize(fFixCase, 0 /* fQuiet */, NULL /*pszIgnoredExt*/); 468 468 fprintf(pOutput, "%s:", pszTarget); 469 469 depPrint(pOutput); -
trunk/src/kObjCache/kObjCache.c
r2627 r2955 1101 1101 FatalMsg("Failed to open dependency file '%s': %s\n", pszFilename, strerror(errno)); 1102 1102 1103 depOptimize(fFixCase, fQuiet );1103 depOptimize(fFixCase, fQuiet, NULL /*pszIgnoredExt*/); 1104 1104 1105 1105 /* Make object file name with unix slashes. */ -
trunk/src/kmk/kmkbuiltin/kDepIDB.c
r2856 r2955 865 865 if (!i) 866 866 { 867 depOptimize(fFixCase, fQuiet );867 depOptimize(fFixCase, fQuiet, NULL /*pszIgnoredExt*/); 868 868 fprintf(pOutput, "%s:", pszTarget); 869 869 depPrint(pOutput); -
trunk/src/kmk/kmkbuiltin/kDepObj.c
r2896 r2955 974 974 static void usage(const char *a_argv0) 975 975 { 976 printf("usage: %s -o <output> -t <target> [-fqs] <OMF-file>\n"976 printf("usage: %s -o <output> -t <target> [-fqs] [-e <ignore-ext>] <OMF or COFF file>\n" 977 977 " or: %s --help\n" 978 978 " or: %s --version\n", … … 992 992 int fStubs = 0; 993 993 int fFixCase = 0; 994 const char *pszIgnoreExt = NULL; 994 995 /* Argument parsing. */ 995 996 int fInput = 0; /* set when we've found input argument. */ … … 1010 1011 if (argv[i][0] == '-') 1011 1012 { 1013 const char *pszValue; 1012 1014 const char *psz = &argv[i][1]; 1013 if (*psz == '-') 1015 char chOpt; 1016 chOpt = *psz++; 1017 if (chOpt == '-') 1014 1018 { 1015 if (!strcmp(psz, "-quiet")) 1016 psz = "q"; 1017 else if (!strcmp(psz, "-help")) 1018 psz = "?"; 1019 else if (!strcmp(psz, "-version")) 1020 psz = "V"; 1019 /* Convert long to short option. */ 1020 if (!strcmp(psz, "quiet")) 1021 chOpt = 'q'; 1022 else if (!strcmp(psz, "help")) 1023 chOpt = '?'; 1024 else if (!strcmp(psz, "version")) 1025 chOpt = 'V'; 1026 else 1027 { 1028 fprintf(stderr, "%s: syntax error: Invalid argument '%s'.\n", argv[0], argv[i]); 1029 usage(argv[0]); 1030 return 2; 1031 } 1032 psz = ""; 1021 1033 } 1022 1034 1023 switch (*psz) 1035 /* 1036 * Requires value? 1037 */ 1038 switch (chOpt) 1039 { 1040 case 'o': 1041 case 't': 1042 case 'e': 1043 if (*psz) 1044 pszValue = psz; 1045 else if (++i < argc) 1046 pszValue = argv[i]; 1047 else 1048 { 1049 fprintf(stderr, "%s: syntax error: The '-%c' option takes a value.\n", chOpt); 1050 return 2; 1051 } 1052 break; 1053 1054 default: 1055 pszValue = NULL; 1056 break; 1057 } 1058 1059 1060 switch (chOpt) 1024 1061 { 1025 1062 /* … … 1028 1065 case 'o': 1029 1066 { 1030 pszOutput = &argv[i][2];1031 1067 if (pOutput) 1032 1068 { 1033 1069 fprintf(stderr, "%s: syntax error: only one output file!\n", argv[0]); 1034 return 1;1070 return 2; 1035 1071 } 1036 if (!*pszOutput) 1037 { 1038 if (++i >= argc) 1039 { 1040 fprintf(stderr, "%s: syntax error: The '-o' argument is missing the filename.\n", argv[0]); 1041 return 1; 1042 } 1043 pszOutput = argv[i]; 1044 } 1072 pszOutput = pszValue; 1045 1073 if (pszOutput[0] == '-' && !pszOutput[1]) 1046 1074 pOutput = stdout; … … 1065 1093 return 1; 1066 1094 } 1067 pszTarget = &argv[i][2]; 1068 if (!*pszTarget) 1069 { 1070 if (++i >= argc) 1071 { 1072 fprintf(stderr, "%s: syntax error: The '-t' argument is missing the target name.\n", argv[0]); 1073 return 1; 1074 } 1075 pszTarget = argv[i]; 1076 } 1095 pszTarget = pszValue; 1077 1096 break; 1078 1097 } … … 1102 1121 { 1103 1122 fStubs = 1; 1123 break; 1124 } 1125 1126 /* 1127 * Extension to ignore. 1128 */ 1129 case 'e': 1130 { 1131 if (pszIgnoreExt) 1132 { 1133 fprintf(stderr, "%s: syntax error: The '-e' option can only be used once!\n"); 1134 return 2; 1135 } 1136 pszIgnoreExt = pszValue; 1104 1137 break; 1105 1138 } … … 1121 1154 fprintf(stderr, "%s: syntax error: Invalid argument '%s'.\n", argv[0], argv[i]); 1122 1155 usage(argv[0]); 1123 return 1;1156 return 2; 1124 1157 } 1125 1158 } … … 1179 1212 if (!i) 1180 1213 { 1181 depOptimize(fFixCase, fQuiet );1214 depOptimize(fFixCase, fQuiet, pszIgnoreExt); 1182 1215 fprintf(pOutput, "%s:", pszTarget); 1183 1216 depPrint(pOutput); -
trunk/src/lib/kDep.c
r2950 r2955 187 187 * 'Optimizes' and corrects the dependencies. 188 188 */ 189 void depOptimize(int fFixCase, int fQuiet )189 void depOptimize(int fFixCase, int fQuiet, const char *pszIgnoredExt) 190 190 { 191 191 /* 192 192 * Walk the list correct the names and re-insert them. 193 193 */ 194 PDEP pDepOrg = g_pDeps; 195 PDEP pDep = g_pDeps; 194 size_t cchIgnoredExt = pszIgnoredExt ? strlen(pszIgnoredExt) : 0; 195 PDEP pDepOrg = g_pDeps; 196 PDEP pDep = g_pDeps; 196 197 g_pDeps = NULL; 197 198 for (; pDep; pDep = pDep->pNext) … … 214 215 continue; 215 216 pszFilename = pDep->szFilename; 217 218 /* 219 * Skip pszIgnoredExt if given. 220 */ 221 if ( pszIgnoredExt 222 && pDep->cchFilename > cchIgnoredExt 223 && memcmp(&pDep->szFilename[pDep->cchFilename - cchIgnoredExt], pszIgnoredExt, cchIgnoredExt) == 0) 224 continue; 216 225 217 226 #if K_OS != K_OS_OS2 && K_OS != K_OS_WINDOWS -
trunk/src/lib/kDep.h
r2851 r2955 48 48 49 49 extern PDEP depAdd(const char *pszFilename, size_t cchFilename); 50 extern void depOptimize(int fFixCase, int fQuiet );50 extern void depOptimize(int fFixCase, int fQuiet, const char *pszIgnoredExt); 51 51 extern void depPrint(FILE *pOutput); 52 52 extern void depPrintStubs(FILE *pOutput);
Note:
See TracChangeset
for help on using the changeset viewer.