Changeset 520 in kBuild
- Timestamp:
- Sep 16, 2006 4:56:25 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r516 r520 1 1 /* $Id$ */ 2 3 2006-09-16: 4 - src/gmake: 5 o Cleaning up the modifications. Changes are now either configurable 6 or marked, and dead stuff has been removed (dll shell). 2 7 3 8 2006-09-15: -
trunk/src/gmake/Makefile.kmk
r510 r520 21 21 CONFIG_NO_DEFAULT_SUFFIX_RULES \ 22 22 CONFIG_NO_DEFAULT_VARIABLES \ 23 CONFIG_WITH_EXTENDED_NOTPARALLEL \ 24 CONFIG_WITH_TOUPPER_TOLOWER \ 23 25 KMK \ 24 26 VARIABLE_HASH … … 187 189 # 188 190 config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET) 191 config.h.win := config.h.W32 189 192 config.h.win32 := config.h.W32 190 193 config.h.win64 := config.h.W32 -
trunk/src/gmake/build.sh.in
r503 r520 1 #!/bin/sh 2 # Shell script to build GNU Make in the absence of any `make' program. 3 # @configure_input@ 1 4 2 5 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -
trunk/src/gmake/commands.c
r503 r520 361 361 /* check if kmk builtin command */ 362 362 if (!strncmp(p, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) 363 flags |= COMMANDS_ BUILTIN;363 flags |= COMMANDS_KMK_BUILTIN; 364 364 #endif 365 365 … … 388 388 { 389 389 /* If there are no commands, assume everything worked. */ 390 #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL 390 391 file->command_flags |= COMMANDS_NO_COMMANDS; 392 #endif 391 393 set_command_state (file, cs_running); 392 394 file->update_status = 0; -
trunk/src/gmake/commands.h
r503 r520 35 35 #define COMMANDS_SILENT 2 /* Silent: @. */ 36 36 #define COMMANDS_NOERROR 4 /* No errors: -. */ 37 #define COMMANDS_NOTPARALLEL 32 /* kmk: the commands must be executed alone. */ 38 #define COMMANDS_BUILTIN 64 /* kmk: builtin command. */ 39 #define COMMANDS_NO_COMMANDS 128 /* kmk: No commands. */ 37 #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL 38 # define COMMANDS_NOTPARALLEL 32 /* kmk: The commands must be executed alone. */ 39 # define COMMANDS_NO_COMMANDS 64 /* kmk: No commands. */ 40 #endif 41 #ifdef CONFIG_WITH_KMK_BUILTIN 42 # define COMMANDS_KMK_BUILTIN 128 /* kmk: kmk builtin command. */ 43 #endif 40 44 41 45 extern void execute_file_commands PARAMS ((struct file *file)); -
trunk/src/gmake/config/config.guess
r503 r520 1 #! /bin/sh 2 # Attempt to guess a canonical system name. 3 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, 5 # Inc. 1 6 2 7 timestamp='2006-03-13' -
trunk/src/gmake/config/config.sub
r503 r520 1 #! /bin/sh 2 # Configuration validation subroutine script. 3 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, 5 # Inc. 1 6 2 7 timestamp='2006-03-07' -
trunk/src/gmake/debug.h
r503 r520 22 22 #define DB_IMPLICIT (0x008) 23 23 #define DB_MAKEFILES (0x100) 24 #define DB_KMK (0x800) 24 #ifdef KMK 25 # define DB_KMK (0x800) 26 #endif 25 27 26 28 #define DB_ALL (0xfff) … … 28 30 extern int db_level; 29 31 32 #ifdef KMK 33 34 /* Some extended info for -j and .NOTPARALLEL tracking. */ 30 35 extern unsigned int makelevel; 31 36 extern unsigned int job_slots; 32 37 extern unsigned int job_slots_used; 33 34 38 35 39 #define DB_HDR() do { printf ("[%u:%u/%u]", makelevel, job_slots_used, job_slots); } while (0) … … 47 51 48 52 #define DB(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); printf _x; fflush (stdout);} }while(0) 53 54 #else /* !KMK */ 55 56 #define ISDB(_l) ((_l)&db_level) 57 58 #define DBS(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \ 59 printf _x; fflush (stdout);} }while(0) 60 61 #define DBF(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \ 62 printf (_x, file->name); \ 63 fflush (stdout);} }while(0) 64 65 #define DB(_l,_x) do{ if(ISDB(_l)) {printf _x; fflush (stdout);} }while(0) 66 67 #endif /* !KMK */ -
trunk/src/gmake/file.c
r503 r520 738 738 } 739 739 740 /* kmk changed */741 740 f = lookup_file (".NOTPARALLEL"); 742 741 if (f != 0 && f->is_target) 742 #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL 743 not_parallel = 1; 744 #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 743 745 { 744 746 if (f->deps == 0) … … 752 754 f2->command_flags |= COMMANDS_NOTPARALLEL; 753 755 } 756 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 754 757 755 758 #ifndef NO_MINUS_C_MINUS_O -
trunk/src/gmake/function.c
r503 r520 29 29 #endif 30 30 31 #ifdef WINDOWS32 32 # include "pathstuff.h"31 #ifdef WINDOWS32 /* bird */ 32 # include "pathstuff.h" 33 33 #endif 34 34 … … 1665 1665 CLOSE_ON_EXEC(pipedes[0]); 1666 1666 /* Never use fork()/exec() here! Use spawn() instead in exec_command() */ 1667 pid = child_execute_job (0, pipedes[1], command_argv, envp , NULL);1667 pid = child_execute_job (0, pipedes[1], command_argv, envp); 1668 1668 if (pid < 0) 1669 1669 perror_with_name (error_prefix, "spawn"); … … 1900 1900 return NULL; 1901 1901 1902 #ifdef WINDOWS32 1902 #ifdef WINDOWS32 /* bird */ 1903 1903 dest = w32ify((char *)name, 1); 1904 1904 if (!dest) 1905 1905 return NULL; 1906 1906 { 1907 1907 size_t len = strlen(dest); … … 1912 1912 (void)end; (void)start; (void)apath_limit; 1913 1913 1914 #elif defined __OS2__ 1914 #elif defined __OS2__ /* bird */ 1915 1915 if (_abspath(apath, name, GET_PATH_MAX)) 1916 1916 return NULL; 1917 1917 dest = strchr(apath, '\0'); 1918 1918 … … 1989 1989 1990 1990 /* Unless it is root strip trailing separator. */ 1991 #ifdef HAVE_DOS_PATHS 1991 #ifdef HAVE_DOS_PATHS /* bird (is this correct? what about UNC?) */ 1992 1992 if (dest > apath + 1 + (apath[0] != '/') && dest[-1] == '/') 1993 1993 #else … … 2077 2077 } 2078 2078 2079 #ifdef KMK2079 #ifdef CONFIG_WITH_TOUPPER_TOLOWER 2080 2080 static char * 2081 2081 func_toupper_tolower (char *o, char **argv, const char *funcname) … … 2099 2099 return o; 2100 2100 } 2101 #endif 2101 #endif /* CONFIG_WITH_TOUPPER_TOLOWER */ 2102 2102 2103 2103 /* Lookup table for builtin functions. … … 2158 2158 { STRING_SIZE_TUPLE("not"), 0, 1, 1, func_not}, 2159 2159 #endif 2160 #ifdef KMK2160 #ifdef CONFIG_WITH_TOUPPER_TOLOWER 2161 2161 { STRING_SIZE_TUPLE("toupper"), 0, 1, 1, func_toupper_tolower}, 2162 2162 { STRING_SIZE_TUPLE("tolower"), 0, 1, 1, func_toupper_tolower}, -
trunk/src/gmake/job.c
r516 r520 28 28 #include "debug.h" 29 29 #ifdef CONFIG_WITH_KMK_BUILTIN 30 # include "kmkbuiltin.h"30 # include "kmkbuiltin.h" 31 31 #endif 32 32 33 33 34 34 #include <string.h> 35 36 #ifdef MAKE_DLLSHELL37 #include <dlfcn.h>38 #endif39 35 40 36 /* Default shell to use. */ … … 64 60 #elif defined (__EMX__) 65 61 66 char *default_shell = "sh.exe"; 62 char *default_shell = "sh.exe"; /* bird changed this from "/bin/sh" as that doesn't make sense on OS/2. */ 67 63 int batch_mode_shell = 0; 68 64 … … 210 206 static int job_next_command PARAMS ((struct child *)); 211 207 static int start_waiting_job PARAMS ((struct child *)); 212 #ifdef MAKE_DLLSHELL213 static int spawn_command PARAMS ((char **argv, char **envp, struct child *child));214 #endif215 208 216 209 … … 492 485 int any_remote, any_local; 493 486 int dontcare; 494 #if defined(CONFIG_WITH_KMK_BUILTIN) || defined(MAKE_DLLSHELL)495 struct child *completed_child = 0;487 #ifdef CONFIG_WITH_KMK_BUILTIN 488 struct child *completed_child = NULL; 496 489 #endif 497 490 … … 534 527 any_remote |= c->remote; 535 528 any_local |= ! c->remote; 536 #if defined(CONFIG_WITH_KMK_BUILTIN) || defined(MAKE_DLLSHELL) 537 if (c->have_status) 529 #ifdef CONFIG_WITH_KMK_BUILTIN 530 if (c->has_status) 531 { 538 532 completed_child = c; 533 DB (DB_JOBS, (_("builtin child 0x%08lx (%s) PID %ld %s Status %ld\n"), 534 (unsigned long int) c, c->file->name, 535 (long) c->pid, c->remote ? _(" (remote)") : "", 536 (long) c->status)); 537 } 538 else 539 539 #endif 540 540 DB (DB_JOBS, (_("Live child 0x%08lx (%s) PID %ld %s\n"), … … 564 564 { 565 565 /* No remote children. Check for local children. */ 566 #if defined(CONFIG_WITH_KMK_BUILTIN) || defined(MAKE_DLLSHELL)566 #ifdef CONFIG_WITH_KMK_BUILTIN 567 567 if (completed_child) 568 568 { … … 577 577 } 578 578 else 579 #endif 579 #endif /* CONFIG_WITH_KMK_BUILTIN */ 580 580 #if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32) 581 581 if (any_local) … … 584 584 vmsWaitForChildren (&status); 585 585 pid = c->pid; 586 #elif MAKE_DLLSHELL587 pid = wait_jobs((int*)&status, block);588 586 #else 589 587 #ifdef WAIT_NOHANG … … 1039 1037 child->noerror = 1; 1040 1038 else if (!isblank ((unsigned char)*p)) 1039 #ifndef CONFIG_WITH_KMK_BUILTIN 1040 break; 1041 #else /* CONFIG_WITH_KMK_BUILTIN */ 1042 1041 1043 { 1042 #ifdef CONFIG_WITH_KMK_BUILTIN 1043 if ( !(flags & COMMANDS_BUILTIN) 1044 if ( !(flags & COMMANDS_KMK_BUILTIN) 1044 1045 && !strncmp(p, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) 1045 flags |= COMMANDS_BUILTIN; 1046 #endif /* CONFIG_WITH_KMK_BUILTIN */ 1046 flags |= COMMANDS_KMK_BUILTIN; 1047 1047 break; 1048 1048 } 1049 #endif /* CONFIG_WITH_KMK_BUILTIN */ 1049 1050 ++p; 1050 1051 } … … 1058 1059 child->file->cmds->lines_flags[child->command_line - 1] 1059 1060 #ifdef CONFIG_WITH_KMK_BUILTIN 1060 |= flags & (COMMANDS_RECURSE | COMMANDS_ BUILTIN);1061 |= flags & (COMMANDS_RECURSE | COMMANDS_KMK_BUILTIN); 1061 1062 #else 1062 1063 |= flags & COMMANDS_RECURSE; … … 1184 1185 /* If builtin command then pass it on to the builtin shell interpreter. */ 1185 1186 1186 if ((flags & COMMANDS_ BUILTIN) && !just_print_flag)1187 if ((flags & COMMANDS_KMK_BUILTIN) && !just_print_flag) 1187 1188 { 1188 1189 int rc; … … 1209 1210 child->pid = (pid_t)42424242; 1210 1211 child->status = rc << 8; 1211 child->ha ve_status = 1;1212 child->has_status = 1; 1212 1213 return; 1213 1214 } … … 1323 1324 /* Never use fork()/exec() here! Use spawn() instead in exec_command() */ 1324 1325 child->pid = child_execute_job (child->good_stdin ? 0 : bad_stdin, 1, 1325 argv, child->environment , child);1326 argv, child->environment); 1326 1327 if (child->pid < 0) 1327 1328 { … … 1506 1507 { 1507 1508 struct file *f = c->file; 1509 #ifdef DB_KMK 1508 1510 DB (DB_KMK, (_("start_waiting_job %p (`%s') command_flags=%#x slots=%d/%d\n"), c, c->file->name, c->file->command_flags, job_slots_used, job_slots)); 1511 #endif 1509 1512 1510 1513 /* If we can start a job remotely, we always want to, and don't care about … … 1514 1517 c->remote = start_remote_job_p (1); 1515 1518 1519 #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL 1516 1520 if (c->file->command_flags & COMMANDS_NOTPARALLEL) 1517 1521 { 1518 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s')\n"), not_parallel, not_parallel + 1, c->file, c->file->name)); 1522 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [start_waiting_job]\n"), 1523 not_parallel, not_parallel + 1, c->file, c->file->name)); 1524 assert(not_parallel >= 0); 1519 1525 ++not_parallel; 1520 1526 } 1527 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1521 1528 1522 1529 /* If we are running at least one job already and the load average 1523 1530 is too high, make this one wait. */ 1524 1531 if (!c->remote 1532 #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL 1525 1533 && ((job_slots_used > 0 && (not_parallel > 0 || load_too_high ())) 1534 #else 1535 && ((job_slots_used > 0 && load_too_high ()) 1536 #endif 1526 1537 #ifdef WINDOWS32 1527 1538 || (process_used_slots () >= MAXIMUM_WAIT_OBJECTS) … … 1529 1540 )) 1530 1541 { 1542 #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL 1543 /* Put this child on the chain of children waiting for the load average 1544 to go down. */ 1545 set_command_state (f, cs_running); 1546 c->next = waiting_jobs; 1547 waiting_jobs = c; 1548 1549 #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1550 1531 1551 /* Put this child on the chain of children waiting for the load average 1532 to go down. if not parallel, put it last. */1552 to go down. If not parallel, put it last. */ 1533 1553 set_command_state (f, cs_running); 1534 1554 c->next = waiting_jobs; … … 1541 1561 prev->next = c; 1542 1562 } 1543 else 1563 else /* FIXME: insert after the last node with COMMANDS_NOTPARALLEL set */ 1544 1564 waiting_jobs = c; 1545 1565 DB (DB_KMK, (_("queued child %p (`%s')\n"), c, c->file->name)); 1566 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1546 1567 return 0; 1547 1568 } 1548 1549 1569 1550 1570 /* Start the first command; reap_children will run later command lines. */ … … 1555 1575 case cs_running: 1556 1576 c->next = children; 1557 DB (DB_JOBS, (_("Putting child 0x%08lx (%s) PID %ld%s on the chain. (%u/%u)\n"),1577 DB (DB_JOBS, (_("Putting child 0x%08lx (%s) PID %ld%s on the chain.\n"), 1558 1578 (unsigned long int) c, c->file->name, 1559 (long) c->pid, c->remote ? _(" (remote)") : "" , job_slots_used + 1, job_slots));1579 (long) c->pid, c->remote ? _(" (remote)") : "")); 1560 1580 children = c; 1561 1581 /* One more job slot is in use. */ … … 1830 1850 (void) start_waiting_job (c); 1831 1851 1832 if (job_slots == 1 || not_parallel > 0) 1852 #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL 1853 if (job_slots == 1 || not_parallel) 1833 1854 /* Since there is only one job slot, make things run linearly. 1834 1855 Wait for the child to die, setting the state to `cs_finished'. */ 1835 while (file->command_state == cs_running 1836 && (job_slots == 1 || not_parallel > 0) 1837 && (children != 0 || shell_function_pid != 0) /* reap_child condition - hackish! */) 1856 while (file->command_state == cs_running) 1838 1857 reap_children (1, 0); 1858 1859 #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1860 1861 if (job_slots == 1 || not_parallel < 0) 1862 { 1863 /* Since there is only one job slot, make things run linearly. 1864 Wait for the child to die, setting the state to `cs_finished'. */ 1865 while (file->command_state == cs_running) 1866 reap_children (1, 0); 1867 } 1868 else if (not_parallel > 0) 1869 { 1870 /* wait for all live children to finish and then continue 1871 with the not-parallel child(s). FIXME: this loop could be better? */ 1872 while (file->command_state == cs_running 1873 && (children != 0 || shell_function_pid != 0) /* reap_child condition */ 1874 && not_parallel > 0) 1875 reap_children (1, 0); 1876 } 1877 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1839 1878 1840 1879 return; … … 1987 2026 waiting_jobs = job->next; 1988 2027 1989 /* we've already counted it. */ 2028 #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL 2029 /* If it's a not-parallel job, we've already counted it once 2030 when it was queued in start_waiting_job, so decrement 2031 before sending it to start_waiting_job again. */ 1990 2032 if (job->file->command_flags & COMMANDS_NOTPARALLEL) 1991 2033 { 1992 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [waiting job]\n"), not_parallel, not_parallel - 1, job->file, job->file->name)); 2034 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [start_waiting_jobs]\n"), 2035 not_parallel, not_parallel - 1, job->file, job->file->name)); 2036 assert(not_parallel > 0); 1993 2037 --not_parallel; 1994 2038 } 2039 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1995 2040 1996 2041 /* Try to start that job. We break out of the loop as soon … … 2006 2051 2007 2052 /* EMX: Start a child process. This function returns the new pid. */ 2008 /* The child argument can be NULL (that's why we return the pid), if it is2009 and the shell is a dllshell:// a child structure is created and inserted2010 into the child list so reap_children can do its job.2011 2012 BTW. the name of this function in this port is very misleading, spawn_job2013 would perhaps be more appropriate. */2014 2053 # if defined __MSDOS__ || defined __EMX__ 2015 2054 int 2016 child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp, 2017 struct child *child) 2055 child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp) 2018 2056 { 2019 2057 int pid; … … 2048 2086 CLOSE_ON_EXEC (stdout_fd); 2049 2087 2050 #ifdef MAKE_DLLSHELL2051 pid = spawn_command(argv, envp, child);2052 #else2053 2088 /* Run the command. */ 2054 2089 pid = exec_command (argv, envp); 2055 #endif2056 2090 2057 2091 /* Restore stdout/stdin of the parent and close temporary FDs. */ … … 2098 2132 #endif /* !AMIGA && !__MSDOS__ && !VMS */ 2099 2133 #endif /* !WINDOWS32 */ 2100 2101 2102 #ifdef MAKE_DLLSHELL2103 /* Globals for the currently loaded dllshell. */2104 char *dllshell_spec;2105 void *dllshell_dl;2106 void *dllshell_instance;2107 void *(*dllshell_init) PARAMS ((const char *spec));2108 pid_t (*dllshell_spawn) PARAMS ((void *instance, char **argv, char **envp, int *status, char *done));2109 pid_t (*dllshell_wait) PARAMS ((void *instance, int *status, int block));2110 2111 /* This is called when all pipes and such are configured for the2112 child process. The child argument may be null, see child_execute_job. */2113 static int spawn_command (char **argv, char **envp, struct child *c)2114 {2115 /* Now let's see if there is a DLLSHELL specifier in the2116 first argument. */2117 if (!strncmp(argv[0], "dllshell://", 11))2118 {2119 /* dllshell://<dllname>[!<realshell>[!whatever]] */2120 char *name, *name_end;2121 int insert_child = 0;2122 2123 /* parse it */2124 name = argv[0] + 11;2125 name_end = strchr (name, '!');2126 if (!name_end)2127 name_end = strchr (name, '\0');2128 if (name_end == name)2129 fatal (NILF, _("%s : malformed specifier!\n"), argv[0]);2130 2131 /* need loading? */2132 if (!dllshell_spec || strcmp (argv[0], dllshell_spec))2133 {2134 if (dllshell_spec)2135 fatal (NILF, _("cannot change the dllshell!!!\n"));2136 2137 dllshell_spec = strdup (argv[0]);2138 dllshell_spec[name_end - argv[0]] = '\0';2139 dllshell_dl = dlopen (dllshell_spec + (name - argv[0]), RTLD_LOCAL);2140 if (!dllshell_dl)2141 fatal (NILF, _("%s : failed to load! dlerror: '%s'\n"), argv[0], dlerror());2142 dllshell_spec[name_end - name] = '!';2143 2144 /* get symbols */2145 dllshell_init = dlsym (dllshell_dl, "dllshell_init");2146 if (!dllshell_init)2147 fatal (NILF, _("%s : failed to find symbols 'dllshell_init' dlerror: %s\n"), argv[0], dlerror());2148 dllshell_spawn = dlsym (dllshell_dl, "dllshell_spawn");2149 if (!dllshell_spawn)2150 fatal (NILF, _("%s : failed to find symbols 'dllshell_spawn' dlerror: %s\n"), argv[0], dlerror());2151 dllshell_wait = dlsym (dllshell_dl, "dllshell_wait");2152 if (!dllshell_wait)2153 fatal (NILF, _("%s : failed to find symbols 'dllshell_wait' dlerror: %s\n"), argv[0], dlerror());2154 2155 /* init */2156 dllshell_instance = dllshell_init(dllshell_spec);2157 if (!dllshell_instance)2158 fatal (NILF, _("%s : init failed!!!\n"), argv[0]);2159 }2160 2161 /* make child struct? */2162 if (!c)2163 {2164 c = (struct child *) xmalloc (sizeof (struct child));2165 bzero ((char *)c, sizeof (struct child));2166 insert_child = 1;2167 }2168 2169 /* call it. return value is 0 on succes, -1 on failure. */2170 c->pid = dllshell_spawn (dllshell_instance, argv, envp, &c->status, &c->dllshell_done);2171 DB (DB_JOBS, (_("dllshell pid=%x\n"), c->pid));2172 2173 if (insert_child && c->pid > 0)2174 {2175 c->next = children;2176 DB (DB_JOBS, (_("Putting child 0x%08lx (-) PID %ld on the chain.\n"),2177 (unsigned long int) c, (long) c->pid));2178 children = c;2179 /* One more job slot is in use. */2180 ++job_slots_used;2181 }2182 }2183 else2184 {2185 /* Run the command. */2186 #ifdef __EMX__2187 c->pid =2188 exec_command (argv, envp);2189 #else2190 # error MAKE_DLLSHELL is not ported to your platform yet.2191 #endif2192 DB (DB_JOBS, (_("spawn pid=%x\n"), c->pid));2193 }2194 2195 return c->pid;2196 }2197 2198 /* Waits or pools for a job to finish.2199 If the block argument the the function will not return2200 till a job is completed (if there are any jobs).2201 Returns pid of completed job.2202 Returns 0 if no jobs are finished.2203 Returns -1 if no jobs are running. */2204 pid_t wait_jobs (int *status, int block)2205 {2206 pid_t pid;2207 if (dllshell_wait)2208 pid = dllshell_wait(dllshell_instance, status, block);2209 else2210 {2211 if (block)2212 pid = WAIT_NOHANG(status);2213 else2214 pid = wait(status);2215 }2216 return pid;2217 }2218 2219 #endif /* MAKE_DLLSHELL */2220 2134 2221 2135 … … 2633 2547 #else /* !__MSDOS__ */ 2634 2548 else if (strcmp (shell, default_shell)) 2549 # ifndef KMK 2550 goto slow; 2551 #else /* KMK */ 2635 2552 { 2636 2553 /* Allow ash from kBuild. */ 2637 2554 const char *psz = strstr(shell, "/kmk_ash"); 2638 2555 if ( !psz 2639 || (!psz[sizeof("/kmk_ash")] && psz[sizeof("/kmk_ash")] == '.')) 2640 goto slow; 2641 } 2556 || (!psz[sizeof("/kmk_ash")] && psz[sizeof("/kmk_ash")] == '.')) /* FIXME: this test looks bogus... */ 2557 goto slow; 2558 } 2559 # endif /* KMK */ 2642 2560 #endif /* !__MSDOS__ && !__EMX__ */ 2643 2561 #endif /* not WINDOWS32 */ … … 3289 3207 } 3290 3208 #if defined(CONFIG_WITH_KMK_BUILTIN) && defined(WINDOWS32) 3209 /* On windows we have to avoid batch mode for builtin commands. */ 3291 3210 if (!strncmp(line, "kmk_builtin_", sizeof("kmk_builtin_") - 1)) 3292 3211 { -
trunk/src/gmake/job.h
r503 r520 56 56 #endif 57 57 char *sh_batch_file; /* Script file for shell commands */ 58 #if defined(CONFIG_WITH_KMK_BUILTIN) || defined(MAKE_DLLSHELL)58 #ifdef CONFIG_WITH_KMK_BUILTIN 59 59 int status; /* Status of the job. */ 60 unsigned int have_status:1; /* Nonzero if status is available. */ 61 #endif 62 #ifdef MAKE_DLLSHELL 63 unsigned int dllshelled:1; /* Nonzero if executed thru dllshell. */ 60 unsigned int has_status:1; /* Nonzero if status is available. */ 64 61 #endif 65 62 unsigned int remote:1; /* Nonzero if executing remotely. */ … … 81 78 #ifdef VMS 82 79 extern int child_execute_job PARAMS ((char *argv, struct child *child)); 83 #elif defined(__EMX__) || defined (MAKE_DLLSHELL)84 extern int child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp , struct child *child));80 #elif defined(__EMX__) 81 extern int child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp)); 85 82 #else 86 83 extern void child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp)); … … 110 107 extern unsigned int jobserver_tokens; 111 108 112 #ifdef MAKE_DLLSHELL113 extern pid_t wait_jobs PARAMS ((int *status, int block));114 #endif115 116 109 #endif /* SEEN_JOB_H */ -
trunk/src/gmake/main.c
r506 r520 494 494 int second_expansion; 495 495 496 /* Negative if we have seen the `.NOTPARALLEL' target with empty dependency list. 497 Zero if no `.NOTPARALLEL' or no file in the dependency list is being executed. 498 Positive when a file in `.NOTPARALLEL' is being made. 499 Nonzero values have the effect of disabeling parallel building. */ 496 #ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL 497 /* Nonzero if we have seen the `.NOTPARALLEL' target. 498 This turns off parallel builds for this invocation of make. */ 499 500 #else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 501 502 /* Negative if we have seen the `.NOTPARALLEL' target with an 503 empty dependency list. 504 505 Zero if no `.NOTPARALLEL' or no file in the dependency list 506 is being executed. 507 508 Positive when a file in the `.NOTPARALLEL' dependency list 509 is in progress, the value is the number of notparallel files 510 in progress (running or queued for running). 511 512 In short, any nonzero value means no more parallel builing. */ 513 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 500 514 501 515 int not_parallel; … … 633 647 db_level |= DB_BASIC | DB_VERBOSE; 634 648 break; 649 #ifdef DB_KMK 635 650 case 'k': 636 651 db_level |= DB_KMK; 637 652 break; 653 #endif 638 654 default: 639 655 fatal (NILF, _("unknown debug level specification `%s'"), p); … … 2101 2117 int pid; 2102 2118 int status; 2103 pid = child_execute_job (0, 1, nargv, environ , NULL);2119 pid = child_execute_job (0, 1, nargv, environ); 2104 2120 2105 2121 /* is this loop really necessary? */ … … 2738 2754 *(unsigned int *) cs->noarg_value)) 2739 2755 ADD_FLAG ("", 0); /* Optional value omitted; see below. */ 2740 #if !defined(KMK) || defined(MAKE_JOBSERVER) /* Win32 doesn't have a job server, but we really do want jobs despite the risks. */2741 2756 else if (cs->c == 'j') 2742 2757 /* Special case for `-j'. */ 2743 2758 ADD_FLAG ("1", 1); 2744 #endif2745 2759 else 2746 2760 { -
trunk/src/gmake/make.h
r507 r520 41 41 42 42 /* Use prototypes if available. */ 43 #if defined (__cplusplus) || defined (__STDC__) || defined WINDOWS32 43 #if defined (__cplusplus) || defined (__STDC__) || defined WINDOWS32 /* bird: protos on windows */ 44 44 # undef PARAMS 45 45 # define PARAMS(protos) protos … … 425 425 extern char *end_of_token PARAMS ((const char *)); 426 426 extern void collapse_continuations PARAMS ((char *)); 427 #if def KMK427 #if 1 /* memchr is usually compiler intrinsic, thus faster. */ 428 428 #define lindex(s, limit, c) ((char *)memchr((s), (c), (limit) - (s))) 429 429 #else … … 615 615 while (((_v)=_c)==0 && errno==EINTR); }while(0) 616 616 617 #ifdef __EMX__ /* saves 40-100ms on libc. */617 #ifdef __EMX__ /* bird: saves 40-100ms on libc. */ 618 618 #undef strchr 619 619 #define strchr(s, c) \ … … 700 700 } 701 701 702 #endif 702 #endif /* __EMX__ (bird) */ -
trunk/src/gmake/misc.c
r503 r520 21 21 #include "debug.h" 22 22 23 #ifdef __EMX__ /* saves 5-10ms on libc */23 #ifdef __EMX__ /* bird: saves 5-10ms on libc */ 24 24 # define bcopy(src, dst, size) __builtin_memcpy((dst), (src), (size)) 25 25 #endif … … 406 406 407 407 408 #ifndef KMK /* This is really a reimplemntation of memchr. */ 408 #if 0 /* This is really a reimplemntation of memchr, only slower. 409 It's been replaced by a macro in the header file. */ 409 410 /* Limited INDEX: 410 411 Search through the string STRING, which ends at LIMIT, for the character C. -
trunk/src/gmake/read.c
r509 r520 223 223 #ifdef VMS 224 224 /* all lower case since readdir() (the vms version) 'lowercasifies' */ 225 # ifdef KMK 225 226 { "makefile.kmk", "makefile.vms", "gnumakefile.", "makefile.", 0 }; 227 # else 228 { "makefile.vms", "gnumakefile.", "makefile.", 0 }; 229 # endif 226 230 #else 227 231 #ifdef _AMIGA 228 232 /* what's the deal here? no dots? */ 233 # ifdef KMK 229 234 { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "Makefile", "SMakefile", 0 }; 235 # else 236 { "GNUmakefile", "Makefile", "SMakefile", 0 }; 237 # endif 230 238 #else /* !Amiga && !VMS */ 239 # ifdef KMK 231 240 { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "makefile", "Makefile", 0 }; 241 # else 242 { "GNUmakefile", "makefile", "Makefile", 0 }; 243 # endif 232 244 #endif /* AMIGA */ 233 245 #endif /* VMS */ … … 1157 1169 fatal (fstart, _("missing target pattern")); 1158 1170 else if (target->next != 0) 1159 fatal (fstart, _("multiple target patterns (target `%s')"), target->name); 1171 fatal (fstart, _("multiple target patterns (target `%s')"), target->name); /* bird */ 1160 1172 pattern = target->name; 1161 1173 pattern_percent = find_percent (pattern); 1162 1174 if (pattern_percent == 0) 1163 fatal (fstart, _("target pattern contains no `%%' (target `%s')"), target->name); 1175 fatal (fstart, _("target pattern contains no `%%' (target `%s')"), target->name); /* bird */ 1164 1176 free ((char *)target); 1165 1177 } … … 2156 2168 unsigned int string_len = 0; 2157 2169 register char *p = string; 2158 register int ch; /* bird */2170 register int ch; /* bird: 'optimiziations' */ 2159 2171 2160 2172 if (ignorevars) … … 2269 2281 struct nameseq *new = 0; 2270 2282 struct nameseq *new1; 2271 #ifndef NO_ARCHIVES 2283 #ifndef NO_ARCHIVES /* bird: MSC warning */ 2272 2284 struct nameseq *lastnew1; 2273 2285 #endif -
trunk/src/gmake/remake.c
r503 r520 803 803 int ran = file->command_state == cs_running; 804 804 int touched = 0; 805 DB (DB_JOBS, (_("notice_finished_file - entering: file=%p `%s' update_status=%d command_state=%d\n"), 805 DB (DB_JOBS, (_("notice_finished_file - entering: file=%p `%s' update_status=%d command_state=%d\n"), /* bird */ 806 806 file, file->name, file->update_status, file->command_state)); 807 807 file->command_state = cs_finished; 808 808 file->updated = 1; 809 809 810 #ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL 810 811 /* update not_parallel if the file was flagged for that. */ 811 if (ran && (file->command_flags & (COMMANDS_NOTPARALLEL | COMMANDS_NO_COMMANDS)) 812 == COMMANDS_NOTPARALLEL) 813 { 814 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s')\n"), not_parallel, 812 if ( ran 813 && (file->command_flags & (COMMANDS_NOTPARALLEL | COMMANDS_NO_COMMANDS)) 814 == COMMANDS_NOTPARALLEL) 815 { 816 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [notice_finished_file]\n"), not_parallel, 815 817 not_parallel - 1, file, file->name)); 816 818 assert(not_parallel >= 1); 817 819 --not_parallel; 818 820 } 821 #endif 819 822 820 823 if (touch_flag … … 936 939 So mark it now as "succeeded". */ 937 940 file->update_status = 0; 938 939 DB (DB_JOBS, (_("notice_finished_file - leaving: file=%p `%s' update_status=%d command_state=%d\n"), file, file->name, file->update_status, file->command_state));940 941 } 941 942 -
trunk/src/gmake/variable.c
r504 r520 167 167 { 168 168 struct variable const *key = (struct variable const *) keyv; 169 #ifdef VARIABLE_HASH 170 # ifdef VARIABLE_HASH_STRICT169 #ifdef VARIABLE_HASH /* bird */ 170 # ifdef VARIABLE_HASH_STRICT 171 171 if (key->hash1 != variable_hash_a (key->name, key->length)) 172 172 __asm__("int3"); 173 173 if (key->hash2 && key->hash2 != variable_hash_b (key->name, key->length)) 174 174 __asm__("int3"); 175 # endif175 # endif 176 176 return key->hash1; 177 177 #else 178 # ifdef KMK178 # ifdef KMK 179 179 return variable_hash_a (key->name, key->length); 180 # else180 # else 181 181 return_STRING_N_HASH_1 (key->name, key->length); 182 # endif182 # endif 183 183 #endif 184 184 } … … 187 187 variable_hash_2 (const void *keyv) 188 188 { 189 #ifdef VARIABLE_HASH 189 #ifdef VARIABLE_HASH /* bird */ 190 190 struct variable *key = (struct variable *) keyv; 191 191 if (!key->hash2) … … 194 194 #else 195 195 struct variable const *key = (struct variable const *) keyv; 196 # ifdef KMK196 # ifdef KMK 197 197 return variable_hash_b (key->name, key->length); 198 # else198 # else 199 199 return_STRING_N_HASH_2 (key->name, key->length); 200 # endif200 # endif 201 201 #endif 202 202 } … … 210 210 if (result) 211 211 return result; 212 #ifdef KMK /* speed */212 #ifdef KMK /* bird: speed */ 213 213 { 214 214 const char *xs = x->name; … … 249 249 } 250 250 #endif /* KMK */ 251 #ifdef VARIABLE_HASH_STRICT 251 #ifdef VARIABLE_HASH_STRICT /* bird */ 252 252 if (x->hash1 != variable_hash_a (x->name, x->length)) 253 253 __asm__("int3"); … … 333 333 var_key.name = (char *) name; 334 334 var_key.length = length; 335 #ifdef VARIABLE_HASH 335 #ifdef VARIABLE_HASH /* bird */ 336 336 var_key.hash1 = variable_hash_a (name, length); 337 337 var_key.hash2 = 0; … … 373 373 v->name = savestring (name, length); 374 374 v->length = length; 375 #ifdef VARIABLE_HASH 375 #ifdef VARIABLE_HASH /* bird */ 376 376 v->hash1 = variable_hash_a (name, length); 377 377 v->hash2 = 0; … … 514 514 var_key.name = (char *) name; 515 515 var_key.length = length; 516 #ifdef VARIABLE_HASH 516 #ifdef VARIABLE_HASH /* bird */ 517 517 var_key.hash1 = variable_hash_a (name, length); 518 518 var_key.hash2 = 0; … … 603 603 var_key.name = (char *) name; 604 604 var_key.length = length; 605 #ifdef VARIABLE_HASH 605 #ifdef VARIABLE_HASH /* bird */ 606 606 var_key.hash1 = variable_hash_a (name, length); 607 607 var_key.hash2 = 0; … … 903 903 (void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0); 904 904 905 #ifdef KMK 905 906 /* Define KMK_VERSION to indicate kMk. */ 906 907 (void) define_variable ("KMK_VERSION", 11, buf, o_default, 0); … … 908 909 /* Define KMK_FEATURES to indicate various working KMK features. */ 909 910 (void) define_variable ("KMK_FEATURES", 12, "abspath toupper tolower", o_default, 0); 911 #endif 910 912 911 913 #ifdef CONFIG_WITH_KMK_BUILTIN … … 1135 1137 makelevel_key.name = MAKELEVEL_NAME; 1136 1138 makelevel_key.length = MAKELEVEL_LENGTH; 1137 #ifdef VARIABLE_HASH 1139 #ifdef VARIABLE_HASH /* bird */ 1138 1140 makelevel_key.hash1 = variable_hash_a (MAKELEVEL_NAME, MAKELEVEL_LENGTH); 1139 1141 makelevel_key.hash2 = 0; -
trunk/src/gmake/variable.h
r503 r520 53 53 char *name; /* Variable name. */ 54 54 int length; /* strlen (name) */ 55 #ifdef VARIABLE_HASH 55 #ifdef VARIABLE_HASH /* bird */ 56 56 long hash1; /* the primary hash */ 57 57 long hash2; /* the secondary hash */ -
trunk/src/gmake/w32/pathstuff.c
r508 r520 16 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ 17 17 18 #include <Windows.h> 18 #include <Windows.h> /* bird */ 19 #include <stdio.h> /* bird */ 19 20 #include <string.h> 20 21 #include <stdlib.h> 21 #include <stdio.h>22 22 #include "make.h" 23 23 #include "pathstuff.h" 24 25 24 26 25 /* … … 83 82 } 84 83 85 /* 84 /* 86 85 * Corrects the case of a path. 87 86 * Expects a fullpath! 88 */ 89 void w32_fixcase(char *pszPath) 87 * Added by bird for the $(abspath ) function and w32ify 88 */ 89 void 90 w32_fixcase(char *pszPath) 90 91 { 91 92 #define my_assert(expr) \ … … 211 212 strncpy(w32_path, filename, sizeof (w32_path)); 212 213 213 w32_fixcase(w32_path); 214 w32_fixcase(w32_path); /* bird */ 214 215 215 216 for (p = w32_path; p && *p; p++) … … 233 234 } 234 235 235 /* Workaround for directory names with trailing slashes. */ 236 /* 237 * Workaround for directory names with trailing slashes. 238 * Added by bird reasons stated. 239 */ 236 240 int 237 241 stat(const char *path, struct stat *st) 238 242 { 239 int rc = _stat(path, st);243 int rc = _stat(path, (struct _stat *)st); 240 244 if ( rc != 0 241 245 && errno == ENOENT … … 251 255 tmp[len_path + 1] = '\0'; 252 256 errno = 0; 253 rc = _stat(tmp, st);257 rc = _stat(tmp, (struct _stat *)st); 254 258 if ( rc == 0 255 259 && !S_ISDIR(st->st_mode))
Note:
See TracChangeset
for help on using the changeset viewer.