Changeset 30 for trunk/src/kmk
- Timestamp:
- Nov 30, 2002, 7:53:42 AM (23 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/job.c
r27 r30 45 45 #endif 46 46 #endif /* not lint */ 47 48 #ifdef NMAKE 49 #define OLD_JOKE 1 50 #endif 47 51 48 52 #ifndef OLD_JOKE … … 1143 1147 if (strcmp(gn->name,"love") == 0) 1144 1148 (*abortProc)("Not war."); 1145 else 1149 #ifdef NMAKE 1150 else if (strcmp(gn->name,"fire") == 0) 1151 (*abortProc)("No match."); 1152 #endif 1153 else 1146 1154 #endif 1147 1155 (*abortProc)("%s %s. Stop", msg, gn->name); -
trunk/src/kmk/main.c
r27 r30 168 168 Lst envFirstVars; /* (-E) vars to override from env */ 169 169 static Boolean jobsRunning; /* TRUE if the jobs might be running */ 170 170 #ifdef NMAKE 171 static Boolean go_to_objdir; /* ! -o flag */ 172 #endif 171 173 static void MainParseArgs __P((int, char **)); 172 174 char * chdir_verify_path __P((char *, char *)); … … 203 205 optind = 1; /* since we're called more than once */ 204 206 #ifdef REMOTE 205 # define OPTFLAGS "BD:E:I:L:PSV:Xd:ef:ij:km:nqrstv" 207 # ifdef NMAKE 208 # define OPTFLAGS "BD:E:I:L:PSV:Xd:ef:ij:km:nqrstvo" 209 # else 210 # define OPTFLAGS "BD:E:I:L:PSV:Xd:ef:ij:km:nqrstv" 211 # endif 206 212 #else 207 # define OPTFLAGS "BD:E:I:PSV:Xd:ef:ij:km:nqrstv" 213 # ifdef NMAKE 214 # define OPTFLAGS "BD:E:I:PSV:Xd:ef:ij:km:nqrstvo" 215 # else 216 # define OPTFLAGS "BD:E:I:PSV:Xd:ef:ij:km:nqrstv" 217 # endif 208 218 #endif 209 219 rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) { … … 361 371 Var_Append(MAKEFLAGS, "-n", VAR_GLOBAL); 362 372 break; 373 #ifdef NMAKE 374 case 'o': 375 go_to_objdir = TRUE; 376 Var_Append(MAKEFLAGS, "-o", VAR_GLOBAL); 377 break; 378 #endif 363 379 case 'q': 364 380 queryFlag = TRUE; … … 450 466 char *obpath; 451 467 { 452 struct stat sb; 468 struct stat sb; 469 #ifdef NMAKE 470 if (!go_to_objdir) 471 return NULL; 472 #endif 453 473 454 474 if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { … … 679 699 debug = 0; /* No debug verbosity, please. */ 680 700 jobsRunning = FALSE; 701 #ifdef NMAKE 702 go_to_objdir = FALSE; 703 #endif 681 704 682 705 maxLocal = DEFMAXLOCAL; /* Set default local max concurrency */ … … 1391 1414 usage() 1392 1415 { 1393 (void)fprintf(stderr, "%s\n%s\n%s\n", 1394 "usage: make [-Beiknqrstv] [-D variable] [-d flags] [-E variable] [-f makefile]", 1395 " [-I directory] [-j max_jobs] [-m directory] [-V variable]", 1396 " [variable=value] [target ...]"); 1416 (void)fprintf(stderr, "%s\n%s\n%s\n" 1417 #ifdef NMAKE 1418 "%s\n" 1419 #endif 1420 , 1421 "usage: kmk [-Beiknqrstv] [-D variable] [-d flags] [-E variable] [-f makefile]", 1422 " [-I directory] [-j max_jobs] [-m directory] [-V variable]", 1423 " [variable=value] [target ...]" 1424 #ifdef NMAKE 1425 ,"NMAKE compatible mode enabled." 1426 1427 #endif 1428 ); 1397 1429 exit(2); 1398 1430 } -
trunk/src/kmk/parse.c
r27 r30 2172 2172 lineno++; 2173 2173 lastc = ' '; 2174 #ifdef NMAKE 2175 do { 2176 while ((c = ParseReadc ()) == ' ' || c == '\t') { 2177 continue; 2178 } 2179 if (c != '#') 2180 break; 2181 /* comment - skip line */ 2182 while ((c = ParseReadc ()) != '\n' && c != EOF) { 2183 continue; 2184 } 2185 if (c == EOF) 2186 break; 2187 } while (1); 2188 #else 2174 2189 while ((c = ParseReadc ()) == ' ' || c == '\t') { 2175 2190 continue; 2176 2191 } 2192 #endif 2177 2193 if (c == EOF || c == '\n') { 2178 2194 goto line_read; … … 2297 2313 *ep = 0; 2298 2314 2315 #ifdef NMAKE 2316 if (line[0] == '.' || line[0] == '!') { 2317 #else 2299 2318 if (line[0] == '.') { 2319 #endif 2300 2320 /* 2301 2321 * The line might be a conditional. Ask the conditional module … … 2409 2429 do { 2410 2430 while ((line = ParseReadLine ()) != NULL) { 2431 //debugkso: fprintf(stderr, "%s(%d): inLine=%d line=%s\n", fname, lineno, inLine, line); 2411 2432 if (*line == '.') { 2412 2433 /* … … 2450 2471 * a creation command. 2451 2472 */ 2452 #if ndef POSIX2473 #if !defined(POSIX) || defined(NMAKE) 2453 2474 shellCommand: 2454 2475 #endif … … 2496 2517 * and add it to the current list of targets. 2497 2518 */ 2498 #if ndef POSIX2519 #if !defined(POSIX) || defined(NMAKE) 2499 2520 Boolean nonSpace = FALSE; 2500 2521 #endif … … 2508 2529 goto nextLine; 2509 2530 } 2510 #if ndef POSIX2531 #if !defined(POSIX) || defined(NMAKE) 2511 2532 while ((*cp != ':') && (*cp != '!') && (*cp != '\0')) { 2512 2533 nonSpace = TRUE; … … 2516 2537 } 2517 2538 2518 #if ndef POSIX2539 #if !defined(POSIX) || defined(NMAKE) 2519 2540 if (*cp == '\0') { 2520 2541 if (inLine) { 2542 #ifndef NMAKE 2521 2543 Parse_Error (PARSE_WARNING, 2522 2544 "Shell command needs a leading tab"); 2545 #endif 2523 2546 goto shellCommand; 2524 2547 } else if (nonSpace) { … … 2543 2566 2544 2567 ParseDoDependency (line); 2545 #if ndef POSIX2568 #if !defined(POSIX) || defined(NMAKE) 2546 2569 } 2547 2570 #endif -
trunk/src/kmk/var.c
r27 r30 183 183 static Boolean VarSuffix __P((char *, Boolean, Buffer, ClientData)); 184 184 static Boolean VarRoot __P((char *, Boolean, Buffer, ClientData)); 185 #ifdef NMAKE 186 static Boolean VarBase __P((char *, Boolean, Buffer, ClientData)); 187 #endif 185 188 static Boolean VarMatch __P((char *, Boolean, Buffer, ClientData)); 186 189 #ifdef SYSVVARSUB … … 795 798 return (dummy ? TRUE : TRUE); 796 799 } 800 801 #ifdef NMAKE 802 /*- 803 *----------------------------------------------------------------------- 804 * VarBase -- 805 * Remove the head and suffix of the given word and place the result 806 * in the given buffer. 807 * 808 * Results: 809 * TRUE if characters were added to the buffer (a space needs to be 810 * added to the buffer before the next word). 811 * 812 * Side Effects: 813 * The trimmed word is added to the buffer. 814 * 815 *----------------------------------------------------------------------- 816 */ 817 static Boolean 818 VarBase (word, addSpace, buf, dummy) 819 char *word; /* Word to trim */ 820 Boolean addSpace; /* TRUE if need to stick a space in the 821 * buffer before adding the tail */ 822 Buffer buf; /* Buffer in which to store it */ 823 ClientData dummy; 824 { 825 register char *slash; 826 827 if (addSpace) { 828 Buf_AddByte (buf, (Byte)' '); 829 } 830 831 slash = strrchr (word, '/'); 832 if (slash != (char *)NULL) { 833 register char *dot; 834 *slash++ = '\0'; 835 dot = strrchr (slash, '.'); 836 if (dot) 837 { 838 *dot = '\0'; 839 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 840 *dot = '.'; 841 } 842 else 843 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 844 slash[-1] = '/'; 845 } else { 846 register char *dot; 847 dot = strrchr (slash, '.'); 848 if (dot) 849 { 850 *dot = '\0'; 851 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 852 *dot = '.'; 853 } 854 else 855 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 856 } 857 return (dummy ? TRUE : TRUE); 858 } 859 860 #endif 797 861 798 862 /*- … … 1496 1560 dynamic = FALSE; 1497 1561 start = str; 1562 //debugkso: fprintf(stderr, "var: str=%s\n", str); 1498 1563 1499 1564 if (str[1] != '(' && str[1] != '{') { … … 1590 1655 v = VarFind (str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); 1591 1656 if ((v == (Var *)NIL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) && 1657 #ifdef NMAKE 1658 (vlen == 2) && (str[1] == 'F' || str[1] == 'D' || str[1] == 'B' || str[1] == 'R')) 1659 #else 1592 1660 (vlen == 2) && (str[1] == 'F' || str[1] == 'D')) 1661 #endif 1593 1662 { 1594 1663 /* … … 1622 1691 val = (char *)Buf_GetAll(v->val, (int *)NULL); 1623 1692 1693 #ifdef NMAKE 1694 switch (str[1]) 1695 { 1696 case 'D': val = VarModify(val, VarHead, (ClientData)0); break; 1697 case 'B': val = VarModify(val, VarBase, (ClientData)0); break; 1698 case 'R': val = VarModify(val, VarRoot, (ClientData)0); break; 1699 default: val = VarModify(val, VarTail, (ClientData)0); break; 1700 } 1701 #else 1624 1702 if (str[1] == 'D') { 1625 1703 val = VarModify(val, VarHead, (ClientData)0); … … 1627 1705 val = VarModify(val, VarTail, (ClientData)0); 1628 1706 } 1707 #endif 1629 1708 /* 1630 1709 * Resulting string is dynamically allocated, so … … 1643 1722 1644 1723 if (v == (Var *)NIL) { 1724 //debugkso: fprintf(stderr, "\tv == (Var *)NIL vlen=%d str=%s\n", vlen, str); 1725 1645 1726 if (((vlen == 1) || 1646 1727 (((vlen == 2) && (str[1] == 'F' || 1728 #ifdef NMAKE 1729 str[1] == 'D' || str[1] == 'B' || str[1] == 'R')))) && 1730 #else 1647 1731 str[1] == 'D')))) && 1732 #endif 1648 1733 ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL))) 1649 1734 {
Note:
See TracChangeset
for help on using the changeset viewer.