diff options
author | Paul Smith <psmith@gnu.org> | 2023-01-08 18:44:25 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2023-01-08 18:44:25 -0500 |
commit | b99b6cdf3c18ee96da1775f7300d463fe5fe7ebb (patch) | |
tree | 27f48ebdc15c65e5042b39aab130ac2f50a70e3e | |
parent | 36f955b0e8d2c1b5be292eb84475c44eea6403c8 (diff) | |
download | make-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-- | AUTHORS | 1 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | README.OS2 | 7 | ||||
-rw-r--r-- | src/dir.c | 8 | ||||
-rw-r--r-- | src/getopt.c | 27 | ||||
-rw-r--r-- | src/job.c | 14 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/posixos.c | 3 | ||||
-rw-r--r-- | src/remake.c | 8 |
9 files changed, 46 insertions, 27 deletions
@@ -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> @@ -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) @@ -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 ***** @@ -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; @@ -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 @@ -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 |