VirtualBox

Changeset 520 in kBuild


Ignore:
Timestamp:
Sep 16, 2006 4:56:25 AM (19 years ago)
Author:
bird
Message:

Cleaning up the modifications. Changes are now either configurable or marked, and dead stuff has been removed (dll shell).

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r516 r520  
    11/* $Id$ */
     2
     32006-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).
    27
    382006-09-15:
  • trunk/src/gmake/Makefile.kmk

    r510 r520  
    2121        CONFIG_NO_DEFAULT_SUFFIX_RULES \
    2222        CONFIG_NO_DEFAULT_VARIABLES \
     23    CONFIG_WITH_EXTENDED_NOTPARALLEL \
     24    CONFIG_WITH_TOUPPER_TOLOWER \
    2325        KMK \
    2426        VARIABLE_HASH
     
    187189#                       
    188190config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
     191config.h.win   := config.h.W32
    189192config.h.win32 := config.h.W32
    190193config.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@
    14
    25# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
  • trunk/src/gmake/commands.c

    r503 r520  
    361361      /* check if kmk builtin command */
    362362      if (!strncmp(p, "kmk_builtin_", sizeof("kmk_builtin_") - 1))
    363         flags |= COMMANDS_BUILTIN;
     363        flags |= COMMANDS_KMK_BUILTIN;
    364364#endif
    365365
     
    388388    {
    389389      /* If there are no commands, assume everything worked.  */
     390#ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL
    390391      file->command_flags |= COMMANDS_NO_COMMANDS;
     392#endif
    391393      set_command_state (file, cs_running);
    392394      file->update_status = 0;
  • trunk/src/gmake/commands.h

    r503 r520  
    3535#define COMMANDS_SILENT         2 /* Silent: @.  */
    3636#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
    4044
    4145extern 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.
    16
    27timestamp='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.
    16
    27timestamp='2006-03-07'
  • trunk/src/gmake/debug.h

    r503 r520  
    2222#define DB_IMPLICIT     (0x008)
    2323#define DB_MAKEFILES    (0x100)
    24 #define DB_KMK          (0x800)
     24#ifdef KMK
     25# define DB_KMK         (0x800)
     26#endif
    2527
    2628#define DB_ALL          (0xfff)
     
    2830extern int db_level;
    2931
     32#ifdef KMK
     33
     34/* Some extended info for -j and .NOTPARALLEL tracking. */
    3035extern unsigned int makelevel;
    3136extern unsigned int job_slots;
    3237extern unsigned int job_slots_used;
    33 
    3438
    3539#define DB_HDR()    do { printf ("[%u:%u/%u]", makelevel, job_slots_used, job_slots); } while (0)
     
    4751
    4852#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  
    738738    }
    739739
    740   /* kmk changed */
    741740  f = lookup_file (".NOTPARALLEL");
    742741  if (f != 0 && f->is_target)
     742#ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL
     743    not_parallel = 1;
     744#else /* CONFIG_WITH_EXTENDED_NOTPARALLEL */
    743745    {
    744746      if (f->deps == 0)
     
    752754            f2->command_flags |= COMMANDS_NOTPARALLEL;
    753755    }
     756#endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */
    754757
    755758#ifndef NO_MINUS_C_MINUS_O
  • trunk/src/gmake/function.c

    r503 r520  
    2929#endif
    3030
    31 #ifdef WINDOWS32
    32 #include "pathstuff.h"
     31#ifdef WINDOWS32 /* bird */
     32# include "pathstuff.h"
    3333#endif
    3434
     
    16651665  CLOSE_ON_EXEC(pipedes[0]);
    16661666  /* 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);
    16681668  if (pid < 0)
    16691669    perror_with_name (error_prefix, "spawn");
     
    19001900    return NULL;
    19011901
    1902 #ifdef WINDOWS32
     1902#ifdef WINDOWS32                                                    /* bird */
    19031903  dest = w32ify((char *)name, 1);
    19041904  if (!dest)
    1905       return NULL;
     1905    return NULL;
    19061906  {
    19071907  size_t len = strlen(dest);
     
    19121912  (void)end; (void)start; (void)apath_limit;
    19131913
    1914 #elif defined __OS2__
     1914#elif defined __OS2__                                               /* bird */
    19151915  if (_abspath(apath, name, GET_PATH_MAX))
    1916       return NULL;
     1916    return NULL;
    19171917  dest = strchr(apath, '\0');
    19181918
     
    19891989
    19901990  /* Unless it is root strip trailing separator.  */
    1991 #ifdef HAVE_DOS_PATHS
     1991#ifdef HAVE_DOS_PATHS /* bird (is this correct? what about UNC?) */
    19921992  if (dest > apath + 1 + (apath[0] != '/') && dest[-1] == '/')
    19931993#else
     
    20772077}
    20782078
    2079 #ifdef KMK
     2079#ifdef CONFIG_WITH_TOUPPER_TOLOWER
    20802080static char *
    20812081func_toupper_tolower (char *o, char **argv, const char *funcname)
     
    20992099  return o;
    21002100}
    2101 #endif
     2101#endif /* CONFIG_WITH_TOUPPER_TOLOWER */
    21022102
    21032103/* Lookup table for builtin functions.
     
    21582158  { STRING_SIZE_TUPLE("not"),           0,  1,  1,  func_not},
    21592159#endif
    2160 #ifdef KMK
     2160#ifdef CONFIG_WITH_TOUPPER_TOLOWER
    21612161  { STRING_SIZE_TUPLE("toupper"),       0,  1,  1,  func_toupper_tolower},
    21622162  { STRING_SIZE_TUPLE("tolower"),       0,  1,  1,  func_toupper_tolower},
  • trunk/src/gmake/job.c

    r516 r520  
    2828#include "debug.h"
    2929#ifdef CONFIG_WITH_KMK_BUILTIN
    30 #include "kmkbuiltin.h"
     30# include "kmkbuiltin.h"
    3131#endif
    3232
    3333
    3434#include <string.h>
    35 
    36 #ifdef MAKE_DLLSHELL
    37 #include <dlfcn.h>
    38 #endif
    3935
    4036/* Default shell to use.  */
     
    6460#elif defined (__EMX__)
    6561
    66 char *default_shell = "sh.exe";
     62char *default_shell = "sh.exe"; /* bird changed this from "/bin/sh" as that doesn't make sense on OS/2. */
    6763int batch_mode_shell = 0;
    6864
     
    210206static int job_next_command PARAMS ((struct child *));
    211207static int start_waiting_job PARAMS ((struct child *));
    212 #ifdef MAKE_DLLSHELL
    213 static int spawn_command PARAMS ((char **argv, char **envp, struct child *child));
    214 #endif
    215208
    216209
     
    492485      int any_remote, any_local;
    493486      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;
    496489#endif
    497490
     
    534527          any_remote |= c->remote;
    535528          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            {
    538532              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
    539539#endif
    540540          DB (DB_JOBS, (_("Live child 0x%08lx (%s) PID %ld %s\n"),
     
    564564        {
    565565          /* No remote children.  Check for local children.  */
    566 #if defined(CONFIG_WITH_KMK_BUILTIN) || defined(MAKE_DLLSHELL)
     566#ifdef CONFIG_WITH_KMK_BUILTIN
    567567          if (completed_child)
    568568            {
     
    577577            }
    578578          else
    579 #endif
     579#endif /* CONFIG_WITH_KMK_BUILTIN */
    580580#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
    581581          if (any_local)
     
    584584              vmsWaitForChildren (&status);
    585585              pid = c->pid;
    586 #elif MAKE_DLLSHELL
    587               pid = wait_jobs((int*)&status, block);
    588586#else
    589587#ifdef WAIT_NOHANG
     
    10391037        child->noerror = 1;
    10401038      else if (!isblank ((unsigned char)*p))
     1039#ifndef CONFIG_WITH_KMK_BUILTIN
     1040        break;
     1041#else  /* CONFIG_WITH_KMK_BUILTIN */
     1042
    10411043        {
    1042 #ifdef CONFIG_WITH_KMK_BUILTIN
    1043           if (   !(flags & COMMANDS_BUILTIN)
     1044          if (   !(flags & COMMANDS_KMK_BUILTIN)
    10441045              && !strncmp(p, "kmk_builtin_", sizeof("kmk_builtin_") - 1))
    1045             flags |= COMMANDS_BUILTIN;
    1046 #endif /* CONFIG_WITH_KMK_BUILTIN */
     1046            flags |= COMMANDS_KMK_BUILTIN;
    10471047          break;
    10481048        }
     1049#endif /* CONFIG_WITH_KMK_BUILTIN */
    10491050      ++p;
    10501051    }
     
    10581059  child->file->cmds->lines_flags[child->command_line - 1]
    10591060#ifdef CONFIG_WITH_KMK_BUILTIN
    1060     |= flags & (COMMANDS_RECURSE | COMMANDS_BUILTIN);
     1061    |= flags & (COMMANDS_RECURSE | COMMANDS_KMK_BUILTIN);
    10611062#else
    10621063    |= flags & COMMANDS_RECURSE;
     
    11841185  /* If builtin command then pass it on to the builtin shell interpreter. */
    11851186
    1186   if ((flags & COMMANDS_BUILTIN) && !just_print_flag)
     1187  if ((flags & COMMANDS_KMK_BUILTIN) && !just_print_flag)
    11871188    {
    11881189      int    rc;
     
    12091210      child->pid = (pid_t)42424242;
    12101211      child->status = rc << 8;
    1211       child->have_status = 1;
     1212      child->has_status = 1;
    12121213      return;
    12131214    }
     
    13231324      /* Never use fork()/exec() here! Use spawn() instead in exec_command() */
    13241325      child->pid = child_execute_job (child->good_stdin ? 0 : bad_stdin, 1,
    1325                                       argv, child->environment, child);
     1326                                      argv, child->environment);
    13261327      if (child->pid < 0)
    13271328        {
     
    15061507{
    15071508  struct file *f = c->file;
     1509#ifdef DB_KMK
    15081510  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
    15091512
    15101513  /* If we can start a job remotely, we always want to, and don't care about
     
    15141517  c->remote = start_remote_job_p (1);
    15151518
     1519#ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL
    15161520  if (c->file->command_flags & COMMANDS_NOTPARALLEL)
    15171521    {
    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);
    15191525      ++not_parallel;
    15201526    }
     1527#endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */
    15211528
    15221529  /* If we are running at least one job already and the load average
    15231530     is too high, make this one wait.  */
    15241531  if (!c->remote
     1532#ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL
    15251533      && ((job_slots_used > 0 && (not_parallel > 0 || load_too_high ()))
     1534#else
     1535      && ((job_slots_used > 0 && load_too_high ())
     1536#endif
    15261537#ifdef WINDOWS32
    15271538          || (process_used_slots () >= MAXIMUM_WAIT_OBJECTS)
     
    15291540          ))
    15301541    {
     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
    15311551      /* 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.  */
    15331553      set_command_state (f, cs_running);
    15341554      c->next = waiting_jobs;
     
    15411561          prev->next = c;
    15421562        }
    1543       else
     1563      else /* FIXME: insert after the last node with COMMANDS_NOTPARALLEL set */
    15441564        waiting_jobs = c;
    15451565      DB (DB_KMK, (_("queued child %p (`%s')\n"), c, c->file->name));
     1566#endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */
    15461567      return 0;
    15471568    }
    1548 
    15491569
    15501570  /* Start the first command; reap_children will run later command lines.  */
     
    15551575    case cs_running:
    15561576      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"),
    15581578                    (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)") : ""));
    15601580      children = c;
    15611581      /* One more job slot is in use.  */
     
    18301850  (void) start_waiting_job (c);
    18311851
    1832   if (job_slots == 1 || not_parallel > 0)
     1852#ifndef CONFIG_WITH_EXTENDED_NOTPARALLEL
     1853  if (job_slots == 1 || not_parallel)
    18331854    /* Since there is only one job slot, make things run linearly.
    18341855       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)
    18381857      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 */
    18391878
    18401879  return;
     
    19872026      waiting_jobs = job->next;
    19882027
    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. */
    19902032      if (job->file->command_flags & COMMANDS_NOTPARALLEL)
    19912033        {
    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);
    19932037          --not_parallel;
    19942038        }
     2039#endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */
    19952040
    19962041      /* Try to start that job.  We break out of the loop as soon
     
    20062051
    20072052/* 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 is
    2009    and the shell is a dllshell:// a child structure is created and inserted
    2010    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_job
    2013    would perhaps be more appropriate. */
    20142053# if defined __MSDOS__ || defined __EMX__
    20152054int
    2016 child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp,
    2017                    struct child *child)
     2055child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp)
    20182056{
    20192057  int pid;
     
    20482086    CLOSE_ON_EXEC (stdout_fd);
    20492087
    2050 #ifdef MAKE_DLLSHELL
    2051   pid = spawn_command(argv, envp, child);
    2052 #else
    20532088  /* Run the command.  */
    20542089  pid = exec_command (argv, envp);
    2055 #endif
    20562090
    20572091  /* Restore stdout/stdin of the parent and close temporary FDs.  */
     
    20982132#endif /* !AMIGA && !__MSDOS__ && !VMS */
    20992133#endif /* !WINDOWS32 */
    2100 
    2101 
    2102 #ifdef MAKE_DLLSHELL
    2103 /* 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 the
    2112    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 the
    2116      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   else
    2184     {
    2185       /* Run the command.  */
    2186 #ifdef __EMX__
    2187       c->pid =
    2188         exec_command (argv, envp);
    2189 #else
    2190 # error MAKE_DLLSHELL is not ported to your platform yet.
    2191 #endif
    2192       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 return
    2200    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   else
    2210     {
    2211       if (block)
    2212         pid = WAIT_NOHANG(status);
    2213       else
    2214         pid = wait(status);
    2215     }
    2216   return pid;
    2217 }
    2218 
    2219 #endif /* MAKE_DLLSHELL */
    22202134
    22212135
     
    26332547#else  /* !__MSDOS__ */
    26342548  else if (strcmp (shell, default_shell))
     2549# ifndef KMK
     2550    goto slow;
     2551#else /* KMK */
    26352552    {
    26362553      /* Allow ash from kBuild. */
    26372554      const char *psz = strstr(shell, "/kmk_ash");
    26382555      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 */
    26422560#endif /* !__MSDOS__ && !__EMX__ */
    26432561#endif /* not WINDOWS32 */
     
    32893207  }
    32903208#if defined(CONFIG_WITH_KMK_BUILTIN) && defined(WINDOWS32)
     3209  /* On windows we have to avoid batch mode for builtin commands. */
    32913210  if (!strncmp(line, "kmk_builtin_", sizeof("kmk_builtin_") - 1))
    32923211  {
  • trunk/src/gmake/job.h

    r503 r520  
    5656#endif
    5757    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
    5959    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. */
    6461#endif
    6562    unsigned int remote:1;      /* Nonzero if executing remotely.  */
     
    8178#ifdef VMS
    8279extern 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__)
     81extern int child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp));
    8582#else
    8683extern void child_execute_job PARAMS ((int stdin_fd, int stdout_fd, char **argv, char **envp));
     
    110107extern unsigned int jobserver_tokens;
    111108
    112 #ifdef MAKE_DLLSHELL
    113 extern pid_t wait_jobs PARAMS ((int *status, int block));
    114 #endif
    115 
    116109#endif /* SEEN_JOB_H */
  • trunk/src/gmake/main.c

    r506 r520  
    494494int second_expansion;
    495495
    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 */
    500514
    501515int not_parallel;
     
    633647              db_level |= DB_BASIC | DB_VERBOSE;
    634648              break;
     649#ifdef DB_KMK
    635650            case 'k':
    636651              db_level |= DB_KMK;
    637652              break;
     653#endif
    638654            default:
    639655              fatal (NILF, _("unknown debug level specification `%s'"), p);
     
    21012117            int pid;
    21022118            int status;
    2103             pid = child_execute_job (0, 1, nargv, environ, NULL);
     2119            pid = child_execute_job (0, 1, nargv, environ);
    21042120
    21052121            /* is this loop really necessary? */
     
    27382754                           *(unsigned int *) cs->noarg_value))
    27392755                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. */
    27412756              else if (cs->c == 'j')
    27422757                /* Special case for `-j'.  */
    27432758                ADD_FLAG ("1", 1);
    2744 #endif
    27452759              else
    27462760                {
  • trunk/src/gmake/make.h

    r507 r520  
    4141
    4242/* Use prototypes if available.  */
    43 #if defined (__cplusplus) || defined (__STDC__) || defined WINDOWS32
     43#if defined (__cplusplus) || defined (__STDC__) || defined WINDOWS32 /* bird: protos on windows */
    4444# undef  PARAMS
    4545# define PARAMS(protos)  protos
     
    425425extern char *end_of_token PARAMS ((const char *));
    426426extern void collapse_continuations PARAMS ((char *));
    427 #ifdef KMK
     427#if 1 /* memchr is usually compiler intrinsic, thus faster. */
    428428#define lindex(s, limit, c) ((char *)memchr((s), (c), (limit) - (s)))
    429429#else
     
    615615                               while (((_v)=_c)==0 && errno==EINTR); }while(0)
    616616
    617 #ifdef __EMX__ /* saves 40-100ms on libc. */
     617#ifdef __EMX__ /* bird: saves 40-100ms on libc. */
    618618#undef strchr
    619619#define strchr(s, c) \
     
    700700}
    701701
    702 #endif
     702#endif /* __EMX__ (bird) */
  • trunk/src/gmake/misc.c

    r503 r520  
    2121#include "debug.h"
    2222
    23 #ifdef __EMX__  /* saves 5-10ms on libc */
     23#ifdef __EMX__  /* bird: saves 5-10ms on libc */
    2424# define bcopy(src, dst, size)   __builtin_memcpy((dst), (src), (size))
    2525#endif
     
    406406
    407407
    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. */
    409410/* Limited INDEX:
    410411   Search through the string STRING, which ends at LIMIT, for the character C.
  • trunk/src/gmake/read.c

    r509 r520  
    223223#ifdef VMS
    224224        /* all lower case since readdir() (the vms version) 'lowercasifies' */
     225# ifdef KMK
    225226        { "makefile.kmk", "makefile.vms", "gnumakefile.", "makefile.", 0 };
     227# else
     228        { "makefile.vms", "gnumakefile.", "makefile.", 0 };
     229# endif
    226230#else
    227231#ifdef _AMIGA
    228232        /* what's the deal here? no dots? */
     233# ifdef KMK
    229234        { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "Makefile", "SMakefile", 0 };
     235# else
     236        { "GNUmakefile", "Makefile", "SMakefile", 0 };
     237# endif
    230238#else /* !Amiga && !VMS */
     239# ifdef KMK
    231240        { "Makefile.kmk", "makefile.kmk", "GNUmakefile", "makefile", "Makefile", 0 };
     241# else
     242        { "GNUmakefile", "makefile", "Makefile", 0 };
     243# endif
    232244#endif /* AMIGA */
    233245#endif /* VMS */
     
    11571169              fatal (fstart, _("missing target pattern"));
    11581170            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 */
    11601172            pattern = target->name;
    11611173            pattern_percent = find_percent (pattern);
    11621174            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 */
    11641176            free ((char *)target);
    11651177          }
     
    21562168  unsigned int string_len = 0;
    21572169  register char *p = string;
    2158   register int ch; /* bird */
     2170  register int ch; /* bird: 'optimiziations' */
    21592171
    21602172  if (ignorevars)
     
    22692281  struct nameseq *new = 0;
    22702282  struct nameseq *new1;
    2271 #ifndef NO_ARCHIVES
     2283#ifndef NO_ARCHIVES /* bird: MSC warning */
    22722284  struct nameseq *lastnew1;
    22732285#endif
  • trunk/src/gmake/remake.c

    r503 r520  
    803803  int ran = file->command_state == cs_running;
    804804  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 */
    806806                  file, file->name, file->update_status, file->command_state));
    807807  file->command_state = cs_finished;
    808808  file->updated = 1;
    809809
     810#ifdef CONFIG_WITH_EXTENDED_NOTPARALLEL
    810811  /* 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,
    815817                   not_parallel - 1, file, file->name));
    816818      assert(not_parallel >= 1);
    817819      --not_parallel;
    818820    }
     821#endif
    819822
    820823  if (touch_flag
     
    936939       So mark it now as "succeeded".  */
    937940    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));
    940941}
    941942
  • trunk/src/gmake/variable.c

    r504 r520  
    167167{
    168168  struct variable const *key = (struct variable const *) keyv;
    169 #ifdef VARIABLE_HASH
    170 #ifdef VARIABLE_HASH_STRICT
     169#ifdef VARIABLE_HASH /* bird */
     170# ifdef VARIABLE_HASH_STRICT
    171171  if (key->hash1 != variable_hash_a (key->name, key->length))
    172172    __asm__("int3");
    173173  if (key->hash2 && key->hash2 != variable_hash_b (key->name, key->length))
    174174    __asm__("int3");
    175 #endif
     175# endif
    176176  return key->hash1;
    177177#else
    178 #ifdef KMK
     178# ifdef KMK
    179179  return variable_hash_a (key->name, key->length);
    180 #else
     180# else
    181181  return_STRING_N_HASH_1 (key->name, key->length);
    182 #endif
     182# endif
    183183#endif
    184184}
     
    187187variable_hash_2 (const void *keyv)
    188188{
    189 #ifdef VARIABLE_HASH
     189#ifdef VARIABLE_HASH /* bird */
    190190  struct variable *key = (struct variable *) keyv;
    191191  if (!key->hash2)
     
    194194#else
    195195  struct variable const *key = (struct variable const *) keyv;
    196 #ifdef KMK
     196# ifdef KMK
    197197  return variable_hash_b (key->name, key->length);
    198 #else
     198# else
    199199  return_STRING_N_HASH_2 (key->name, key->length);
    200 #endif
     200# endif
    201201#endif
    202202}
     
    210210  if (result)
    211211    return result;
    212 #ifdef KMK /* speed */
     212#ifdef KMK /* bird: speed */
    213213  {
    214214    const char *xs = x->name;
     
    249249  }
    250250#endif /* KMK */
    251 #ifdef VARIABLE_HASH_STRICT
     251#ifdef VARIABLE_HASH_STRICT /* bird */
    252252  if (x->hash1 != variable_hash_a (x->name, x->length))
    253253    __asm__("int3");
     
    333333  var_key.name = (char *) name;
    334334  var_key.length = length;
    335 #ifdef VARIABLE_HASH
     335#ifdef VARIABLE_HASH /* bird */
    336336  var_key.hash1 = variable_hash_a (name, length);
    337337  var_key.hash2 = 0;
     
    373373  v->name = savestring (name, length);
    374374  v->length = length;
    375 #ifdef VARIABLE_HASH
     375#ifdef VARIABLE_HASH /* bird */
    376376  v->hash1 = variable_hash_a (name, length);
    377377  v->hash2 = 0;
     
    514514  var_key.name = (char *) name;
    515515  var_key.length = length;
    516 #ifdef VARIABLE_HASH
     516#ifdef VARIABLE_HASH /* bird */
    517517  var_key.hash1 = variable_hash_a (name, length);
    518518  var_key.hash2 = 0;
     
    603603  var_key.name = (char *) name;
    604604  var_key.length = length;
    605 #ifdef VARIABLE_HASH
     605#ifdef VARIABLE_HASH /* bird */
    606606  var_key.hash1 = variable_hash_a (name, length);
    607607  var_key.hash2 = 0;
     
    903903  (void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);
    904904
     905#ifdef KMK
    905906  /* Define KMK_VERSION to indicate kMk. */
    906907  (void) define_variable ("KMK_VERSION", 11, buf, o_default, 0);
     
    908909  /* Define KMK_FEATURES to indicate various working KMK features. */
    909910  (void) define_variable ("KMK_FEATURES", 12, "abspath toupper tolower", o_default, 0);
     911#endif
    910912
    911913#ifdef CONFIG_WITH_KMK_BUILTIN
     
    11351137  makelevel_key.name = MAKELEVEL_NAME;
    11361138  makelevel_key.length = MAKELEVEL_LENGTH;
    1137 #ifdef VARIABLE_HASH
     1139#ifdef VARIABLE_HASH /* bird */
    11381140  makelevel_key.hash1 = variable_hash_a (MAKELEVEL_NAME, MAKELEVEL_LENGTH);
    11391141  makelevel_key.hash2 = 0;
  • trunk/src/gmake/variable.h

    r503 r520  
    5353    char *name;                 /* Variable name.  */
    5454    int length;                 /* strlen (name) */
    55 #ifdef VARIABLE_HASH
     55#ifdef VARIABLE_HASH /* bird */
    5656    long hash1;                 /* the primary hash */
    5757    long hash2;                 /* the secondary hash */
  • trunk/src/gmake/w32/pathstuff.c

    r508 r520  
    1616Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
    1717
    18 #include <Windows.h>
     18#include <Windows.h> /* bird */
     19#include <stdio.h>   /* bird */
    1920#include <string.h>
    2021#include <stdlib.h>
    21 #include <stdio.h>
    2222#include "make.h"
    2323#include "pathstuff.h"
    24 
    2524
    2625/*
     
    8382}
    8483
    85 /*
     84/* 
    8685 * Corrects the case of a path.
    8786 * Expects a fullpath!
    88  */
    89 void w32_fixcase(char *pszPath)
     87 * Added by bird for the $(abspath ) function and w32ify
     88 */
     89void
     90w32_fixcase(char *pszPath)
    9091{
    9192#define my_assert(expr) \
     
    211212        strncpy(w32_path, filename, sizeof (w32_path));
    212213
    213     w32_fixcase(w32_path);
     214    w32_fixcase(w32_path); /* bird */
    214215
    215216    for (p = w32_path; p && *p; p++)
     
    233234}
    234235
    235 /* Workaround for directory names with trailing slashes. */
     236/*
     237 * Workaround for directory names with trailing slashes.
     238 * Added by bird reasons stated.
     239 */
    236240int
    237241stat(const char *path, struct stat *st)
    238242{
    239     int rc = _stat(path, st);
     243    int rc = _stat(path, (struct _stat *)st);
    240244    if (    rc != 0
    241245        &&  errno == ENOENT
     
    251255            tmp[len_path + 1] = '\0';
    252256            errno = 0;
    253             rc = _stat(tmp, st);
     257            rc = _stat(tmp, (struct _stat *)st);
    254258            if (    rc == 0
    255259                &&  !S_ISDIR(st->st_mode))
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette