[gnu.utils.bug] Bringing GNU Make 3.54 up on SYS V Rel.2

ra@is.uu.no (Robert Andersson) (07/04/89)

The following sums up what I had to do to get GNU Make 3.54 up and
running on an NCR Tower 32/400, OS Release 2.01.00 (aka SYSV.2).
Context diffs follow at the end of the message.

The final result seems ok, though I have not tested it thoroughly yet.
On the disappointing side.... GNU Make uses more time than SYSV Make
to do its job, both on sys, user and elapsed time. This came as a
surprise, and makes me wonder if GNU Make could do with a bit of
profiling?


Makefile:   LOADLIBES = -lPW              (alloca is in libPW.a)
	    LOAD_AVG  = -DNO_LDAV         (No such thing on SYSV)
	    defines   = -DUSG -DDIRLIB    (DIRLIB is a new define I invented
					   to tell GNU Make that I am using
					   the Public Domain directory routi-
					   nes made by Doug Gwyn)

glob.c:     If defined(USGr3) || defined(DIRLIB) -> Use directory routines.
	    USG: Added missing #define of rindex
	         Removed declaration of memcpy (since it is in memory.h anyway)

job.c:      USG: If USGr3 is not defined, include <errno.h>
                 Added declaration of child_handler before it was used.
                 Must not use getdtablesize, use _NFILE instead.

read.c:     Added declaration of struct passwd *getpwnam();

commands.c: USG: Must not use sigmask().

dir.c:      If defined(USGr3) || defined(DIRLIB) -> Use directory routines.

remote.c:   Change remote-customs.c to remote-cust.c

Renamed remote-customs.c to remote-cust.c (Because of 14 char filename limit)


*** glob.c.orig	Mon Jul  3 14:42:32 1989
--- glob.c	Mon Jul  3 18:25:47 1989
***************
*** 21,31 ****
  
  #include <sys/types.h>
  
! #ifdef	USGr3
  #include <dirent.h>
  #define direct dirent
  #define	D_NAMLEN(d) strlen((d)->d_name)
! #else	/* not USGr3	*/
  #define D_NAMLEN(d) ((d)->d_namlen)
  #	ifdef	USG
  #include "ndir.h"   /* Get ndir.h from the Emacs distribution.  */
--- 21,31 ----
  
  #include <sys/types.h>
  
! #if defined(USGr3) || defined(DIRLIB)
  #include <dirent.h>
  #define direct dirent
  #define	D_NAMLEN(d) strlen((d)->d_name)
! #else	/* not USGr3 || DIRLIB */
  #define D_NAMLEN(d) ((d)->d_namlen)
  #	ifdef	USG
  #include "ndir.h"   /* Get ndir.h from the Emacs distribution.  */
***************
*** 32,45 ****
  #	else	/* not USG	*/
  #include <sys/dir.h>
  #	endif	/* USG		*/
! #endif	/* USGr3	*/
  
  #ifdef USG
  #include <memory.h>
  #include <string.h>
  #define bcopy(s, d, n) ((void) memcpy ((d), (s), (n)))
  
- extern char *memcpy ();
  #else /* not USG */
  #include <strings.h>
  
--- 32,45 ----
  #	else	/* not USG	*/
  #include <sys/dir.h>
  #	endif	/* USG		*/
! #endif	/* USGr3 || DIRLIB */
  
  #ifdef USG
  #include <memory.h>
  #include <string.h>
  #define bcopy(s, d, n) ((void) memcpy ((d), (s), (n)))
+ #define rindex(s, c) strrchr((s), (c))
  
  #else /* not USG */
  #include <strings.h>
  

*** job.c.orig	Mon Jul  3 14:51:23 1989
--- job.c	Mon Jul  3 15:14:36 1989
***************
*** 59,64 ****
--- 59,69 ----
  #endif	/* USG and don't have <sys/wait.h>.  */
  
  
+ #if	defined(USG) && !defined(USGr3)
+ #include <errno.h>
+ #endif
+ 
+ 
  extern int fork (), wait (), kill (), getpid ();
  extern void _exit ();
  
***************
*** 141,146 ****
--- 146,152 ----
  unblock_children ()
  {
  #ifdef	USG
+   int child_handler();
    (void) signal (SIGCLD, child_handler);
  #else
    (void) sigsetmask (sigblock (0) & ~sigmask (SIGCHLD));
***************
*** 555,561 ****
--- 561,571 ----
  	  /* Free up file descriptors.  */
  	  {
  	    register int d;
+ #ifdef USG
+             int max = _NFILE;    /* This should be defined in stdio.h */
+ #else
  	    int max = getdtablesize ();
+ #endif
  	    for (d = 3; d < max; ++d)
  	      (void) close (d);
  	  }


*** read.c.orig	Mon Jul  3 15:09:48 1989
--- read.c	Mon Jul  3 15:10:10 1989
***************
*** 22,27 ****
--- 22,28 ----
  #include "variable.h"
  
  #include <pwd.h>
+ struct passwd *getpwnam();
  
  
  static void read_makefile ();


*** commands.c.orig	Mon Jul  3 15:12:20 1989
--- commands.c	Mon Jul  3 15:31:25 1989
***************
*** 375,382 ****
--- 375,384 ----
    return 0;
  }
  
+ #ifndef USG
  #define	PROPAGATED_SIGNAL_MASK \
    (sigmask (SIGTERM) | sigmask (SIGINT) | sigmask (SIGHUP) | sigmask (SIGQUIT))
+ #endif
  
  /* Handle fatal signals.  */
  
***************
*** 405,411 ****
--- 407,417 ----
    /* If we got a signal that means the user
       wanted to kill make, remove pending targets.  */
  
+ #ifndef USG
    if (PROPAGATED_SIGNAL_MASK & sigmask (sig))
+ #else
+   if (sig == SIGTERM || sig == SIGINT || sig == SIGHUP || sig == SIGQUIT)
+ #endif
      {
        register struct child *c;
        block_children ();


*** dir.c.orig	Mon Jul  3 18:23:23 1989
--- dir.c	Mon Jul  3 18:25:07 1989
***************
*** 17,27 ****
  
  #include "make.h"
  
! #ifdef	USGr3
  #include <dirent.h>
  #define direct dirent
  #define	D_NAMLEN(d) strlen((d)->d_name)
! #else	/* Not USGr3.  */
  #define D_NAMLEN(d) ((d)->d_namlen)
  #	ifdef	USG
  #include "ndir.h"   /* Get ndir.h from the Emacs distribution.  */
--- 17,27 ----
  
  #include "make.h"
  
! #if defined(USGr3) || defined(DIRLIB)
  #include <dirent.h>
  #define direct dirent
  #define	D_NAMLEN(d) strlen((d)->d_name)
! #else	/* Not USGr3 || DIRLIB  */
  #define D_NAMLEN(d) ((d)->d_namlen)
  #	ifdef	USG
  #include "ndir.h"   /* Get ndir.h from the Emacs distribution.  */
***************
*** 28,34 ****
  #	else	/* Not USG.  */
  #include <sys/dir.h>
  #	endif	/* USG.  */
! #endif	/* USGr3.  */
  
  
  /* Hash table of directories.  */
--- 28,34 ----
  #	else	/* Not USG.  */
  #include <sys/dir.h>
  #	endif	/* USG.  */
! #endif	/* USGr3 || DIRLIB  */
  
  
  /* Hash table of directories.  */
-- 
Robert Andersson, International Systems, Oslo, Norway
Internet:         ra@is.uu.no
UUCP:             ...!{uunet,mcvax,ifi}!is.uu.no!ra