]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Update support for OS/2
authorPaul Smith <psmith@gnu.org>
Sun, 8 Jan 2023 23:44:25 +0000 (18:44 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 8 Jan 2023 23:44:25 +0000 (18:44 -0500)
Patches provided by KO Myung-Hun <komh78@gmail.com>

* NEWS: Add a note.
* AUTHORS: Add a new author.
* README.OS2: Updates to build instructions.
* src/dir.c (dir_contents_file_exists_p): Use a stack copy when
modifying a const string.
* src/job.c (construct_command_argv_internal): Ditto.
Reuse variables rather than re-defining them.
(exec_command): Cast a const string (we don't change it anyway).
* src/getopt.c (_getopt_initialize): Reference unused variables.
(_getopt_internal): Add block braces to quiet the compiler.
* src/main.c (main): Cast argument to child_execute_job().
* src/posixos.c (set_blocking): Reference unused variables.
* src/remake.c (f_mtime): Delete useless code.

AUTHORS
NEWS
README.OS2
src/dir.c
src/getopt.c
src/job.c
src/main.c
src/posixos.c
src/remake.c

diff --git a/AUTHORS b/AUTHORS
index 9be617308938e2f9e1ab45e2d99f8068292569f4..5db6fe3644bd1f51eef6c89de2ea83071c21c557 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -47,6 +47,7 @@ GNU Make porting efforts:
       Earnie Boyd <earnie@uses.sf.net>
       Troy Runkel <Troy.Runkel@mathworks.com>
       Juan M. Guerrero <juan.guerrero@gmx.de>
+      KO Myung-Hun <komh78@gmail.com>
 
   Port to z/OS by:
       Igor Todorovski <itodorov@ca.ibm.com>
diff --git a/NEWS b/NEWS
index 20bb26eab7993c6dfac02c10c09e302eee9c7695..592a3418ede95676e764f7967b4c6a615330ae01 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,9 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=110&se
   private parent target-specific variables have no affect.  For more details
   see https://savannah.gnu.org/bugs/index.php?61463
 
+* Updates to allow building on OS/2
+  Provided by KO Myung-Hun <komh78@gmail.com>
+
 \f
 Version 4.4 (31 Oct 2022)
 
index 1da9528fadbbd2c1e323227044164862df01490d..b4c8daccbad6f9dd65fed5be5295be2ffda860c1 100644 (file)
@@ -73,7 +73,7 @@ III. ***** COMPILATION AND INSTALLATION *****
     To recreate the configuration files use:
 
       export EMXSHELL=ksh
-      aclocal -I config
+      aclocal -I m4
       automake
       autoconf
       autoheader
@@ -93,7 +93,7 @@ Recommended environment variables and installation options:
     export CFLAGS="-O2 -Zomf -Zmt"
     export LDFLAGS="-Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000"
     export RANLIB="echo"
-    ./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man --without-included-gettext
+    ./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man
     make AR=emxomfar
     make install
 
@@ -102,6 +102,9 @@ Note: If you use gcc 2.9.x I recommend to set also LIBS="-lgcc"
 Note: You can add -DNO_CMD_DEFAULT and -DNO_CHDIR2 to CPPFLAGS.
       See section I. for details.
 
+Note: If you use Open Watcom Linker instead of IBM Linker, remove
+      '-Zlinker /exepack:2' from LDFLAGS.
+
 
 IV. ***** NLS support *****
 
index aa50db6c77510d2dbc52dffee63c0b918bf4f2a5..3e94b98ed5411313683e48405f860c188ffa75cd 100644 (file)
--- a/src/dir.c
+++ b/src/dir.c
@@ -659,7 +659,13 @@ dir_contents_file_exists_p (struct directory *dir,
 
 #ifdef __EMX__
   if (filename != NULL)
-    _fnlwr (filename); /* lower case for FAT drives */
+    {
+      size_t len = strlen (filename);
+      char *fname = alloca (len + 1);
+      memcpy (fname, filename, len + 1);
+      _fnlwr (fname); /* lower case for FAT drives */
+      filename = fname;
+    }
 #endif
   if (filename != NULL)
     {
index bc1f1cafc421211c07f36dbdeb7f0f8d01a8cd90..7a792de88a618fc617daf7601a5532f37b3bd977 100644 (file)
@@ -436,6 +436,10 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
     nonoption_flags_len = 0;
 #endif
 
+  /* Make the compiler happy.  */
+  (void)argc;
+  (void)argv;
+
   return optstring;
 }
 \f
@@ -677,17 +681,18 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
              else
                {
                  if (opterr)
-                  if (argv[optind - 1][1] == '-')
-                   /* --option */
-                   fprintf (stderr,
-                    _("%s: option '--%s' doesn't allow an argument\n"),
-                    argv[0], pfound->name);
-                  else
-                   /* +option or -option */
-                   fprintf (stderr,
-                    _("%s: option '%c%s' doesn't allow an argument\n"),
-                    argv[0], argv[optind - 1][0], pfound->name);
-
+                   {
+                     if (argv[optind - 1][1] == '-')
+                       /* --option */
+                       fprintf (stderr,
+                                _("%s: option '--%s' doesn't allow an argument\n"),
+                                argv[0], pfound->name);
+                     else
+                       /* +option or -option */
+                       fprintf (stderr,
+                                _("%s: option '%c%s' doesn't allow an argument\n"),
+                                argv[0], argv[optind - 1][0], pfound->name);
+                   }
                  nextchar += strlen (nextchar);
 
                  optopt = pfound->val;
index 3fab80120d7dc8aeb4862727bcc7a58faf9cc6d3..7533553ffe914cd627843658ea78db06bc782f06 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -2641,7 +2641,7 @@ exec_command (char **argv, char **envp)
 # ifdef __EMX__
         if (!unixy_shell)
           {
-            new_argv[1] = "/c";
+            new_argv[1] = (char *)"/c";
             ++i;
             --argc;
           }
@@ -3270,7 +3270,13 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
 
 # ifdef __EMX__ /* is this necessary? */
     if (!unixy_shell && shellflags)
-      shellflags[0] = '/'; /* "/c" */
+      {
+        size_t len = strlen (shellflags);
+        char *shflags = alloca (len + 1);
+        memcpy (shflags, shellflags, len + 1);
+        shflags[0] = '/'; /* "/c" */
+        shellflags = shflags;
+      }
 # endif
 
     /* In .ONESHELL mode we are allowed to throw the entire current
@@ -3593,9 +3599,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
         /* new_line is local, must not be freed therefore
            We use line here instead of new_line because we run the shell
            manually.  */
-        size_t line_len = strlen (line);
-        char *p = new_line;
         char *q = new_line;
+        line_len = strlen (line);
+        p = new_line;
         memcpy (new_line, line, line_len + 1);
         /* Replace all backslash-newline combination and also following tabs.
            Important: stop at the first '\n' because that's what the loop above
index cf2324d1bd92038f2d48b095977eeec4830d2588..8ad750b84a7164dfbdb62cea70ecfba2b7fdac21 100644 (file)
@@ -2800,7 +2800,7 @@ main (int argc, char **argv, char **envp)
             child.output.syncout = 0;
             child.environment = environ;
 
-            pid = child_execute_job (&child, 1, nargv);
+            pid = child_execute_job (&child, 1, (char **)nargv);
 
             /* is this loop really necessary? */
             do {
index 164e0fba0e840f062c7d147a3fa52a2d21c79331..0fe0948a0627b5f0531554851ae7e6e3cd872e44 100644 (file)
@@ -136,6 +136,9 @@ set_blocking (int fd, int blocking)
       if (r < 0)
         pfatal_with_name ("fcntl(O_NONBLOCK)");
     }
+#else
+  (void) fd;
+  (void) blocking;
 #endif
 }
 
index 8e2547eb7607dbbc92e01399bd774aa285cd773d..62b3d7917c8e96cc71cb0a720e1f95e660f5d37d 100644 (file)
@@ -1477,14 +1477,6 @@ f_mtime (struct file *file, int search)
       FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS;
       if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime)
         adjusted_mtime -= adjustment;
-#elif defined(__EMX__)
-      /* FAT filesystems round time to the nearest even second!
-         Allow for any file (NTFS or FAT) to perhaps suffer from this
-         brain damage.  */
-      FILE_TIMESTAMP adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0
-                     && FILE_TIMESTAMP_NS (adjusted_mtime) == 0)
-                    ? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS
-                    : 0);
 #endif
 
       /* If the file's time appears to be in the future, update our