diff -pu make-4.1.90/ar.c make-fix/ar.c --- make-4.1.90/ar.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/ar.c 2016-04-27 07:56:07.605951804 -0700 @@ -73,7 +73,7 @@ static long int ar_member_date_1 (int desc UNUSED, const char *mem, int truncated, long int hdrpos UNUSED, long int datapos UNUSED, long int size UNUSED, long int date, - int uid UNUSED, int gid UNUSED, int mode UNUSED, + int uid UNUSED, int gid UNUSED, unsigned int mode UNUSED, const void *name) { return ar_name_equal (name, mem, truncated) ? date : 0; @@ -198,7 +198,7 @@ static long int ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED, long int hdrpos UNUSED, long int datapos UNUSED, long int size UNUSED, long int date UNUSED, int uid UNUSED, - int gid UNUSED, int mode UNUSED, const void *arg) + int gid UNUSED, unsigned int mode UNUSED, const void *arg) { struct ar_glob_state *state = (struct ar_glob_state *)arg; @@ -224,7 +224,7 @@ ar_glob_match (int desc UNUSED, const ch /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ static int -glob_pattern_p (const char *pattern, int quote) +ar_glob_pattern_p (const char *pattern, int quote) { const char *p; int opened = 0; @@ -267,7 +267,7 @@ ar_glob (const char *arname, const char #ifdef VMS char *vms_member_pattern; #endif - if (! glob_pattern_p (member_pattern, 1)) + if (! ar_glob_pattern_p (member_pattern, 1)) return 0; /* Scan the archive for matches. diff -pu make-4.1.90/arscan.c make-fix/arscan.c --- make-4.1.90/arscan.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/arscan.c 2016-04-27 08:23:22.808442782 -0700 @@ -296,23 +296,6 @@ ar_scan (const char *archive, ar_member_ #undef M_XENIX #endif -/* On the sun386i and in System V rel 3, ar.h defines two different archive - formats depending upon whether you have defined PORTAR (normal) or PORT5AR - (System V Release 1). There is no default, one or the other must be defined - to have a nonzero value. */ - -#if (!defined (PORTAR) || PORTAR == 0) && (!defined (PORT5AR) || PORT5AR == 0) -#undef PORTAR -#ifdef M_XENIX -/* According to Jim Sievert , for SCO XENIX defining - PORTAR to 1 gets the wrong archive format, and defining it to 0 gets the - right one. */ -#define PORTAR 0 -#else -#define PORTAR 1 -#endif -#endif - /* On AIX, define these symbols to be sure to get both archive formats. AIX 4.3 introduced the "big" archive format to support 64-bit object files, so on AIX 4.3 systems we need to support both the "normal" and @@ -547,7 +530,7 @@ ar_scan (const char *archive, ar_member_ int long_name = 0; #endif long int eltsize; - int eltmode; + unsigned int eltmode; long int fnval; off_t o; @@ -872,7 +855,7 @@ static long int ar_member_pos (int desc UNUSED, const char *mem, int truncated, long int hdrpos, long int datapos UNUSED, long int size UNUSED, long int date UNUSED, int uid UNUSED, int gid UNUSED, - int mode UNUSED, const void *name) + unsigned int mode UNUSED, const void *name) { if (!ar_name_equal (name, mem, truncated)) return 0; @@ -957,7 +940,8 @@ ar_member_touch (const char *arname, con long int describe_member (int desc, const char *name, int truncated, long int hdrpos, long int datapos, long int size, - long int date, int uid, int gid, int mode, const void *arg) + long int date, int uid, int gid, unsigned int mode, + const void *arg) { extern char *ctime (); diff -pu make-4.1.90/commands.c make-fix/commands.c --- make-4.1.90/commands.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/commands.c 2016-04-27 07:56:25.797046830 -0700 @@ -31,8 +31,6 @@ this program. If not, see - /* Structure describing state of iterating through a directory hash table. */ struct dirstream @@ -1261,7 +1259,9 @@ read_dirstream (__ptr_t stream) */ #if !defined(stat) && !defined(WINDOWS32) || defined(VMS) # ifndef VMS +# ifndef HAVE_SYS_STAT_H int stat (const char *path, struct stat *sbuf); +# endif # else /* We are done with the fake stat. Go back to the real stat */ # ifdef stat Common subdirectories: make-4.1.90/doc and make-fix/doc diff -pu make-4.1.90/file.c make-fix/file.c --- make-4.1.90/file.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/file.c 2016-04-26 17:00:26.968239729 -0700 @@ -57,9 +57,6 @@ file_hash_cmp (const void *x, const void ((struct file const *) y)->hname); } -#ifndef FILE_BUCKETS -#define FILE_BUCKETS 1007 -#endif static struct hash_table files; /* Whether or not .SECONDARY with no prerequisites was given. */ diff -pu make-4.1.90/filedef.h make-fix/filedef.h --- make-4.1.90/filedef.h 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/filedef.h 2016-04-27 07:55:46.219840090 -0700 @@ -103,7 +103,7 @@ struct file }; -extern struct file *suffix_file, *default_file; +extern struct file *default_file; struct file *lookup_file (const char *name); @@ -117,9 +117,12 @@ void rehash_file (struct file *file, con void set_command_state (struct file *file, enum cmd_state state); void notice_finished_file (struct file *file); void init_hash_files (void); +void verify_file_data_base (void); char *build_target_list (char *old_list); void print_prereqs (const struct dep *deps); void print_file_data_base (void); +int try_implicit_rule (struct file *file, unsigned int depth); +int stemlen_compare (const void *v1, const void *v2); #if FILE_TIMESTAMP_HI_RES # define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \ diff -pu make-4.1.90/function.c make-fix/function.c --- make-4.1.90/function.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/function.c 2016-04-26 17:01:44.090649591 -0700 @@ -1975,7 +1975,7 @@ func_shell_base (char *o, char **argv, i } #endif /* _AMIGA */ -char * +static char * func_shell (char *o, char **argv, const char *funcname UNUSED) { return func_shell_base (o, argv, 1); @@ -2653,10 +2653,10 @@ define_new_function (const gmk_floc *flo OS (fatal, flocp, _("Function name too long: %s"), name); if (min > 255) ONS (fatal, flocp, - _("Invalid minimum argument count (%d) for function %s"), min, name); + _("Invalid minimum argument count (%u) for function %s"), min, name); if (max > 255 || (max && max < min)) ONS (fatal, flocp, - _("Invalid maximum argument count (%d) for function %s"), max, name); + _("Invalid maximum argument count (%u) for function %s"), max, name); ent = xmalloc (sizeof (struct function_table_entry)); ent->name = name; diff -pu make-4.1.90/getloadavg.c make-fix/getloadavg.c --- make-4.1.90/getloadavg.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/getloadavg.c 2016-04-27 07:46:53.711063124 -0700 @@ -97,8 +97,7 @@ extern int errno; #if HAVE_LOCALE_H # include -#endif -#if !HAVE_SETLOCALE +#else # define setlocale(Category, Locale) /* empty */ #endif diff -pu make-4.1.90/getopt1.c make-fix/getopt1.c --- make-4.1.90/getopt1.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/getopt1.c 2016-04-26 17:04:03.455390370 -0700 @@ -20,8 +20,6 @@ this program. If not, see #endif -#include "getopt.h" - #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ @@ -32,6 +30,8 @@ this program. If not, see +#include "getopt.h" + /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling diff -pu make-4.1.90/getopt.c make-fix/getopt.c --- make-4.1.90/getopt.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/getopt.c 2016-04-27 07:29:53.669802400 -0700 @@ -20,12 +20,6 @@ A PARTICULAR PURPOSE. See the GNU Gener You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - #ifdef HAVE_CONFIG_H # include #endif @@ -201,10 +195,6 @@ static char *posixly_correct; /* Avoid depending on library functions or files whose names are inconsistent. */ -#ifndef getenv -extern char *getenv (); -#endif - static char * my_index (const char *str, int chr) { Common subdirectories: make-4.1.90/glob and make-fix/glob diff -pu make-4.1.90/hash.c make-fix/hash.c --- make-4.1.90/hash.c 2014-10-05 09:24:51.000000000 -0700 +++ make-fix/hash.c 2016-04-27 07:44:45.456398446 -0700 @@ -19,8 +19,6 @@ this program. If not, see ht_fill, ht->ht_size, + fprintf (out_FILE, _("Load=%lu/%lu=%.0f%%, "), ht->ht_fill, ht->ht_size, 100.0 * (double) ht->ht_fill / (double) ht->ht_size); - fprintf (out_FILE, _("Rehash=%d, "), ht->ht_rehashes); - fprintf (out_FILE, _("Collisions=%ld/%ld=%.0f%%"), ht->ht_collisions, ht->ht_lookups, + fprintf (out_FILE, _("Rehash=%u, "), ht->ht_rehashes); + fprintf (out_FILE, _("Collisions=%lu/%lu=%.0f%%"), ht->ht_collisions, ht->ht_lookups, (ht->ht_lookups ? (100.0 * (double) ht->ht_collisions / (double) ht->ht_lookups) : 0)); diff -pu make-4.1.90/job.c make-fix/job.c --- make-4.1.90/job.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/job.c 2016-04-27 08:01:08.484516296 -0700 @@ -24,7 +24,6 @@ this program. If not, see @@ -208,14 +207,10 @@ pid2str (pid_t pid) return pidstring; } +#if !HAVE_GETLOADAVG int getloadavg (double loadavg[], int nelem); -int start_remote_job (char **argv, char **envp, int stdin_fd, int *is_remote, - int *id_ptr, int *used_stdin); -int start_remote_job_p (int); -int remote_status (int *exit_code_ptr, int *signal_ptr, int *coredump_ptr, - int block); +#endif -RETSIGTYPE child_handler (int); static void free_child (struct child *); static void start_job_command (struct child *child); static int load_too_high (void); @@ -2285,7 +2280,6 @@ exec_command (char **argv, char **envp) case ENOEXEC: { /* The file is not executable. Try it as a shell script. */ - extern char *getenv (); const char *shell; char **new_argv; int argc; diff -pu make-4.1.90/main.c make-fix/main.c --- make-4.1.90/main.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/main.c 2016-04-27 07:43:26.295988199 -0700 @@ -84,18 +84,6 @@ char x; } #endif -void init_dir (void); -void remote_setup (void); -void remote_cleanup (void); -RETSIGTYPE fatal_error_signal (int sig); - -void print_variable_data_base (void); -void print_dir_data_base (void); -void print_rule_data_base (void); -void print_vpath_data_base (void); - -void verify_file_data_base (void); - #if defined HAVE_WAITPID || defined HAVE_WAIT3 # define HAVE_WAIT_NOHANG #endif @@ -645,7 +633,7 @@ initialize_global_hash_tables (void) Each element is true if we should stop parsing on that character. */ static void -initialize_stopchar_map () +initialize_stopchar_map (void) { int i; @@ -1062,7 +1050,7 @@ msdos_return_to_initial_directory (void) #endif /* __MSDOS__ */ static void -reset_jobserver () +reset_jobserver (void) { jobserver_clear (); free (jobserver_auth); @@ -1894,7 +1882,6 @@ main (int argc, char **argv, char **envp If none of these are true, we don't need a signal handler at all. */ { - RETSIGTYPE child_handler (int sig); # if defined SIGCHLD bsd_signal (SIGCHLD, child_handler); # endif @@ -3368,7 +3355,7 @@ print_version (void) /* Print a bunch of information about this and that. */ static void -print_data_base () +print_data_base (void) { time_t when = time ((time_t *) 0); diff -pu make-4.1.90/makeint.h make-fix/makeint.h --- make-4.1.90/makeint.h 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/makeint.h 2016-04-27 07:57:02.893240609 -0700 @@ -521,7 +521,8 @@ time_t ar_member_date (const char *); typedef long int (*ar_member_func_t) (int desc, const char *mem, int truncated, long int hdrpos, long int datapos, long int size, long int date, int uid, - int gid, int mode, const void *arg); + int gid, unsigned int mode, + const void *arg); long int ar_scan (const char *archive, ar_member_func_t function, const void *arg); int ar_name_equal (const char *name, const char *mem, int truncated); @@ -530,11 +531,15 @@ int ar_member_touch (const char *arname, #endif #endif +#include + int dir_file_exists_p (const char *, const char *); int file_exists_p (const char *); int file_impossible_p (const char *); void file_impossible (const char *); const char *dir_name (const char *); +void print_dir_data_base (void); +void dir_setup_glob (glob_t *); void hash_init_directories (void); void define_default_variables (void); @@ -557,7 +562,7 @@ void child_access (void); char *strip_whitespace (const char **begpp, const char **endpp); -void show_goal_error (); +void show_goal_error (void); /* String caching */ void strcache_init (void); @@ -584,16 +589,16 @@ long int atol (); long int lseek (); # endif -#endif /* Not GNU C library or POSIX. */ - -#ifdef HAVE_GETCWD -# if !defined(VMS) && !defined(__DECC) +# ifdef HAVE_GETCWD +# if !defined(VMS) && !defined(__DECC) char *getcwd (); -# endif -#else +# endif +# else char *getwd (); -# define getcwd(buf, len) getwd (buf) -#endif +# define getcwd(buf, len) getwd (buf) +# endif + +#endif /* Not GNU C library or POSIX. */ #if !HAVE_STRCASECMP # if HAVE_STRICMP @@ -625,7 +630,9 @@ int strncasecmp (const char *s1, const c extern const gmk_floc *reading_file; extern const gmk_floc **expanding_var; +#ifndef HAVE_UNISTD_H extern char **environ; +#endif extern unsigned short stopchar_map[]; @@ -637,6 +644,8 @@ extern int warn_undefined_variables_flag extern int not_parallel, second_expansion, clock_skew_detected; extern int rebuilding_makefiles, one_shell, output_sync, verify_flag; +extern const char *default_shell; + /* can we run commands via 'sh -c xxx' or must we use batch files? */ extern int batch_mode_shell; @@ -688,6 +697,17 @@ vms_restore_symbol (const char *string); #endif +void remote_setup (void); +void remote_cleanup (void); +int start_remote_job_p (int); +int start_remote_job (char **, char **, int, int *, int *, int *); +int remote_status (int *, int *, int *, int); +void block_remote_children (void); +void unblock_remote_children (void); +int remote_kill (int id, int sig); +void print_variable_data_base (void); +void print_vpath_data_base (void); + extern char *starting_directory; extern unsigned int makelevel; extern char *version_string, *remote_description, *make_host; diff -pu make-4.1.90/os.h make-fix/os.h --- make-4.1.90/os.h 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/os.h 2016-04-27 07:28:39.287419260 -0700 @@ -20,7 +20,7 @@ this program. If not, see = 0; } void -jobserver_clear () +jobserver_clear (void) { if (job_fds[0] >= 0) close (job_fds[0]); @@ -157,7 +157,7 @@ jobserver_release (int is_fatal) } unsigned int -jobserver_acquire_all () +jobserver_acquire_all (void) { unsigned int tokens = 0; @@ -207,7 +207,7 @@ jobserver_post_child (int recursive) } void -jobserver_signal () +jobserver_signal (void) { if (job_rfd >= 0) { @@ -217,7 +217,7 @@ jobserver_signal () } void -jobserver_pre_acquire () +jobserver_pre_acquire (void) { /* Make sure we have a dup'd FD. */ if (job_rfd < 0 && job_fds[0] >= 0 && make_job_rfd () < 0) @@ -399,7 +399,7 @@ jobserver_acquire (int timeout) /* Create a "bad" file descriptor for stdin when parallel jobs are run. */ int -get_bad_stdin () +get_bad_stdin (void) { static int bad_stdin = -1; diff -pu make-4.1.90/read.c make-fix/read.c --- make-4.1.90/read.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/read.c 2016-04-27 07:32:16.867540006 -0700 @@ -18,8 +18,6 @@ this program. If not, see -#include - #include "filedef.h" #include "dep.h" #include "job.h" @@ -2920,7 +2918,6 @@ tilde_expand (const char *name) #ifndef VMS if (name[1] == '/' || name[1] == '\0') { - extern char *getenv (); char *home_dir; int is_variable; @@ -2943,7 +2940,6 @@ tilde_expand (const char *name) # if !defined(_AMIGA) && !defined(WINDOWS32) if (home_dir == 0 || home_dir[0] == '\0') { - extern char *getlogin (); char *logname = getlogin (); home_dir = 0; if (logname != 0) @@ -3008,8 +3004,6 @@ tilde_expand (const char *name) PARSEFS_NOCACHE - Do not add filenames to the strcache (caller frees) */ -void dir_setup_glob (glob_t *glob); - void * parse_file_seq (char **stringp, unsigned int size, int stopmap, const char *prefix, int flags) diff -pu make-4.1.90/remake.c make-fix/remake.c --- make-4.1.90/remake.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/remake.c 2016-04-27 07:32:32.960622900 -0700 @@ -37,8 +37,6 @@ this program. If not, see #endif -extern int try_implicit_rule (struct file *file, unsigned int depth); - /* The test for circular dependencies is based on the 'updating' bit in 'struct file'. However, double colon targets have separate 'struct @@ -269,7 +267,7 @@ update_goal_chain (struct goaldep *goald about errors, show an error message the first time. */ void -show_goal_error () +show_goal_error (void) { if ((goal_dep->flags & (RM_INCLUDED|RM_DONTCARE)) != RM_INCLUDED) return; diff -pu make-4.1.90/rule.h make-fix/rule.h --- make-4.1.90/rule.h 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/rule.h 2016-04-27 07:33:47.456006623 -0700 @@ -55,3 +55,4 @@ void install_pattern_rule (struct pspec void create_pattern_rule (const char **targets, const char **target_percents, unsigned int num, int terminal, struct dep *deps, struct commands *commands, int override); +void print_rule_data_base (void); Common subdirectories: make-4.1.90/tests and make-fix/tests diff -pu make-4.1.90/variable.c make-fix/variable.c --- make-4.1.90/variable.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/variable.c 2016-04-27 07:41:50.827493435 -0700 @@ -822,7 +822,6 @@ merge_variable_set_lists (struct variabl void define_automatic_variables (void) { - extern const char* default_shell; struct variable *v; char buf[200]; @@ -1049,7 +1048,6 @@ target_environment (struct file *file) /* If this is the SHELL variable and it's not exported, then add the value from our original environment, if the original environment defined a value for SHELL. */ - extern struct variable shell_var; if (streq (v->name, "SHELL") && shell_var.value) { v = &shell_var; @@ -1136,7 +1134,7 @@ set_special_var (struct variable *var) * result. This removes only ONE newline (if any) at the end, for maximum * compatibility with the *BSD makes. If it fails, returns NULL. */ -char * +static char * shell_result (const char *p) { char *buf; @@ -1750,7 +1748,7 @@ print_variable_data_base (void) if (rules == 0) puts (_("\n# No pattern-specific variable values.")); else - printf (_("\n# %u pattern-specific variable values"), rules); + printf (_("\n# %d pattern-specific variable values"), rules); } } diff -pu make-4.1.90/variable.h make-fix/variable.h --- make-4.1.90/variable.h 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/variable.h 2016-04-27 07:55:02.972614179 -0700 @@ -110,6 +110,7 @@ struct pattern_var extern char *variable_buffer; extern struct variable_set_list *current_variable_set_list; extern struct variable *default_goal_var; +extern struct variable shell_var; /* expand.c */ char *variable_buffer_output (char *ptr, const char *string, unsigned int length); @@ -148,7 +149,6 @@ void pop_variable_scope (void); void define_automatic_variables (void); void initialize_file_variables (struct file *file, int reading); void print_file_variables (const struct file *file); -void print_file_variables (const struct file *file); void print_target_variables (const struct file *file); void merge_variable_set_lists (struct variable_set_list **to_list, struct variable_set_list *from_list); diff -pu make-4.1.90/vpath.c make-fix/vpath.c --- make-4.1.90/vpath.c 2016-04-23 08:48:40.000000000 -0700 +++ make-fix/vpath.c 2016-04-27 07:43:28.037997227 -0700 @@ -52,7 +52,7 @@ static struct vpath *gpaths; variable. */ void -build_vpath_lists () +build_vpath_lists (void) { register struct vpath *new = 0; register struct vpath *old, *nexto; Common subdirectories: make-4.1.90/w32 and make-fix/w32