summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-01-08 18:44:25 -0500
committerPaul Smith <psmith@gnu.org>2023-01-08 18:44:25 -0500
commitb99b6cdf3c18ee96da1775f7300d463fe5fe7ebb (patch)
tree27f48ebdc15c65e5042b39aab130ac2f50a70e3e
parent36f955b0e8d2c1b5be292eb84475c44eea6403c8 (diff)
downloadmake-git-b99b6cdf3c18ee96da1775f7300d463fe5fe7ebb.tar.gz
Update support for OS/2
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.
-rw-r--r--AUTHORS1
-rw-r--r--NEWS3
-rw-r--r--README.OS27
-rw-r--r--src/dir.c8
-rw-r--r--src/getopt.c27
-rw-r--r--src/job.c14
-rw-r--r--src/main.c2
-rw-r--r--src/posixos.c3
-rw-r--r--src/remake.c8
9 files changed, 46 insertions, 27 deletions
diff --git a/AUTHORS b/AUTHORS
index 9be61730..5db6fe36 100644
--- 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 20bb26ea..592a3418 100644
--- 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>
+
Version 4.4 (31 Oct 2022)
diff --git a/README.OS2 b/README.OS2
index 1da9528f..b4c8dacc 100644
--- a/README.OS2
+++ b/README.OS2
@@ -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 *****
diff --git a/src/dir.c b/src/dir.c
index aa50db6c..3e94b98e 100644
--- 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)
{
diff --git a/src/getopt.c b/src/getopt.c
index bc1f1caf..7a792de8 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -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;
}
@@ -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;
diff --git a/src/job.c b/src/job.c
index 3fab8012..7533553f 100644
--- 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
diff --git a/src/main.c b/src/main.c
index cf2324d1..8ad750b8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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 {
diff --git a/src/posixos.c b/src/posixos.c
index 164e0fba..0fe0948a 100644
--- a/src/posixos.c
+++ b/src/posixos.c
@@ -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
}
diff --git a/src/remake.c b/src/remake.c
index 8e2547eb..62b3d791 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -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