This file contains diffs from version 3.63 of GNU Make to version 3.64. Changes in files that are generated by etags and TeX have been omitted. diff -ruN make-3.63/ChangeLog make-3.64/ChangeLog --- make-3.63/ChangeLog Fri Jan 22 19:09:02 1993 +++ make-3.64/ChangeLog Wed Apr 21 15:18:02 1993 @@ -1,4 +1,394 @@ +Wed Apr 21 15:17:54 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.64. + +Fri Apr 16 14:22:22 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * compatMakefile (install): Remove - prefix from chgrp+chmod. + + * Version 3.63.8. + +Thu Apr 15 18:24:07 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acconfig.h: New file; contains "#undef SCCS_GET" for autoheader. + * configure.in: If /usr/sccs/get exists, define SCCS_GET to that, + else to "get". + * default.c (default_variables): Set GET to macro SCCS_GET. + + * read.c (parse_file_seq): Take extra arg STRIP; strip `./' only + if nonzero. I hope this is the last time this argument is added + or removed. + (read_makefile): Pass it 1 when parsing include file names. + Pass it 1 when parsing target file names. + Pass it 1 when parsing static pattern target pattern names. + * rule.c (install_pattern_rule): Pass it 1 when parsing rule deps. + * default.c (set_default_suffixes): Pass it 1 when parsing + default_suffixes. + * function.c (string_glob): Pass it 0 here. + +Wed Apr 14 11:32:05 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * misc.c (log_access): New function. + ({init,user,make,child}_access): Call it. + (child_access): Abort if !access_inited. + + * main.c (switches: --no-print-directory): Use 1 instead of -1 for + single-letter option. + (init_switches, decode_switches, define_makeflags): An option with + no single-letter version is no longer indicated by a value of -1; + instead a value that is !isalnum. + (init_switches): Don't put such switches into the string, only + into the long_option table. + + * make.h [!NSIG] [!_NSIG]: #define NSIG 32. + + * job.c [HAVE_WAITPID]: Remove #undef HAVE_UNION_WAIT. AIX's + bsdcc defined WIF* to use union wait. + + * main.c (struct command_switch): Change member `c' to type int. + (switches): Make const. + (decode_switches): Use `const struct command_switch *'. + (define_makeflags): Likewise. + + * default.c (default_suffix_rules): Add `-o $@' to makeinfo rules. + +Mon Apr 12 12:30:04 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.63.7. + + * configure.in (AC_HAVE_HEADERS): Check for string.h and memory.h. + Removed AC_MEMORY_H. + * make.h [USG, NeXT]: Don't test these. + [HAVE_STRING_H]: Test this to include string.h and define ANSI_STRING. + [HAVE_MEMORY_H]: Test this instead of NEED_MEMORY_H. + [! ANSI_STRING]: Put decls of bcopy et al here. + [sparc]: Don't test this for alloca.h; HAVE_ALLOCA_H is sufficient. + [HAVE_SIGSETMASK]: Test this rather than USG. + [__GNU_LIBRARY__ || POSIX]: Don't #include again. + * main.c (main): Handle SIGCHLD if defined, and SIGCLD if defined. + It doesn't hurt to do both if they are both defined, and testing + USG is useless. + * dir.c: Rationalize directory header conditionals. + * arscan.c [HAVE_FCNTL_H]: Test this rather than USG || POSIX. + + * default.c (default_suffixes): Add `.txinfo'. + (default_suffix_rules): Add `.txinfo.info' and `.txinfo.dvi' rules. + + * variable.c (try_variable_definition): Replace RECURSIVE flag + with enum FLAVOR, which can be simple, recursive, or append. + Recognize += as append flavor. Set new variable VALUE in a switch + on FLAVOR. For append flavor, prepend the variable's old value. + If the variable was previously defined recursive, set FLAVOR to + recursive; if it was defined simple, expand the new value before + appending it to the old value. Pass RECURSIVE flag to + define_variable iff FLAVOR == recursive. + + * variable.c (try_variable_definition): Use alloca and bcopy for + NAME, instead of savestring. Might as well use stack storage + since we free it immediately anyway. + +Thu Apr 8 18:04:43 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * job.c (start_waiting_jobs): Move decl of JOB outside of loop. + + * main.c (define_makeflags): Rename `struct flag' member `switch' + to `cs', which is not a reserved word. + +Wed Apr 7 15:30:51 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * job.c (new_job): Call start_waiting_jobs first thing. + (start_waiting_job): Changed return type from void to int. + Return 0 when putting the child on the waiting_jobs chain. + (start_waiting_jobs): Don't check load and job_slots here. + Always take a job off the chain and call start_waiting_job on it; + give up and return when start_waiting_job returns zero. + + * main.c (define_makeflags: struct flag): Change member `char c' to + `struct command_switch *switch'. + (ADD_FLAG): Set that to CS instead of CS->c. + If CS->c is -1, increment FLAGSLEN for the long name. + When writing out FLAGS, handle FLAGS->switch->c == -1 and write + the long name instead. + + * compatMakefile (stamp-config): New target of old config.h rule. + Touch stamp-config after running config.status. + (config.h): Just depend on stamp-config, and have empty commands. + +Mon Apr 5 20:14:02 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * job.c [HAVE_WAITPID]: #undef HAVE_UNION_WAIT. + + * configure.in (AC_HAVE_FUNCS): Check for psignal. + +Fri Apr 2 17:15:46 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * main.c (long_option_aliases): Remove "new"; it is already an + unambiguous prefix of "new-file". + +Sun Mar 28 16:57:17 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * Version 3.63.6. + +Wed Mar 24 14:26:19 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * vpath.c (selective_vpath_search): When adding the + name-within-directory at the end of NAME, and we don't add a + slash, don't copy FILENAME in one char too far into NAME. + + * variable.c (define_automatic_variables): Find default_shell's + length with strlen, not numerology. + +Wed Mar 17 20:02:27 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * main.c (define_makeflags): Add the elts of a string option in + reverse order, so they come out right when reversed again. + +Fri Mar 12 15:38:45 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * compatMakefile (make.info): Use `-o make.info'. + +Thu Mar 11 14:13:00 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * compatMakefile (REMOTE): Set to @REMOTE@; change comments to + reflect new use. + (objs): Replace remote.o with remote-$(REMOTE).o. + (srcs): Replace remote.c with remote-$(REMOTE).c. + (remote.o): Rule removed. + + * configure.in (REMOTE): Subst this in Makefile et al; default "stub". + Use AC_WITH to grok --with-customs arg to set REMOTE=cstms. + * GNUmakefile (build.sh.in): Filter out remote-% from objs list. + * build.template (REMOTE): New var; set to @REMOTE@. + (objs): Add remote-${REMOTE}.o. + +Wed Mar 10 15:12:24 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * Version 3.63.5. + + * implicit.c (pattern_search): Fix "dependent"->"dependency" in + "Rejecting impossible" -d msg. + + * file.c (file_hash_enter): New local vars {OLD,NEW}BUCKET. Store + mod'd values there; never mod {OLD,NEW}HASH. + +Mon Mar 8 13:32:48 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * remake.c [eta10]: Include instead of . + + * compatMakefile (VPATH): Set this to @srcdir@. + (srcdir): Set this to $(VPATH). + + * main.c (main): New local var DIRECTORY_BEFORE_CHDIR. Save in it + a copy of CURRENT_DIRECTORY after the first getcwd. Use it + instead of CURRENT_DIRECTORY when chdir'ing back before re-execing. + + * remake.c (notice_finished_file): Pass missing SEARCH arg to f_mtime. + + * read.c (read_makefile): Remove extraneous arg to parse_file_seq. + +Mon Feb 22 14:19:38 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * compatMakefile ($(infodir)/$(instname).info): Use , instead of / + as the sed delimiter char. + +Sun Feb 21 14:11:04 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.63.4. + + * rule.h (struct rule): Removed `subdir' member. + * rule.c (new_pattern_rule): No need to clear it. + (count_implicit_rule_limits): Set the `changed' flag in each dep + that refers to a nonexistent directory. No longer set rule-global + `subdir' flag with that information. + (print_rule_data_base): Don't record info on `subdir' flags. + + * implicit.c (pattern_search): Check the DEP->changed flag rather + than the (now gone) RULE->subdir flag. Also test CHECK_LASTSLASH; + if it is set, the file might exist even though the DEP->changed + flag is set. + + * rule.c (count_implicit_rule_limits): Pass "", not ".", as file + name arg to dir_file_exists_p to check for existence of directory. + + * implicit.c (pattern_search): Inside dep-finding loop, set + CHECK_LASTSLASH from the value recorded in CHECKED_LASTSLASH[I], + rather than computing it anew. + + * commands.c (set_file_variables): Must alloca space for PERCENT + and copy it, to avoid leaving the trailing `)' in the value. + + * misc.c (remove_comments): Fixed backslash-checking loop + condition to allow it to look at the first char on the line. + P2 >= LINE, not P2 > LINE. + + * compatMakefile ($(bindir)/$(instname)): Before moving $@.new to + $@, rm $@.old and mv $@ to $@.old. + + * variable.c (try_variable_definition): Take new args FILENAME and + LINENO. Fatal if the variable name is empty. + * read.c (read_makefile): Change callers. + * main.c (main): Likewise. + + * compatMakefile (group): Define to @KMEM_GROUP@, autoconf magic + that configure will replace with the group owning /dev/kmem. + +Mon Feb 8 14:26:43 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * vpath.c (vpath_search): Take second arg MTIME_PTR, pass thru to + selective_vpath_search. + (selective_vpath_search): Take second arg MTIME_PTR. + If the dir cache thinks a file exists, stat it to make sure, and + put the modtime in *MTIME_PTR. + * remake.c (library_search): Take second arg MTIME_PTR. + When we find a match, record its mtime there. + Pass MTIME_PTR through to vpath_search to do same. + (f_mtime): Pass &MTIME as new 2nd arg to {vpath,library}_search; + store it in FILE->last_mtime if set nonzero. + * implicit.c (pattern_search): Pass nil 2nd arg to vpath_search. + + * compatMakefile (remote.o): Prepend `$(srcdir)/' to `remote-*.c', + so globbing looks somewhere it will find things. + + * compatMakefile ($(infodir)/$(instname).info): Install `make.info*' + not `$(srcdir)/make.info*'; no need to use basename. + +Fri Feb 5 12:52:43 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * Version 3.63.3. + + * compatMakefile (install): Add missing ;\s. + + Make -, @, and + prefixes on a pre-expanded command line affect + all lines in the expansion, not just the first. + * commands.h (struct commands): Replace `lines_recurse' member + with `lines_flags'. + (COMMANDS_{RECURSE,SILENT,NOERROR}): New macros, bits to set in + that flag byte. + * commands.c (chop_commands): Set `lines_flags' instead of + `lines_recurse'. Record not only + but also @ and - prefixes. + * remake.c (notice_finished_file): Check the COMMANDS_RECURSE bit + in FILE->cmds->lines_flags, rather than FILE->cmds->lines_recurse. + * job.c (start_job_command): Replaced RECURSIVE and NOPRINT local + var with FLAGS; initialize it to the appropriate `lines_flags' byte. + Set CHILD->noerror if the COMMANDS_NOERROR bit is set in FLAGS. + Set the COMMANDS_SILENT bit in FLAGS for a @ prefix. + + * remake.c (update_goal_chain): Set G->file to its prev after + checking for G being finished, since that check needs to examine + G->file. + + * configure.in (union wait check) [HAVE_WAITPID]: Try using + waitpid with a `union wait' STATUS arg. If waitpid and union wait + don't work together, we should not use union wait. + + * Version 3.63.2. + + * remake.c (update_goal_chain): When G->file->updated, move + G->file to its prev. We aren't finished until G->file is nil. + +Thu Feb 4 12:53:04 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * main.c (starting_directory): New global variable. + (main): Set it to cwd after doing -Cs. + (log_working_directory): Use it, rather than computing each time. + * make.h: Declare it. + + * compatMakefile (SHELL): Define to /bin/sh for losing Unix makes. + + * main.c (decode_env_switches): Allocate (1 + LEN + 1) words for + ARGV, rather than LEN words plus one byte. + +Wed Feb 3 18:13:52 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * compatMakefile ($(bindir)/$(instname)): Put - before + install_setgid command line, so its failure won't be an error. + (infodir): New variable. + (install): Depend on $(infodir)/$(instname).info. + ($(infodir)/$(instname).info): New target. + + * read.c (read_makefile): If FILENAMES is nil when we see a line + starting with a tab, don't treat it as a command. Just fall + through, rather than giving an error. + + * read.c (read_makefile): If the NO_TARGETS flag is set when we see a + command line, don't clear it before continuing. We want + subsequent command lines to be ignored as well. + + * job.c (new_job): Before expanding each command line, collapse + backslash-newline combinations that are inside var or fn references. + +Mon Feb 1 16:00:13 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * compatMakefile (exec_prefix): Default to $(prefix), not /usr/local. + + * compatMakefile (make.info): Pass -I$(srcdir) to makeinfo. + + * job.c [POSIX] (unblock_sigs): Made global. + [!POSIX] (unblock_sigs): Move defns to job.h. + * job.h [POSIX] (unblock_sigs): Declare. + +Sun Jan 31 19:11:05 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * read.c (read_makefile): In vpath parsing, after finding the + pattern token, take entire rest of line as the search path, not + just the next token. + + * compatMakefile (remote.o): Depend on remote-*.c. + +Thu Jan 28 16:40:29 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * commands.c (set_file_variables): Don't define any F or D versions. + * variable.c (define_automatic_variables): Define them here as + recursively-expanded variables that use the dir and notdir funcs. + + * variable.c (target_environment): In v_default case, don't export + o_default or o_automatic variables. + + * configure.in (union wait check): Remove ` and ' inside C code; + they confuse the shell script. + +Mon Jan 25 13:10:42 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.63.1. + + * vpath.c (construct_vpath_list): When skipping further processing + of an elt that is ".", don't also skip the code that pushes P past + the next separator. + + * compatMakefile (distclean): Don't remove make-*. + + * configure.in (HAVE_UNION_WAIT): Try to use WEXITSTATUS if it's + defined. If one cannot use WEXITSTATUS with a `union wait' + argument, we don't want to believe the system has `union wait' at all. + + * remake.c (update_file): Do nothing to print "up to date" msgs. + (update_goal_chain): Do it here instead. + Use the `changed' flag of each goal's `struct dep' to keep track + of whether files_remade (now commands_started) changed around a + call to update_file for that goal. + When a goal is finished, and its file's update_status is zero (i.e., + success or nothing done), test the `changed' flag and give an "up + to date" msg iff it is clear. + * make.h (files_remade): Renamed to commands_started. + * remake.c: Changed defn. + (update_goal_chain): Changed uses. + * job.c (start_job_command): Increment commands_started here. + (reap_children): Not here. + + * remake.c (update_goal_chain): Don't do anything with files' + `prev' members. update_file now completely handles this. + + * variable.c (target_environment): Don't expand recursive + variables if they came from the environment. + + * main.c (define_makeflags): For flags with omitted optional args, + store {"", 0} with ADD_FLAG. When constructing FLAGSTRING, a flag + so stored cannot have more flags appended to the same word. + Fri Jan 22 14:46:16 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * variable.c (print_variable_set): In vars/bucket calculation, + don't spuriously multiply by 100. * Version 3.63. diff -ruN make-3.63/Makefile.in make-3.64/Makefile.in --- make-3.63/Makefile.in Fri Jan 22 19:27:19 1993 +++ make-3.64/Makefile.in Wed Apr 21 15:19:13 1993 @@ -19,8 +19,9 @@ # Makefile for GNU Make # -srcdir = @srcdir@ -VPATH = $(srcdir) +# Ultrix 2.2 make doesn't expand the value of VPATH. +VPATH = @srcdir@ +srcdir = $(VPATH) CC = @CC@ @@ -37,6 +38,10 @@ # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline. defines = @DEFS@ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" +# Which flavor of remote job execution support to use. +# The code is found in `remote-$(REMOTE).c'. +REMOTE = @REMOTE@ + # If you are using the GNU C library, or have the GNU getopt functions in # your C library, you can comment these out. GETOPT = getopt.o getopt1.o @@ -60,10 +65,6 @@ # alloca.c instead on those machines. LOADLIBES = @LIBS@ -# If there are remote execution facilities defined, -# enable them with switches here (see remote-*.c). -REMOTE = - # Any extra object files your system needs. extras = @LIBOBJS@ @@ -70,7 +71,7 @@ # Common prefix for machine-independent installed files. prefix = /usr/local # Common prefix for machine-dependent installed files. -exec_prefix = /usr/local +exec_prefix = $(prefix) # Name under which to install GNU make. instname = make @@ -80,6 +81,8 @@ libdir = $(exec_prefix)/lib # Directory to search by default for included makefiles. includedir = $(prefix)/include +# Directory to install the Info files in. +infodir = $(prefix)/info # Directory to install the man page in. mandir = $(prefix)/man/man$(manext) # Number to put on the man page filename. @@ -91,7 +94,7 @@ # switch) will not work unless make is installed setgid kmem. install_setgid = @NEED_SETGID@ # Install make setgid to this group so it can read /dev/kmem. -group = kmem +group = @KMEM_GROUP@ # Program to install `make'. INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -110,15 +113,16 @@ CTAGS = ctags -tw objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o \ - remote.o rule.o implicit.o default.o variable.o expand.o \ - function.o vpath.o version.o ar.o arscan.o signame.o \ + rule.o implicit.o default.o variable.o expand.o function.o \ + vpath.o version.o ar.o arscan.o signame.o remote-$(REMOTE).o \ $(GLOB) $(GETOPT) $(ALLOCA) $(extras) srcs = $(srcdir)/commands.c $(srcdir)/job.c $(srcdir)/dir.c \ $(srcdir)/file.c $(srcdir)/getloadavg.c $(srcdir)/misc.c \ $(srcdir)/main.c $(srcdir)/read.c $(srcdir)/remake.c \ - $(srcdir)/remote.c $(srcdir)/rule.c $(srcdir)/implicit.c \ - $(srcdir)/default.c $(srcdir)/variable.c $(srcdir)/expand.c \ - $(srcdir)/function.c $(srcdir)/vpath.c $(srcdir)/version.c \ + $(srcdir)/rule.c $(srcdir)/implicit.c $(srcdir)/default.c \ + $(srcdir)/variable.c $(srcdir)/expand.c $(srcdir)/function.c \ + $(srcdir)/vpath.c $(srcdir)/version.c \ + $(srcdir)/remote-$(REMOTE).c \ $(srcdir)/ar.c $(srcdir)/arscan.c \ $(srcdir)/signame.c $(srcdir)/signame.h $(GETOPT_SRC) \ $(srcdir)/commands.h $(srcdir)/dep.h $(srcdir)/file.h \ @@ -136,7 +140,7 @@ dvi: make.dvi make.info: make.texinfo - $(MAKEINFO) $(srcdir)/make.texinfo + $(MAKEINFO) -I$(srcdir) $(srcdir)/make.texinfo -o make.info make.dvi: make.texinfo $(TEXI2DVI) $(srcdir)/make.texinfo @@ -152,11 +156,9 @@ .c.o: $(CC) $(defines) -c -I. -I$(srcdir) -I$(srcdir)/glob \ $(CFLAGS) $< $(OUTPUT_OPTION) -remote.o: remote.c - $(CC) $(defines) $(REMOTE) -c -I. -I$(srcdir) \ - $(CFLAGS) $(srcdir)/remote.c # For some losing Unix makes. +SHELL = /bin/sh MAKE = make glob/libglob.a: force @@ -172,7 +174,8 @@ $(CTAGS) $(tagsrcs) .PHONY: install -install: $(bindir)/$(instname) $(mandir)/$(instname).$(manext) +install: $(bindir)/$(instname) $(infodir)/$(instname).info \ + $(mandir)/$(instname).$(manext) $(bindir)/$(instname): make $(INSTALL_PROGRAM) make $@.new @@ -180,8 +183,17 @@ if $(install_setgid); then \ chgrp $(group) $@.new && chmod g+s $@.new; \ else true; fi +# Some systems can't deal with renaming onto a running binary. + -rm -f $@.old + -mv $@ $@.old mv $@.new $@ +$(infodir)/$(instname).info: make.info + for file in make.info*; do \ + $(INSTALL_DATA) $$file \ + `echo $@ | sed "s,$(instname).info\$$,$$file,"`; \ + done + $(mandir)/$(instname).$(manext): make.man $(INSTALL_DATA) $(srcdir)/make.man $@ @@ -190,7 +202,7 @@ -rm -f make *.o core distclean: clean glob-realclean -rm -f Makefile config.h config.status build.sh - -rm -f TAGS tags make.info* make-* make.dvi + -rm -f TAGS tags make.info* make.dvi -rm -f make.?? make.??s make.log make.toc make.*aux realclean: distclean mostlyclean: clean @@ -201,13 +213,15 @@ Makefile: config.status $(srcdir)/Makefile.in $(SHELL) config.status -config.h: config.status $(srcdir)/config.h.in +config.h: stamp-config ; +stamp-config: config.status $(srcdir)/config.h.in $(SHELL) config.status + touch stamp-config configure: configure.in - autoconf + autoconf $(ACFLAGS) config.h.in: configure.in - autoheader + autoheader $(ACFLAGS) # This tells versions [3.59,3.63) of GNU make not to export all variables. .NOEXPORT: @@ -220,13 +234,11 @@ job.o : job.c make.h config.h commands.h job.h file.h variable.h dir.o : dir.c make.h config.h file.o : file.c make.h config.h commands.h dep.h file.h variable.h -misc.o : misc.c make.h config.h dep.h main.o : main.c make.h config.h commands.h dep.h file.h variable.h job.h \ getopt.h read.o : read.c make.h config.h commands.h dep.h file.h variable.h glob/glob.h remake.o : remake.c make.h config.h commands.h job.h dep.h file.h -remote.o : remote.c remote-stub.c make.h commands.h -rule.o : rule.c make.h commands.h dep.h file.h variable.h rule.h +rule.o : rule.c make.h config.h commands.h dep.h file.h variable.h rule.h implicit.o : implicit.c make.h config.h rule.h dep.h file.h default.o : default.c make.h config.h rule.h dep.h file.h commands.h variable.h variable.o : variable.c make.h config.h commands.h variable.h dep.h file.h @@ -236,7 +248,9 @@ version.o : version.c ar.o : ar.c make.h file.h arscan.o : arscan.c make.h config.h -signame.o : signame.c signame.h +signame.o : signame.c config.h signame.h +remote-cstms.o : remote-cstms.c make.h config.h commands.h job.h pmake/customs/customs.h \ + pmake/customs/config.h pmake/customs/../unix/config.h pmake/customs/rpc.h pmake/lib/include/sprite.h getopt.o : getopt.c config.h getopt.h getopt1.o : getopt1.c config.h getopt.h getloadavg.o : getloadavg.c config.h diff -ruN make-3.63/NEWS make-3.64/NEWS --- make-3.63/NEWS Wed Jan 13 17:10:27 1993 +++ make-3.64/NEWS Mon Apr 12 15:58:11 1993 @@ -1,9 +1,23 @@ -GNU make NEWS -- history of user-visible changes. 13 January 1993 +GNU make NEWS -- history of user-visible changes. 12 April 1993 Copyright (C) 1992, 1993 Free Software Foundation, Inc. See the end for copying conditions. Please send GNU make bug reports to bug-gnu-utils@prep.ai.mit.edu. + +Version 3.64 + +* Make now supports the `+=' syntax for a variable definition which appends + to the variable's previous value. See the section `Appending More Text + to Variables' in the manual for full details. + +* The new option `--no-print-directory' inhibits the `-w' or + `--print-directory' feature. Make turns on `--print-directory' + automatically if you use `-C' or `--directory', and in sub-makes; some + users have found this behavior undesirable. + +* The built-in implicit rules now support the alternative extension + `.txinfo' for Texinfo files, just like `.texinfo' and `.texi'. Version 3.63 diff -ruN make-3.63/README make-3.64/README --- make-3.63/README Fri Jan 22 19:26:46 1993 +++ make-3.64/README Wed Apr 21 15:19:03 1993 @@ -1,4 +1,4 @@ -This directory contains the 3.63 test release of GNU Make. +This directory contains the 3.64 test release of GNU Make. All bugs reported for previous test releases have been fixed. Some bugs surely remain. diff -ruN make-3.63/alloca.c make-3.64/alloca.c --- make-3.63/alloca.c Tue Dec 1 13:25:53 1992 +++ make-3.64/alloca.c Wed Mar 31 17:32:10 1993 @@ -1,7 +1,9 @@ /* alloca -- (mostly) portable public-domain implementation -- D A Gwyn - last edit: 86/05/30 rms + 93/3/31 jimb + Use xfree instead of free. + 86/05/30 rms include config.h, since on VMS it renames some symbols. Use xmalloc instead of malloc. @@ -48,6 +50,10 @@ #endif /* static */ #endif /* emacs */ +#ifdef emacs +#define free xfree +#endif + #ifndef alloca /* If compiling with GCC, this file's not needed. */ #ifdef __STDC__ @@ -58,8 +64,7 @@ #define NULL 0 /* null pointer constant */ -extern void free(); -extern pointer xmalloc(); +extern pointer xmalloc (); /* Define STACK_DIRECTION if you know the direction of stack @@ -108,20 +113,20 @@ /* An "alloca header" is used to: - (a) chain together all alloca()ed blocks; + (a) chain together all alloca'ed blocks; (b) keep track of stack depth. - It is very important that sizeof(header) agree with malloc() + It is very important that sizeof (header) agree with malloc alignment chunk size. The following default should work okay. */ #ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) +#define ALIGN_SIZE sizeof (double) #endif typedef union hdr { - char align[ALIGN_SIZE]; /* to force sizeof(header) */ + char align[ALIGN_SIZE]; /* to force sizeof (header) */ struct { union hdr *next; /* for chaining headers */ @@ -130,9 +135,9 @@ } header; /* - alloca( size ) returns a pointer to at least `size' bytes of + alloca ( size ) returns a pointer to at least `size' bytes of storage which will be automatically reclaimed upon exit from - the procedure that called alloca(). Originally, this space + the procedure that called alloca. Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. @@ -152,7 +157,7 @@ find_stack_direction (); #endif - /* Reclaim garbage, defined as all alloca()ed storage that + /* Reclaim garbage, defined as all alloca'ed storage that was allocated from deeper in the stack than currently. */ { @@ -190,7 +195,7 @@ /* User storage begins just after header. */ - return (pointer)((char *)new + sizeof(header)); + return (pointer)((char *)new + sizeof (header)); } } diff -ruN make-3.63/arscan.c make-3.64/arscan.c --- make-3.63/arscan.c Wed Jan 13 16:18:56 1993 +++ make-3.64/arscan.c Mon Apr 12 16:52:46 1993 @@ -16,7 +16,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "make.h" -#if defined (USG) || defined (POSIX) + +#ifdef HAVE_FCNTL_H #include #else #include diff -ruN make-3.63/build.sh.in make-3.64/build.sh.in --- make-3.63/build.sh.in Thu Jan 21 18:51:53 1993 +++ make-3.64/build.sh.in Sun Mar 28 17:04:55 1993 @@ -29,6 +29,7 @@ ALLOCA='@ALLOCA@' LOADLIBES='@LIBS@' extras='@LIBOBJS@' +REMOTE='@REMOTE@' # Common prefix for machine-independent installed files. prefix=/usr/local @@ -43,7 +44,7 @@ set -e # These are all the objects we need to link together. -objs=" commands.o job.o dir.o file.o misc.o main.o read.o remake.o remote.o rule.o implicit.o default.o variable.o expand.o function.o vpath.o version.o ar.o arscan.o signame.o getopt.o getopt1.o glob/glob.o glob/fnmatch.o ${extras} ${ALLOCA}" +objs="commands.o job.o dir.o file.o misc.o main.o read.o remake.o rule.o implicit.o default.o variable.o expand.o function.o vpath.o version.o ar.o arscan.o signame.o getopt.o getopt1.o glob/glob.o glob/fnmatch.o remote-${REMOTE}.o ${extras} ${ALLOCA}" # Compile the source files into those objects. for file in `echo ${objs} | sed 's/\.o/.c/g'`; do diff -ruN make-3.63/commands.c make-3.64/commands.c --- make-3.63/commands.c Wed Jan 6 17:57:24 1993 +++ make-3.64/commands.c Sun Feb 21 15:05:54 1993 @@ -38,9 +38,6 @@ register char *p; char *at, *percent, *star, *less; -#define DEFINE_VARIABLE(name, len, value) \ - (void) define_variable_for_file (name, len, value, o_automatic, 0, file) - #ifndef NO_ARCHIVES /* If the target is an archive member `lib(member)', then $@ is `lib' and $% is `member'. */ @@ -47,26 +44,23 @@ if (ar_name (file->name)) { + unsigned int len; p = index (file->name, '('); - at = savestring (file->name, p - file->name); - ++p; - percent = savestring (p, strlen (p) - 1); + at = (char *) alloca (p - file->name + 1); + bcopy (file->name, at, p - file->name); + at[p - file->name] = '\0'; + len = strlen (p + 1); + percent = (char *) alloca (len); + bcopy (p + 1, percent, len - 1); + percent[len - 1] = '\0'; } else #endif /* NO_ARCHIVES. */ { - at = savestring (file->name, strlen (file->name)); + at = file->name; percent = ""; } - DEFINE_VARIABLE ("@", 1, at); - DEFINE_VARIABLE ("%", 1, percent); - -#define LASTSLASH(s) rindex ((s), '/') -#define FILEONLY(s) (p != 0 ? p + 1 : (s)) -#define DIRONLY(s) (p == 0 ? "./" : p == (s) ? "/" \ - : savestring ((s), (p - (s)) + 1)) - /* $* is the stem from an implicit or static pattern rule. */ if (file->stem == 0) { @@ -104,8 +98,6 @@ } star = file->stem; - DEFINE_VARIABLE ("*", 1, star); - /* $< is the first dependency. */ less = file->deps != 0 ? dep_name (file->deps) : ""; @@ -114,21 +106,15 @@ In this case $< is the same as $@. */ less = at; - DEFINE_VARIABLE ("<", 1, less); +#define DEFINE_VARIABLE(name, len, value) \ + (void) define_variable_for_file (name, len, value, o_automatic, 0, file) - /* Set up the D and F versions. */ - p = LASTSLASH (at); - DEFINE_VARIABLE ("@D", 2, DIRONLY (at)); - DEFINE_VARIABLE ("@F", 2, FILEONLY (at)); - p = LASTSLASH (star); - DEFINE_VARIABLE ("*D", 2, DIRONLY (star)); - DEFINE_VARIABLE ("*F", 2, FILEONLY (star)); - p = LASTSLASH (less); - DEFINE_VARIABLE ("deps); - /* Compute the values for $^ and $? and their F and D versions. */ + /* Compute the values for $^ and $?. */ { register unsigned int caret_len, qmark_len; - char *caret_value, *caretD_value, *caretF_value; - register char *cp, *cDp, *cFp; - char *qmark_value, *qmarkD_value, *qmarkF_value; - register char *qp, *qDp, *qFp; + char *caret_value; + register char *cp; + char *qmark_value; + register char *qp; register struct dep *d; unsigned int len; - unsigned int caretD_len, qmarkD_len; caret_len = qmark_len = 0; - caretD_len = qmarkD_len = 0; for (d = file->deps; d != 0; d = d->next) { register unsigned int i = strlen (dep_name (d)) + 1; caret_len += i; - caretD_len += (i <= 2 ? 3 : i); if (d->changed) - { - qmark_len += i; - qmarkD_len += (i <= 2 ? 3 : i); - } + qmark_len += i; } len = caret_len == 0 ? 1 : caret_len; - if (caretD_len == 0) - caretD_len = 1; cp = caret_value = (char *) alloca (len); - cDp = caretD_value = (char *) alloca (caretD_len); - cFp = caretF_value = (char *) alloca (len); len = qmark_len == 0 ? 1 : qmark_len; - if (qmarkD_len == 0) - qmarkD_len = 1; qp = qmark_value = (char *) alloca (len); - qDp = qmarkD_value = (char *) alloca (qmarkD_len); - qFp = qmarkF_value = (char *) alloca (len); for (d = file->deps; d != 0; d = d->next) { - char *c, *cD, *cF; - unsigned int Dlen, Flen; - - c = dep_name (d); + char *c = dep_name (d); #ifndef NO_ARCHIVES if (ar_name (c)) @@ -196,46 +165,11 @@ cp += len; *cp++ = ' '; - p = LASTSLASH (c); - if (p == 0) - { - cF = c; - Flen = len; - cD = "./"; - Dlen = 2; - } - else if (p == c) - { - cD = c; - Dlen = 1; - cF = c + 1; - Flen = len - 1; - } - else - { - cF = p + 1; - Flen = len - (p + 1 - c); - cD = c; - Dlen = p - c; - } - bcopy (cD, cDp, Dlen); - cDp += Dlen; - *cDp++ = ' '; - bcopy (cF, cFp, Flen); - cFp += Flen; - *cFp++ = ' '; - if (d->changed) { bcopy (c, qp, len); qp += len; *qp++ = ' '; - bcopy (cD, qDp, Dlen); - qDp += Dlen; - *qDp++ = ' '; - bcopy (cF, qFp, Flen); - qFp += Flen; - *qFp++ = ' '; } } @@ -243,27 +177,16 @@ cp[cp > caret_value ? -1 : 0] = '\0'; DEFINE_VARIABLE ("^", 1, caret_value); - cDp[cDp > caretD_value ? -1 : 0] = '\0'; - DEFINE_VARIABLE ("^D", 2, caretD_value); - cFp[cFp > caretF_value ? -1 : 0] = '\0'; - DEFINE_VARIABLE ("^F", 2, caretF_value); qp[qp > qmark_value ? -1 : 0] = '\0'; DEFINE_VARIABLE ("?", 1, qmark_value); - qDp[qDp > qmarkD_value ? -1 : 0] = '\0'; - DEFINE_VARIABLE ("?D", 2, qmarkD_value); - qFp[qFp > qmarkF_value ? -1 : 0] = '\0'; - DEFINE_VARIABLE ("?F", 2, qmarkF_value); } -#undef LASTSLASH -#undef FILEONLY -#undef DIRONLY - #undef DEFINE_VARIABLE } -/* Chop CMDS up into individual command lines if necessary. */ +/* Chop CMDS up into individual command lines if necessary. + Also set the `lines_flag' and `any_recurse' members. */ void chop_commands (cmds) @@ -272,7 +195,7 @@ if (cmds != 0 && cmds->command_lines == 0) { /* Chop CMDS->commands up into lines in CMDS->command_lines. - Also set the corresponding CMDS->lines_recurse elements, + Also set the corresponding CMDS->lines_flags elements, and the CMDS->any_recurse flag. */ register char *p; unsigned int nlines, idx; @@ -325,22 +248,36 @@ cmds->command_lines = lines; cmds->any_recurse = 0; - cmds->lines_recurse = (char *) xmalloc (nlines); + cmds->lines_flags = (char *) xmalloc (nlines); for (idx = 0; idx < nlines; ++idx) { - int recursive; - p = lines[idx]; - while (isblank (*p) || *p == '-' || *p == '@') - ++p; - recursive = *p == '+'; - if (!recursive) + int flags = 0; + + for (p = lines[idx]; + isblank (*p) || *p == '-' || *p == '@' || *p == '+'; + ++p) + switch (*p) + { + case '+': + flags |= COMMANDS_RECURSE; + break; + case '@': + flags |= COMMANDS_SILENT; + break; + case '-': + flags |= COMMANDS_NOERROR; + break; + } + if (!(flags & COMMANDS_RECURSE)) { unsigned int len = strlen (p); - recursive = (sindex (p, len, "$(MAKE)", 7) != 0 - || sindex (p, len, "${MAKE}", 7) != 0); + if (sindex (p, len, "$(MAKE)", 7) != 0 + || sindex (p, len, "${MAKE}", 7) != 0) + flags |= COMMANDS_RECURSE; } - cmds->lines_recurse[idx] = recursive; - cmds->any_recurse |= recursive; + + cmds->lines_flags[idx] = flags; + cmds->any_recurse |= flags & COMMANDS_RECURSE; } } } diff -ruN make-3.63/commands.h make-3.64/commands.h --- make-3.63/commands.h Mon Jun 3 16:37:32 1991 +++ make-3.64/commands.h Fri Feb 5 17:31:57 1993 @@ -1,4 +1,4 @@ -/* Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. +/* Copyright (C) 1988, 1989, 1991, 1993 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -25,10 +25,15 @@ char *commands; /* Commands text. */ unsigned int ncommand_lines;/* Number of command lines. */ char **command_lines; /* Commands chopped up into lines. */ - char *lines_recurse; /* One flag for each line. */ - char any_recurse; /* Nonzero if any `lines_recurse' elt is. */ + char *lines_flags; /* One set of flag bits for each line. */ + int any_recurse; /* Nonzero if any `lines_recurse' elt has */ + /* the COMMANDS_RECURSE bit set. */ }; +/* Bits in `lines_flags'. */ +#define COMMANDS_RECURSE 1 /* Recurses: + or $(MAKE). */ +#define COMMANDS_SILENT 2 /* Silent: @. */ +#define COMMANDS_NOERROR 4 /* No errors: -. */ extern void execute_file_commands (); extern void print_commands (); diff -ruN make-3.63/config.h.in make-3.64/config.h.in --- make-3.63/config.h.in Fri Jan 22 19:31:42 1993 +++ make-3.64/config.h.in Wed Apr 21 15:19:40 1993 @@ -18,10 +18,6 @@ /* Define vfork as fork if vfork does not work. */ #undef vfork -/* Define if you have memory.h, and string.h doesn't declare the - mem* functions. */ -#undef NEED_MEMORY_H - /* Define if your struct nlist has an n_un member. */ #undef NLIST_NAME_UNION @@ -54,8 +50,12 @@ /* Define if the closedir function returns void instead of int. */ #undef VOID_CLOSEDIR -/* Define if on AIX 3. */ +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE #undef _ALL_SOURCE +#endif /* Define if on MINIX. */ #undef _MINIX @@ -93,6 +93,20 @@ /* Define if `union wait' is the type of the first arg to wait functions. */ #undef HAVE_UNION_WAIT +/* Define if `sys_siglist' is declared by . */ +#undef SYS_SIGLIST_DECLARED + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define to the name of the SCCS `get' command. */ +#undef SCCS_GET /* Define if you have getdtablesize. */ #undef HAVE_GETDTABLESIZE @@ -103,6 +117,9 @@ /* Define if you have _sys_siglist. */ #undef HAVE__SYS_SIGLIST +/* Define if you have psignal. */ +#undef HAVE_PSIGNAL + /* Define if you have dup2. */ #undef HAVE_DUP2 @@ -138,6 +155,12 @@ /* Define if you have the header file. */ #undef HAVE_FCNTL_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H /* Define if you have the header file. */ #undef HAVE_SYS_WAIT_H diff -ruN make-3.63/configure make-3.64/configure --- make-3.63/configure Fri Jan 22 17:16:47 1993 +++ make-3.64/configure Wed Apr 21 15:19:28 1993 @@ -70,6 +70,9 @@ fi eval "with_`echo $package|sed s/-/_/g`=1" ;; + -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v) + verbose=yes ;; + *) ;; esac fi @@ -154,6 +157,12 @@ case $dir in /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;; *) + if test -f $dir/installbsd; then + INSTALL="$dir/installbsd -c" # OSF1 + INSTALL_PROGRAM='$(INSTALL)' + INSTALL_DATA='$(INSTALL) -m 644' + break + fi if test -f $dir/install; then if grep dspmsg $dir/install >/dev/null 2>&1; then : # AIX @@ -193,7 +202,7 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then : else @@ -210,11 +219,16 @@ EOF eval "$CPP $DEFS conftest.c > conftest.out 2>&1" if egrep "yes" conftest.out >/dev/null 2>&1; then - DEFS="$DEFS -D_ALL_SOURCE=1" + { +test -n "$verbose" && \ +echo ' defining' _ALL_SOURCE +DEFS="$DEFS -D_ALL_SOURCE=1" SEDDEFS="${SEDDEFS}\${SEDdA}_ALL_SOURCE\${SEDdB}_ALL_SOURCE\${SEDdC}1\${SEDdD} \${SEDuA}_ALL_SOURCE\${SEDuB}_ALL_SOURCE\${SEDuC}1\${SEDuD} \${SEDeA}_ALL_SOURCE\${SEDeB}_ALL_SOURCE\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -224,11 +238,16 @@ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then ISC=1 # If later tests want to check for ISC. - DEFS="$DEFS -D_POSIX_SOURCE=1" + { +test -n "$verbose" && \ +echo ' defining' _POSIX_SOURCE +DEFS="$DEFS -D_POSIX_SOURCE=1" SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD} \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD} \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD} " +} + if test -n "$GCC"; then CC="$CC -posix" else @@ -240,7 +259,7 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then MINIX=1 fi @@ -248,21 +267,36 @@ # The Minix shell can't assign to the same variable on the same line! if test -n "$MINIX"; then - DEFS="$DEFS -D_POSIX_SOURCE=1" + { +test -n "$verbose" && \ +echo ' defining' _POSIX_SOURCE +DEFS="$DEFS -D_POSIX_SOURCE=1" SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD} \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD} \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD} " - DEFS="$DEFS -D_POSIX_1_SOURCE=2" +} + + { +test -n "$verbose" && \ +echo ' defining' _POSIX_1_SOURCE to be '2' +DEFS="$DEFS -D_POSIX_1_SOURCE=2" SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_1_SOURCE\${SEDdB}_POSIX_1_SOURCE\${SEDdC}2\${SEDdD} \${SEDuA}_POSIX_1_SOURCE\${SEDuB}_POSIX_1_SOURCE\${SEDuC}2\${SEDuD} \${SEDeA}_POSIX_1_SOURCE\${SEDeB}_POSIX_1_SOURCE\${SEDeC}2\${SEDeD} " - DEFS="$DEFS -D_MINIX=1" +} + + { +test -n "$verbose" && \ +echo ' defining' _MINIX +DEFS="$DEFS -D_MINIX=1" SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD} \${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD} \${SEDeA}_MINIX\${SEDeB}_MINIX\${SEDeC}1\${SEDeD} " +} + fi echo checking for ANSI C header files @@ -272,9 +306,9 @@ #include #include EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - # SunOS string.h does not declare mem*, contrary to ANSI. + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. echo '#include ' > conftest.c eval "$CPP $DEFS conftest.c > conftest.out 2>&1" if egrep "memchr" conftest.out >/dev/null 2>&1; then @@ -291,36 +325,18 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - DEFS="$DEFS -DSTDC_HEADERS=1" + { +test -n "$verbose" && \ +echo ' defining' STDC_HEADERS +DEFS="$DEFS -DSTDC_HEADERS=1" SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD} \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD} \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD} " -fi -rm -f conftest* -fi -rm -f conftest* +} fi rm -f conftest* - -echo checking whether string.h declares mem functions -echo '#include ' > conftest.c -eval "$CPP $DEFS conftest.c > conftest.out 2>&1" -if egrep "memchr" conftest.out >/dev/null 2>&1; then - : -else - echo checking for memory.h -cat > conftest.c < -EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` -if test -z "$err"; then - DEFS="$DEFS -DNEED_MEMORY_H=1" -SEDDEFS="${SEDDEFS}\${SEDdA}NEED_MEMORY_H\${SEDdB}NEED_MEMORY_H\${SEDdC}1\${SEDdD} -\${SEDuA}NEED_MEMORY_H\${SEDuB}NEED_MEMORY_H\${SEDuC}1\${SEDuD} -\${SEDeA}NEED_MEMORY_H\${SEDeB}NEED_MEMORY_H\${SEDeC}1\${SEDeD} -" fi rm -f conftest* @@ -327,83 +343,114 @@ fi rm -f conftest* - echo checking for unistd.h cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DHAVE_UNISTD_H=1" + { +test -n "$verbose" && \ +echo ' defining' HAVE_UNISTD_H +DEFS="$DEFS -DHAVE_UNISTD_H=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNISTD_H\${SEDdB}HAVE_UNISTD_H\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_UNISTD_H\${SEDuB}HAVE_UNISTD_H\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_UNISTD_H\${SEDeB}HAVE_UNISTD_H\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* echo checking for directory library header -echo checking for dirent.h +dirheader= +if test -z "$dirheader"; then + echo checking for dirent.h cat > conftest.c < #include +int main() { exit(0); } +int t() { DIR *dirp = opendir ("/"); } EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` -if test -z "$err"; then - DEFS="$DEFS -DDIRENT=1" +if eval $compile; then + { +test -n "$verbose" && \ +echo ' defining' DIRENT +DEFS="$DEFS -DDIRENT=1" SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD} \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD} \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD} -" dirheader=dirent.h +" +} + dirheader=dirent.h fi rm -f conftest* - +fi if test -z "$dirheader"; then -echo checking for sys/ndir.h + echo checking for sys/ndir.h cat > conftest.c < #include +int main() { exit(0); } +int t() { DIR *dirp = opendir ("/"); } EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` -if test -z "$err"; then - DEFS="$DEFS -DSYSNDIR=1" +if eval $compile; then + { +test -n "$verbose" && \ +echo ' defining' SYSNDIR +DEFS="$DEFS -DSYSNDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD} \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD} \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD} -" dirheader=sys/ndir.h +" +} + dirheader=sys/ndir.h fi rm -f conftest* - fi if test -z "$dirheader"; then -echo checking for sys/dir.h + echo checking for sys/dir.h cat > conftest.c < #include +int main() { exit(0); } +int t() { DIR *dirp = opendir ("/"); } EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` -if test -z "$err"; then - DEFS="$DEFS -DSYSDIR=1" +if eval $compile; then + { +test -n "$verbose" && \ +echo ' defining' SYSDIR +DEFS="$DEFS -DSYSDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD} \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD} \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD} -" dirheader=sys/dir.h +" +} + dirheader=sys/dir.h fi rm -f conftest* - fi if test -z "$dirheader"; then -echo checking for ndir.h + echo checking for ndir.h cat > conftest.c < #include +int main() { exit(0); } +int t() { DIR *dirp = opendir ("/"); } EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` -if test -z "$err"; then - DEFS="$DEFS -DNDIR=1" +if eval $compile; then + { +test -n "$verbose" && \ +echo ' defining' NDIR +DEFS="$DEFS -DNDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD} \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD} \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD} -" dirheader=ndir.h +" +} + dirheader=ndir.h fi rm -f conftest* - fi echo checking for closedir return value @@ -416,11 +463,16 @@ if test -s conftest && (./conftest; exit) 2>/dev/null; then : else - DEFS="$DEFS -DVOID_CLOSEDIR=1" + { +test -n "$verbose" && \ +echo ' defining' VOID_CLOSEDIR +DEFS="$DEFS -DVOID_CLOSEDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD} \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD} \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -430,15 +482,25 @@ if egrep "uid_t" conftest.out >/dev/null 2>&1; then : else - DEFS="$DEFS -Duid_t=int" + { +test -n "$verbose" && \ +echo ' defining' uid_t to be 'int' +DEFS="$DEFS -Duid_t=int" SEDDEFS="${SEDDEFS}\${SEDdA}uid_t\${SEDdB}uid_t\${SEDdC}int\${SEDdD} \${SEDuA}uid_t\${SEDuB}uid_t\${SEDuC}int\${SEDuD} \${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD} -" DEFS="$DEFS -Dgid_t=int" +" +} + { +test -n "$verbose" && \ +echo ' defining' gid_t to be 'int' +DEFS="$DEFS -Dgid_t=int" SEDDEFS="${SEDDEFS}\${SEDdA}gid_t\${SEDdB}gid_t\${SEDdC}int\${SEDdD} \${SEDuA}gid_t\${SEDuB}gid_t\${SEDuC}int\${SEDuD} \${SEDeA}gid_t\${SEDeB}gid_t\${SEDeC}int\${SEDeD} " +} + fi rm -f conftest* echo checking for pid_t in sys/types.h @@ -447,11 +509,16 @@ if egrep "pid_t" conftest.out >/dev/null 2>&1; then : else - DEFS="$DEFS -Dpid_t=int" + { +test -n "$verbose" && \ +echo ' defining' pid_t to be 'int' +DEFS="$DEFS -Dpid_t=int" SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD} \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD} \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD} " +} + fi rm -f conftest* @@ -463,26 +530,36 @@ #undef signal #endif extern void (*signal ()) (); -main() { exit(0); } -t() { int i; } +int main() { exit(0); } +int t() { int i; } EOF if eval $compile; then - DEFS="$DEFS -DRETSIGTYPE=void" + { +test -n "$verbose" && \ +echo ' defining' RETSIGTYPE to be 'void' +DEFS="$DEFS -DRETSIGTYPE=void" SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}void\${SEDdD} \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}void\${SEDuD} \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}void\${SEDeD} " +} + else - DEFS="$DEFS -DRETSIGTYPE=int" + { +test -n "$verbose" && \ +echo ' defining' RETSIGTYPE to be 'int' +DEFS="$DEFS -DRETSIGTYPE=int" SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD} \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD} \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD} " +} + fi rm -f conftest* -for hdr in limits.h sys/param.h fcntl.h +for hdr in limits.h sys/param.h fcntl.h string.h memory.h do trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'` echo checking for ${hdr} @@ -489,68 +566,122 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -D${trhdr}=1" + { +test -n "$verbose" && \ +echo ' defining' ${trhdr} +DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* done +echo checking whether $CC and cc understand -c and -o together echo 'foo(){}' > conftest.c -if ${CC-cc} -c conftest.c -o conftesto >/dev/null 2>&1 && test -f conftesto +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +if ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1 && \ +test -f conftest.o && ${CC-cc} -c conftest.c -o conftest.o >/dev/null 2>&1 && \ +cc -c conftest.c -o conftest2.o >/dev/null 2>&1 && \ +test -f conftest2.o && cc -c conftest.c -o conftest2.o >/dev/null 2>&1 then : else - DEFS="$DEFS -DNO_MINUS_C_MINUS_O=1" + { +test -n "$verbose" && \ +echo ' defining' NO_MINUS_C_MINUS_O +DEFS="$DEFS -DNO_MINUS_C_MINUS_O=1" SEDDEFS="${SEDDEFS}\${SEDdA}NO_MINUS_C_MINUS_O\${SEDdB}NO_MINUS_C_MINUS_O\${SEDdC}1\${SEDdD} \${SEDuA}NO_MINUS_C_MINUS_O\${SEDuB}NO_MINUS_C_MINUS_O\${SEDuC}1\${SEDuD} \${SEDeA}NO_MINUS_C_MINUS_O\${SEDeB}NO_MINUS_C_MINUS_O\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* prog='/* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *p; -char **p2; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +p = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ -++p; -p2 = (char const* const*) p;' +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25,17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +}' echo checking for working const cat > conftest.c < conftest.c < -main() { exit(0); } -t() { rindex(0, 0); bzero(0, 0); } +int main() { exit(0); } +int t() { rindex(0, 0); bzero(0, 0); } EOF if eval $compile; then : else - DEFS="$DEFS -DUSG=1" + { +test -n "$verbose" && \ +echo ' defining' USG +DEFS="$DEFS -DUSG=1" SEDDEFS="${SEDDEFS}\${SEDdA}USG\${SEDdB}USG\${SEDdC}1\${SEDdD} \${SEDuA}USG\${SEDuB}USG\${SEDuC}1\${SEDuD} \${SEDeA}USG\${SEDeB}USG\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -557,7 +688,7 @@ -for func in getdtablesize sys_siglist _sys_siglist \ +for func in getdtablesize sys_siglist _sys_siglist psignal \ dup2 getcwd sigsetmask getgroups setlinebuf \ setreuid setregid do @@ -565,8 +696,8 @@ echo checking for ${func} cat > conftest.c < -main() { exit(0); } -t() { +int main() { exit(0); } +int t() { #ifdef __stub_${func} choke me #else @@ -576,11 +707,16 @@ } EOF if eval $compile; then - DEFS="$DEFS -D${trfunc}=1" + { +test -n "$verbose" && \ +echo ' defining' ${trfunc} +DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* #endif @@ -591,15 +727,20 @@ echo checking for working alloca.h cat > conftest.c < -main() { exit(0); } -t() { char *p = alloca(2 * sizeof(int)); } +int main() { exit(0); } +int t() { char *p = alloca(2 * sizeof(int)); } EOF if eval $compile; then - DEFS="$DEFS -DHAVE_ALLOCA_H=1" + { +test -n "$verbose" && \ +echo ' defining' HAVE_ALLOCA_H +DEFS="$DEFS -DHAVE_ALLOCA_H=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -620,8 +761,8 @@ echo checking for alloca cat > conftest.c < conftest.c </dev/null; then + : +else + cross_compiling=1 +fi +rm -f conftest* + +if test -n "$cross_compiling" +then + { +test -n "$verbose" && \ +echo ' defining' STACK_DIRECTION to be '0' +DEFS="$DEFS -DSTACK_DIRECTION=0" +SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD} +\${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD} +\${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD} +" +} + +else +cat > conftest.c < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +eval $compile +if test -s conftest && (./conftest; exit) 2>/dev/null; then + { +test -n "$verbose" && \ +echo ' defining' STACK_DIRECTION to be '1' +DEFS="$DEFS -DSTACK_DIRECTION=1" +SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD} +\${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD} +\${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD} +" +} + +else + { +test -n "$verbose" && \ +echo ' defining' STACK_DIRECTION to be '-1' +DEFS="$DEFS -DSTACK_DIRECTION=-1" +SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD} +\${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD} +\${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD} +" +} + +fi +fi +rm -f conftest* fi echo checking for vfork.h @@ -642,13 +855,18 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DHAVE_VFORK_H=1" + { +test -n "$verbose" && \ +echo ' defining' HAVE_VFORK_H +DEFS="$DEFS -DHAVE_VFORK_H=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VFORK_H\${SEDdB}HAVE_VFORK_H\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_VFORK_H\${SEDuB}HAVE_VFORK_H\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_VFORK_H\${SEDeB}HAVE_VFORK_H\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -723,11 +941,16 @@ if test -s conftest && (./conftest; exit) 2>/dev/null; then : else - DEFS="$DEFS -Dvfork=fork" + { +test -n "$verbose" && \ +echo ' defining' vfork to be 'fork' +DEFS="$DEFS -Dvfork=fork" SEDDEFS="${SEDDEFS}\${SEDdA}vfork\${SEDdB}vfork\${SEDdC}fork\${SEDdD} \${SEDuA}vfork\${SEDuB}vfork\${SEDuC}fork\${SEDuD} \${SEDeA}vfork\${SEDeB}vfork\${SEDeC}fork\${SEDeD} " +} + fi rm -f conftest* @@ -735,7 +958,8 @@ #include main () { /* If setvbuf has the reversed format, exit 0. */ - setvbuf(stdout, _IOLBF, (char *) 0, BUFSIZ); /* The reversed way. */ + if (setvbuf(stdout, _IOLBF, (char *) 0, BUFSIZ) != 0)/* The reversed way. */ + exit(1); putc('\r', stdout); exit(0); /* Non-reversed systems segv here. */ } @@ -742,11 +966,16 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - DEFS="$DEFS -DSETVBUF_REVERSED=1" + { +test -n "$verbose" && \ +echo ' defining' SETVBUF_REVERSED +DEFS="$DEFS -DSETVBUF_REVERSED=1" SEDDEFS="${SEDDEFS}\${SEDdA}SETVBUF_REVERSED\${SEDdB}SETVBUF_REVERSED\${SEDdC}1\${SEDdD} \${SEDuA}SETVBUF_REVERSED\${SEDuB}SETVBUF_REVERSED\${SEDuC}1\${SEDuD} \${SEDeA}SETVBUF_REVERSED\${SEDeB}SETVBUF_REVERSED\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* rm -f core @@ -755,15 +984,14 @@ NEED_SETGID=false # Check for the 4.4BSD definition of getloadavg. -libname=`echo "utils" | sed 's/lib\([^\.]*\)\.a/\1/;s/-l//'` LIBS_save="${LIBS}" -LIBS="${LIBS} -l${libname}" +LIBS="${LIBS} -lutils" have_lib="" -echo checking for -l${libname} +echo checking for -lutils cat > conftest.c < conftest.c < conftest.c < conftest.c < conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DDGUX=1" + { +test -n "$verbose" && \ +echo ' defining' DGUX +DEFS="$DEFS -DDGUX=1" SEDDEFS="${SEDDEFS}\${SEDdA}DGUX\${SEDdB}DGUX\${SEDdC}1\${SEDdD} \${SEDuA}DGUX\${SEDuB}DGUX\${SEDuC}1\${SEDuD} \${SEDeA}DGUX\${SEDeB}DGUX\${SEDeC}1\${SEDeD} -" have_sym=1 +" +} + have_sym=1 fi rm -f conftest* @@ -863,13 +1096,18 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DSVR4=1" + { +test -n "$verbose" && \ +echo ' defining' SVR4 +DEFS="$DEFS -DSVR4=1" SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD} \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD} \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD} -" LIBS="$LIBS -lelf" have_sym=1 +" +} + LIBS="$LIBS -lelf" have_sym=1 fi rm -f conftest* @@ -880,22 +1118,26 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DSVR4=1" + { +test -n "$verbose" && \ +echo ' defining' SVR4 +DEFS="$DEFS -DSVR4=1" SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD} \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD} \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD} -" LIBS="$LIBS -lelf" have_sym=1 - libname=`echo "kvm" | sed 's/lib\(^\.*\)\.a/\1/;s/-l//'` -LIBS_save="${LIBS}" -LIBS="${LIBS} -l${libname}" +" +} + LIBS="$LIBS -lelf" have_sym=1 + LIBS_save="${LIBS}" +LIBS="${LIBS} -lkvm" have_lib="" -echo checking for -l${libname} +echo checking for -lkvm cat > conftest.c < conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DUMAX4_3=1" + { +test -n "$verbose" && \ +echo ' defining' UMAX4_3 +DEFS="$DEFS -DUMAX4_3=1" SEDDEFS="${SEDDEFS}\${SEDdA}UMAX4_3\${SEDdB}UMAX4_3\${SEDdC}1\${SEDdD} \${SEDuA}UMAX4_3\${SEDuB}UMAX4_3\${SEDuC}1\${SEDuD} \${SEDeA}UMAX4_3\${SEDeB}UMAX4_3\${SEDeC}1\${SEDeD} -" DEFS="$DEFS -DUMAX=1" +" +} + { +test -n "$verbose" && \ +echo ' defining' UMAX +DEFS="$DEFS -DUMAX=1" SEDDEFS="${SEDDEFS}\${SEDdA}UMAX\${SEDdB}UMAX\${SEDdC}1\${SEDdD} \${SEDuA}UMAX\${SEDuB}UMAX\${SEDuC}1\${SEDuD} \${SEDeA}UMAX\${SEDeB}UMAX\${SEDeC}1\${SEDeD} -" have_sym=1 +" +} + have_sym=1 fi rm -f conftest* @@ -937,13 +1189,18 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DUMAX=1" + { +test -n "$verbose" && \ +echo ' defining' UMAX +DEFS="$DEFS -DUMAX=1" SEDDEFS="${SEDDEFS}\${SEDdA}UMAX\${SEDdB}UMAX\${SEDdC}1\${SEDdD} \${SEDuA}UMAX\${SEDuB}UMAX\${SEDuC}1\${SEDuD} \${SEDeA}UMAX\${SEDeB}UMAX\${SEDeC}1\${SEDeD} -" have_sym=1 +" +} + have_sym=1 fi rm -f conftest* @@ -953,25 +1210,35 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -DNLIST_STRUCT=1" + { +test -n "$verbose" && \ +echo ' defining' NLIST_STRUCT +DEFS="$DEFS -DNLIST_STRUCT=1" SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_STRUCT\${SEDdB}NLIST_STRUCT\${SEDdC}1\${SEDdD} \${SEDuA}NLIST_STRUCT\${SEDuB}NLIST_STRUCT\${SEDuC}1\${SEDuD} \${SEDeA}NLIST_STRUCT\${SEDeB}NLIST_STRUCT\${SEDeC}1\${SEDeD} " +} + echo checking for n_un in struct nlist cat > conftest.c < -main() { exit(0); } -t() { struct nlist n; n.n_un.n_name = 0; } +int main() { exit(0); } +int t() { struct nlist n; n.n_un.n_name = 0; } EOF if eval $compile; then - DEFS="$DEFS -DNLIST_NAME_UNION=1" + { +test -n "$verbose" && \ +echo ' defining' NLIST_NAME_UNION +DEFS="$DEFS -DNLIST_NAME_UNION=1" SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_NAME_UNION\${SEDdB}NLIST_NAME_UNION\${SEDdC}1\${SEDdD} \${SEDuA}NLIST_NAME_UNION\${SEDuB}NLIST_NAME_UNION\${SEDuC}1\${SEDuD} \${SEDeA}NLIST_NAME_UNION\${SEDeB}NLIST_NAME_UNION\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -989,28 +1256,46 @@ EOF eval "$CPP $DEFS conftest.c > conftest.out 2>&1" if egrep "Yowza Am I SETGID yet" conftest.out >/dev/null 2>&1; then - DEFS="$DEFS -DGETLOADAVG_PRIVILEGED=1" + { +test -n "$verbose" && \ +echo ' defining' GETLOADAVG_PRIVILEGED +DEFS="$DEFS -DGETLOADAVG_PRIVILEGED=1" SEDDEFS="${SEDDEFS}\${SEDdA}GETLOADAVG_PRIVILEGED\${SEDdB}GETLOADAVG_PRIVILEGED\${SEDdC}1\${SEDdD} \${SEDuA}GETLOADAVG_PRIVILEGED\${SEDuB}GETLOADAVG_PRIVILEGED\${SEDuC}1\${SEDuD} \${SEDeA}GETLOADAVG_PRIVILEGED\${SEDeB}GETLOADAVG_PRIVILEGED\${SEDeC}1\${SEDeD} -" NEED_SETGID=true +" +} + NEED_SETGID=true fi rm -f conftest* ;; esac +if $NEED_SETGID; then + # Figure out what group owns /dev/kmem. + # The installed program will need to be setgid and owned by that group. + KMEM_GROUP=`ls -lg /dev/kmem | + sed 's/^.[rwx-]*[ ]*[0-9]*[ ]*[^ ]*\ +[ ]*\([^ ]*\)[ ].*$/\1/'` +fi + echo checking for strcoll cat > conftest.c < -main() { exit(0); } -t() { strcoll ("abc", "abc"); } +int main() { exit(0); } +int t() { strcoll ("abc", "abc"); } EOF if eval $compile; then - DEFS="$DEFS -DHAVE_STRCOLL=1" + { +test -n "$verbose" && \ +echo ' defining' HAVE_STRCOLL +DEFS="$DEFS -DHAVE_STRCOLL=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STRCOLL\${SEDdB}HAVE_STRCOLL\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_STRCOLL\${SEDuB}HAVE_STRCOLL\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_STRCOLL\${SEDeB}HAVE_STRCOLL\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* @@ -1022,13 +1307,18 @@ cat > conftest.c < EOF -err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +err=`eval "($CPP $DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - DEFS="$DEFS -D${trhdr}=1" + { +test -n "$verbose" && \ +echo ' defining' ${trhdr} +DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* done @@ -1038,8 +1328,8 @@ echo checking for ${func} cat > conftest.c < -main() { exit(0); } -t() { +int main() { exit(0); } +int t() { #ifdef __stub_${func} choke me #else @@ -1049,11 +1339,16 @@ } EOF if eval $compile; then - DEFS="$DEFS -D${trfunc}=1" + { +test -n "$verbose" && \ +echo ' defining' ${trfunc} +DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD} " +} + fi rm -f conftest* #endif @@ -1063,15 +1358,52 @@ cat > conftest.c < #include -main() { exit(0); } -t() { union wait status; return wait (&status); } +int main() { exit(0); } +int t() { union wait status; int pid; pid = wait (&status); +#ifdef WEXITSTATUS +/* Some POSIXoid systems have both the new-style macros and the old + union wait type, and they do not work together. If union wait + conflicts with WEXITSTATUS et al, we don't want to use it at all. */ +if (WEXITSTATUS (status) != 0) pid = -1; +#endif +#ifdef HAVE_WAITPID +/* Make sure union wait works with waitpid. */ +pid = waitpid (-1, &status, 0); +#endif + } EOF if eval $compile; then - DEFS="$DEFS -DHAVE_UNION_WAIT=1" + { +test -n "$verbose" && \ +echo ' defining' HAVE_UNION_WAIT +DEFS="$DEFS -DHAVE_UNION_WAIT=1" SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNION_WAIT\${SEDdB}HAVE_UNION_WAIT\${SEDdC}1\${SEDdD} \${SEDuA}HAVE_UNION_WAIT\${SEDuB}HAVE_UNION_WAIT\${SEDuC}1\${SEDuD} \${SEDeA}HAVE_UNION_WAIT\${SEDeB}HAVE_UNION_WAIT\${SEDeC}1\${SEDeD} " +} + +fi +rm -f conftest* + + +echo checking for sys_siglist declaration in signal.h +cat > conftest.c < +int main() { exit(0); } +int t() { char *msg = *(sys_siglist + 1); } +EOF +if eval $compile; then + { +test -n "$verbose" && \ +echo ' defining' SYS_SIGLIST_DECLARED +DEFS="$DEFS -DSYS_SIGLIST_DECLARED=1" +SEDDEFS="${SEDDEFS}\${SEDdA}SYS_SIGLIST_DECLARED\${SEDdB}SYS_SIGLIST_DECLARED\${SEDdC}1\${SEDdD} +\${SEDuA}SYS_SIGLIST_DECLARED\${SEDuB}SYS_SIGLIST_DECLARED\${SEDuC}1\${SEDuD} +\${SEDeA}SYS_SIGLIST_DECLARED\${SEDeB}SYS_SIGLIST_DECLARED\${SEDeC}1\${SEDeD} +" +} + fi rm -f conftest* @@ -1108,11 +1440,16 @@ rm -f conftest* if test -n "$XENIX"; then - DEFS="$DEFS -DVOID_CLOSEDIR=1" + { +test -n "$verbose" && \ +echo ' defining' VOID_CLOSEDIR +DEFS="$DEFS -DVOID_CLOSEDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD} \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD} \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD} " +} + LIBS="$LIBS -lx" case "$DEFS" in *SYSNDIR*) ;; @@ -1121,6 +1458,39 @@ fi + REMOTE=stub +# check whether --with-customs was given +if test -n "$-"; then + REMOTE=cstms +LIBS="$LIBS libcustoms.a" +fi + + +echo checking for location of SCCS get command +if test -f /usr/sccs/get; then + { +test -n "$verbose" && \ +echo ' defining' SCCS_GET to be '"/usr/sccs/get"' +DEFS="$DEFS -DSCCS_GET=\"/usr/sccs/get\"" +SEDDEFS="${SEDDEFS}\${SEDdA}SCCS_GET\${SEDdB}SCCS_GET\${SEDdC}\"/usr/sccs/get\"\${SEDdD} +\${SEDuA}SCCS_GET\${SEDuB}SCCS_GET\${SEDuC}\"/usr/sccs/get\"\${SEDuD} +\${SEDeA}SCCS_GET\${SEDeB}SCCS_GET\${SEDeC}\"/usr/sccs/get\"\${SEDeD} +" +} + +else + { +test -n "$verbose" && \ +echo ' defining' SCCS_GET to be '"get"' +DEFS="$DEFS -DSCCS_GET=\"get\"" +SEDDEFS="${SEDDEFS}\${SEDdA}SCCS_GET\${SEDdB}SCCS_GET\${SEDdC}\"get\"\${SEDdD} +\${SEDuA}SCCS_GET\${SEDuB}SCCS_GET\${SEDuC}\"get\"\${SEDuD} +\${SEDeA}SCCS_GET\${SEDeB}SCCS_GET\${SEDeC}\"get\"\${SEDeD} +" +} + +fi + if test -n "$prefix"; then test -z "$exec_prefix" && exec_prefix='${prefix}' prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" @@ -1139,7 +1509,7 @@ # Generated automatically by configure. # Run this file to recreate the current configuration. # This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null`: +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # $0 $* @@ -1164,6 +1534,8 @@ LIBOBJS='$LIBOBJS' ALLOCA='$ALLOCA' NEED_SETGID='$NEED_SETGID' +KMEM_GROUP='$KMEM_GROUP' +REMOTE='$REMOTE' LIBS='$LIBS' srcdir='$srcdir' prefix='$prefix' @@ -1197,6 +1569,8 @@ s%@LIBOBJS@%$LIBOBJS%g s%@ALLOCA@%$ALLOCA%g s%@NEED_SETGID@%$NEED_SETGID%g +s%@KMEM_GROUP@%$KMEM_GROUP%g +s%@REMOTE@%$REMOTE%g s%@LIBS@%$LIBS%g s%@srcdir@%$srcdir%g s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file @@ -1224,14 +1598,37 @@ SEDeC=' ' SEDeD='@g' rm -f conftest.sed -cat > conftest.sed <> config.status < conftest.sh < conftest.s1 # Like head -20. + sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21. + # Write a limited-size here document to append to conftest.sed. + echo 'cat >> conftest.sed <> config.status + cat conftest.s1 >> config.status + echo 'CONFEOF' >> config.status + rm -f conftest.s1 conftest.sh + mv conftest.s2 conftest.sh +done +rm -f conftest.sh + +# Now back to your regularly scheduled config.status. cat >> config.status <<\EOF -CONFEOF # This sed command replaces #undef's with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it in diff -ruN make-3.63/configure.in make-3.64/configure.in --- make-3.63/configure.in Fri Jan 22 17:16:40 1993 +++ make-3.64/configure.in Thu Apr 15 20:54:50 1993 @@ -14,13 +14,12 @@ AC_ISC_POSIX AC_MINIX AC_STDC_HEADERS -AC_MEMORY_H AC_UNISTD_H AC_DIR_HEADER AC_UID_T dnl Also does gid_t. AC_PID_T AC_RETSIGTYPE -AC_HAVE_HEADERS(limits.h sys/param.h fcntl.h) +AC_HAVE_HEADERS(limits.h sys/param.h fcntl.h string.h memory.h) AC_MINUS_C_MINUS_O AC_CONST dnl getopt needs this. AC_USG @@ -27,7 +26,7 @@ AC_SUBST(LIBOBJS) -AC_HAVE_FUNCS(getdtablesize sys_siglist _sys_siglist \ +AC_HAVE_FUNCS(getdtablesize sys_siglist _sys_siglist psignal \ dup2 getcwd sigsetmask getgroups setlinebuf \ setreuid setregid) AC_ALLOCA @@ -40,13 +39,39 @@ AC_HAVE_HEADERS(sys/wait.h) AC_HAVE_FUNCS(waitpid wait3) AC_COMPILE_CHECK(union wait, [#include #include ], - [union wait status; return wait (&status);], + [union wait status; int pid; pid = wait (&status); +#ifdef WEXITSTATUS +/* Some POSIXoid systems have both the new-style macros and the old + union wait type, and they do not work together. If union wait + conflicts with WEXITSTATUS et al, we don't want to use it at all. */ +if (WEXITSTATUS (status) != 0) pid = -1; +#endif +#ifdef HAVE_WAITPID +/* Make sure union wait works with waitpid. */ +pid = waitpid (-1, &status, 0); +#endif +], AC_DEFINE(HAVE_UNION_WAIT)) +AC_COMPILE_CHECK(sys_siglist declaration in signal.h, + [#include ], [char *msg = *(sys_siglist + 1);], + AC_DEFINE(SYS_SIGLIST_DECLARED)) + # The presence of the following is not meant to imply # that make necessarily works on those systems. AC_DYNIX_SEQ AC_XENIX_DIR + +AC_SUBST(REMOTE) REMOTE=stub +AC_WITH(customs, [REMOTE=cstms +LIBS="$LIBS libcustoms.a"]) + +echo checking for location of SCCS get command +if test -f /usr/sccs/get; then + AC_DEFINE(SCCS_GET, "/usr/sccs/get") +else + AC_DEFINE(SCCS_GET, "get") +fi AC_OUTPUT(Makefile build.sh glob/Makefile) diff -ruN make-3.63/default.c make-3.64/default.c --- make-3.63/default.c Tue Dec 22 17:31:16 1992 +++ make-3.64/default.c Thu Apr 15 20:54:40 1993 @@ -1,5 +1,5 @@ /* Data base of default implicit rules for GNU Make. -Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -30,7 +30,8 @@ static char default_suffixes[] = ".out .a .ln .o .c .cc .C .p .f .F .r .y .l .s .S \ -.mod .sym .def .h .info .dvi .tex .texinfo .texi .cweb .web .sh .elc .el"; +.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ +.cweb .web .sh .elc .el"; static struct pspec default_pattern_rules[] = { @@ -150,11 +151,14 @@ "$(PREPROCESS.S) $< > $@", ".texinfo.info", - "$(MAKEINFO) $<", + "$(MAKEINFO) $< -o $@", ".texi.info", - "$(MAKEINFO) $<", + "$(MAKEINFO) $< -o $@", + ".txinfo.info", + "$(MAKEINFO) $< -o $@", + ".tex.dvi", "$(TEX) $<", @@ -164,6 +168,9 @@ ".texi.dvi", "$(TEXI2DVI) $<", + ".txinfo.dvi", + "$(TEXI2DVI) $<", + ".cweb.c", "$(CTANGLE) $<", @@ -216,11 +223,7 @@ "F77", "$(FC)", "F77FLAGS", "$(FFLAGS)", #endif /* Cray. */ -#if defined (USG) || defined (ultrix) || defined (_IBMR2) - "GET", "get", -#else - "GET", "/usr/sccs/get", -#endif + "GET", SCCS_GET, "LD", "ld", "LEX", "lex", "LINT", "lint", @@ -303,7 +306,7 @@ char *p = default_suffixes; suffix_file->deps = (struct dep *) multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep)), - sizeof (struct dep)); + sizeof (struct dep), 1); (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0); } } diff -ruN make-3.63/dir.c make-3.64/dir.c --- make-3.63/dir.c Fri Jan 22 14:46:10 1993 +++ make-3.64/dir.c Mon Apr 12 16:51:44 1993 @@ -18,33 +18,26 @@ #include "make.h" -#if defined (USGr3) && !defined (DIRENT) -#define DIRENT -#endif /* USGr3 */ -#if defined (Xenix) && !defined (SYSNDIR) -#define SYSNDIR -#endif /* Xenix */ - -#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__) +#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__) #include #ifndef __GNU_LIBRARY__ #define D_NAMLEN(d) strlen((d)->d_name) -#else +#else /* GNU C library. */ #define D_NAMLEN(d) ((d)->d_namlen) -#endif -#else /* not POSIX or DIRENT */ +#endif /* Not GNU C library. */ +#else /* Not POSIX or DIRENT. */ #define direct dirent #define D_NAMLEN(d) ((d)->d_namlen) -#if defined (USG) && !defined (sgi) -#if defined (SYSNDIR) +#ifdef SYSNDIR #include -#else /* SYSNDIR */ -#include "ndir.h" -#endif /* not SYSNDIR */ -#else /* not USG */ +#endif /* SYSNDIR */ +#ifdef SYSDIR #include -#endif /* USG */ -#endif /* POSIX or DIRENT or __GNU_LIBRARY__ */ +#endif /* SYSDIR */ +#ifdef NDIR +#include +#endif /* NDIR */ +#endif /* POSIX or DIRENT or __GNU_LIBRARY__. */ #if defined (POSIX) && !defined (__GNU_LIBRARY__) /* Posix does not require that the d_ino field be present, and some diff -ruN make-3.63/expand.c make-3.64/expand.c --- make-3.63/expand.c Tue Dec 22 18:44:03 1992 +++ make-3.64/expand.c Wed Feb 3 15:59:22 1993 @@ -1,5 +1,5 @@ /* Variable expansion functions for GNU Make. -Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc. +Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -179,7 +179,7 @@ else if (*p == closeparen && --count < 0) break; } - /* If count is >= 0, there were unmatched opening parens + /* If COUNT is >= 0, there were unmatched opening parens or braces, so we go to the simple case of a variable name such as `$($(a)'. */ if (count < 0) diff -ruN make-3.63/file.c make-3.64/file.c --- make-3.63/file.c Tue Dec 22 17:31:13 1992 +++ make-3.64/file.c Wed Mar 10 15:24:57 1993 @@ -1,4 +1,5 @@ -/* Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 + Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -174,7 +175,8 @@ unsigned int oldhash; char *oldname; { - register unsigned int newhash; + unsigned int oldbucket = oldhash % FILE_BUCKETS; + register unsigned int newhash, newbucket; struct file *oldfile; register char *n; register struct file *f; @@ -182,27 +184,25 @@ newhash = 0; for (n = name; *n != '\0'; ++n) HASH (newhash, *n); - newhash %= FILE_BUCKETS; + newbucket = newhash % FILE_BUCKETS; /* Look for an existing file under the new name. */ - for (oldfile = files[newhash]; oldfile != 0; oldfile = oldfile->next) + for (oldfile = files[newbucket]; oldfile != 0; oldfile = oldfile->next) if (streq (oldfile->name, name)) break; - if (oldhash != 0 && (newhash != oldhash || oldfile != 0)) + if (oldhash != 0 && (newbucket != oldbucket || oldfile != 0)) { /* Remove FILE from its hash bucket. */ struct file *lastf = 0; - oldhash %= FILE_BUCKETS; - - for (f = files[oldhash]; f != file; f = f->next) + for (f = files[oldbucket]; f != file; f = f->next) lastf = f; if (lastf == 0) - files[oldhash] = f->next; + files[oldbucket] = f->next; else lastf->next = f->next; } @@ -216,11 +216,11 @@ { /* There is no existing file with the new name. */ - if (newhash != oldhash) + if (newbucket != oldbucket) { /* Put FILE in its new hash bucket. */ - file->next = files[newhash]; - files[newhash] = file; + file->next = files[newbucket]; + files[newbucket] = file; } } else diff -ruN make-3.63/file.h make-3.64/file.h --- make-3.63/file.h Sun Aug 2 07:28:01 1992 +++ make-3.64/file.h Mon Jan 25 17:45:49 1993 @@ -1,4 +1,5 @@ -/* Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 + Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -57,15 +58,15 @@ unsigned int double_colon:1;/* Nonzero for double-colon entry */ unsigned int precious:1; /* Non-0 means don't delete file on quit */ - unsigned int tried_implicit:1;/* Nonzero if have searched - for implicit rule for making - this file; don't search again. */ + unsigned int tried_implicit:1; /* Nonzero if have searched + for implicit rule for making + this file; don't search again. */ unsigned int updating:1; /* Nonzero while updating deps of this file */ unsigned int updated:1; /* Nonzero if this file has been remade. */ unsigned int is_target:1; /* Nonzero if file is described as target. */ unsigned int cmd_target:1; /* Nonzero if file was given on cmd line. */ unsigned int phony:1; /* Nonzero if this is a phony file - ie, a dependent of .PHONY. */ + i.e., a dependency of .PHONY. */ unsigned int intermediate:1;/* Nonzero if this is an intermediate file. */ unsigned int dontcare:1; /* Nonzero if no complaint is to be made if this target cannot be remade. */ diff -ruN make-3.63/function.c make-3.64/function.c --- make-3.63/function.c Wed Jan 6 17:57:35 1993 +++ make-3.64/function.c Thu Apr 15 18:29:47 1993 @@ -1141,8 +1141,12 @@ register struct nameseq *chain; register unsigned int idx; - chain = multi_glob (parse_file_seq (&line, '\0', sizeof (struct nameseq)), - sizeof (struct nameseq)); + chain = multi_glob (parse_file_seq (&line, '\0', sizeof (struct nameseq), 0), + sizeof (struct nameseq), + /* We do not want parse_file_seq to strip `./'s. + That would break examples like: + $(patsubst ./%.c,obj/%.o,$(wildcard ./*.c)) */ + 0); if (result == 0) { diff -ruN make-3.63/getloadavg.c make-3.64/getloadavg.c --- make-3.63/getloadavg.c Fri Jan 22 18:02:43 1993 +++ make-3.64/getloadavg.c Thu Apr 15 16:36:37 1993 @@ -41,6 +41,8 @@ eunice UNIX emulator under VMS. NeXT sgi + sequent Sequent Dynix 3.x.x (BSD) + _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV) sony_news NEWS-OS (works at least for 4.1C) UMAX UMAX4_3 @@ -52,6 +54,8 @@ We also #define LDAV_PRIVILEGED if a program will require special installation to be able to call getloadavg. */ +#include + /* Both the Emacs and non-Emacs sections want this. Some configuration files' definitions for the LOAD_AVE_CVT macro (like sparc.h's) use macros like FSCALE, defined here. */ @@ -88,6 +92,10 @@ conflicts with the definition understood in this file, that this really is BSD. */ #undef BSD + +/* NeXT defines FSCALE in . However, we take FSCALE being + defined to mean that the nlist method should be used, which is not true. */ +#undef FSCALE #endif /* Set values that are different from the defaults, which are @@ -107,8 +115,12 @@ #define SUNOS_5 #endif +#if defined (__osf__) && defined (__alpha__) +#define OSF_ALPHA +#endif -#if defined(MORE_BSD) || defined(sun) || defined(decstation) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) +/* VAX C can't handle multi-line #ifs. */ +#if (defined(MORE_BSD) || defined(sun) || defined(decstation) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(sequent) || defined (OSF_ALPHA)) #define LOAD_AVE_TYPE long #endif @@ -125,18 +137,18 @@ #define FSCALE 256 #endif -#ifdef sgi +#if defined (sgi) || defined (sequent) #define FSCALE 1000.0 #endif -#ifdef FSCALE -#define LDAV_CVT(n) (((double) (n)) / FSCALE) -#endif - #endif /* Not FSCALE. */ +#if !defined (LDAV_CVT) && defined (FSCALE) +#define LDAV_CVT(n) (((double) (n)) / FSCALE) +#endif -#if !defined(NLIST_STRUCT) && (defined(MORE_BSD) || defined(sun) || defined(decstation) || defined(hpux) || defined(_SEQUENT_) || defined(sequent) || defined(sgi) || defined(SVR4) || defined(sony_news)) +/* VAX C can't handle multi-line #ifs. */ +#if !defined(NLIST_STRUCT) && (defined(MORE_BSD) || defined(sun) || defined(decstation) || defined(hpux) || defined(_SEQUENT_) || defined(sequent) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined (OSF_ALPHA)) #define NLIST_STRUCT #endif @@ -171,12 +183,6 @@ #include #endif -#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION) -#include -#else -#include -#endif - #include #include @@ -229,11 +235,10 @@ #endif /* LOAD_AVE_TYPE */ #ifdef NeXT -#include +#include #endif /* NeXT */ #ifdef sgi -#include #include #endif /* sgi */ @@ -241,7 +246,6 @@ #include #include #include -#include #include #include @@ -264,6 +268,12 @@ #ifdef DGUX #include #endif + +#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION) +#include +#else +#include +#endif /* Avoid static vars inside a function since in HPUX they dump as pure. */ @@ -313,13 +323,19 @@ #if !defined (LDAV_DONE) && defined (NeXT) #define LDAV_DONE - /* The NeXT code was adapted from iscreen 3.2. - We only know how to get the 1-minute average for this system. */ + /* The NeXT code was adapted from iscreen 3.2. */ host_t host; struct processor_set_basic_info info; unsigned info_count; + if (nelem > 1) + { + /* We only know how to get the 1-minute average for this system. */ + errno = EINVAL; + return -1; + } + if (!initialized) { if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS) @@ -461,6 +477,7 @@ /* VMS specific code -- read from the Load Ave driver. */ LOAD_AVE_TYPE load_ave[3]; + static int initialized = 0; #ifdef eunice struct { @@ -474,8 +491,8 @@ { /* Attempt to open the channel. */ #ifdef eunice - descriptor.size = 18; - descriptor.ptr = "$$VMS_LOAD_AVERAGE"; + descriptor.dsc$w_length = 18; + descriptor.dsc$a_pointer = "$$VMS_LOAD_AVERAGE"; #else $DESCRIPTOR (descriptor, "LAV0:"); #endif @@ -582,7 +599,7 @@ return -1; #endif /* LOAD_AVE_TYPE and not VMS */ -#ifdef LOAD_AVE_TYPE /* Including VMS. */ +#if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */ if (nelem > 0) loadavg[elem++] = LDAV_CVT (load_ave[0]); if (nelem > 1) @@ -589,7 +606,7 @@ loadavg[elem++] = LDAV_CVT (load_ave[1]); if (nelem > 2) loadavg[elem++] = LDAV_CVT (load_ave[2]); -#endif /* LOAD_AVE_TYPE */ +#endif /* !LDAV_DONE && LOAD_AVE_TYPE */ #ifdef LDAV_DONE return elem; diff -ruN make-3.63/getopt.c make-3.64/getopt.c --- make-3.63/getopt.c Sun Jan 17 19:50:27 1993 +++ make-3.64/getopt.c Fri Apr 16 12:17:04 1993 @@ -46,8 +46,24 @@ #define const #endif +/* This tells Alpha OSF/1 not to define a getopt prototype in . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + #include +/* 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 + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -100,6 +116,7 @@ Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ +/* XXX 1003.2 says this must be 1 before any call. */ int optind = 0; /* The next char to be scanned in the option-element @@ -116,6 +133,12 @@ int opterr = 1; +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, @@ -166,15 +189,15 @@ char *getenv (); static char * -my_index (string, chr) - char *string; +my_index (str, chr) + const char *str; int chr; { - while (*string) + while (*str) { - if (*string == chr) - return string; - string++; + if (*str == chr) + return (char *) str; + str++; } return 0; } @@ -181,7 +204,8 @@ static void my_bcopy (from, to, size) - char *from, *to; + const char *from; + char *to; int size; { int i; @@ -498,7 +522,7 @@ fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen (nextchar); - return '?'; + return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); @@ -552,12 +576,18 @@ { if (opterr) { +#if 0 if (c < 040 || c >= 0177) fprintf (stderr, "%s: unrecognized option, character code 0%o\n", argv[0], c); else fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); +#endif } + optopt = c; return '?'; } if (temp[1] == ':') @@ -587,9 +617,21 @@ else if (optind == argc) { if (opterr) - fprintf (stderr, "%s: option `-%c' requires an argument\n", - argv[0], c); - c = '?'; + { +#if 0 + fprintf (stderr, "%s: option `-%c' requires an argument\n", + argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: option requires an argument -- %c\n", + argv[0], c); +#endif + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; } else /* We already incremented `optind' once; @@ -613,6 +655,8 @@ (int *) 0, 0); } + +#endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST diff -ruN make-3.63/getopt.h make-3.64/getopt.h --- make-3.63/getopt.h Wed Jan 13 15:28:00 1993 +++ make-3.64/getopt.h Fri Apr 16 10:52:07 1993 @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -48,6 +48,10 @@ for unrecognized options. */ extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector diff -ruN make-3.63/getopt1.c make-3.64/getopt1.c --- make-3.63/getopt1.c Sun Jan 17 19:51:30 1993 +++ make-3.64/getopt1.c Fri Apr 16 12:17:06 1993 @@ -1,5 +1,5 @@ /* Getopt for GNU. - Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 90, 91, 1992, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -27,6 +27,17 @@ #include +/* 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 + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -65,6 +76,9 @@ { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } + + +#endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST diff -ruN make-3.63/glob/Makefile.in make-3.64/glob/Makefile.in --- make-3.63/glob/Makefile.in Fri Jan 22 19:32:17 1993 +++ make-3.64/glob/Makefile.in Wed Apr 21 15:19:05 1993 @@ -18,8 +18,9 @@ # not, write to the Free Software Foundation, Inc., 675 Mass Ave, # Cambridge, MA 02139, USA. -srcdir = @srcdir@ -VPATH = $(srcdir) +# Ultrix 2.2 make doesn't expand the value of VPATH. +VPATH = @srcdir@ +srcdir = $(VPATH) CPPFLAGS = @DEFS@ diff -ruN make-3.63/glob/fnmatch.c make-3.64/glob/fnmatch.c --- make-3.63/glob/fnmatch.c Fri Jan 22 19:32:19 1993 +++ make-3.64/glob/fnmatch.c Wed Apr 21 15:19:05 1993 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -15,9 +15,26 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include +#include + + +/* 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 + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS) extern int errno; #endif @@ -33,40 +50,42 @@ register const char *p = pattern, *n = string; register char c; - if ((flags & ~__FNM_FLAGS) != 0) - { - errno = EINVAL; - return -1; - } +/* Note that this evalutes C many times. */ +#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) while ((c = *p++) != '\0') { + c = FOLD (c); + switch (c) { case '?': if (*n == '\0') return FNM_NOMATCH; - else if ((flags & FNM_PATHNAME) && *n == '/') + else if ((flags & FNM_FILE_NAME) && *n == '/') return FNM_NOMATCH; else if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/'))) + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; break; case '\\': if (!(flags & FNM_NOESCAPE)) - c = *p++; - if (*n != c) + { + c = *p++; + c = FOLD (c); + } + if (FOLD (*n) != c) return FNM_NOMATCH; break; case '*': if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/'))) + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; for (c = *p++; c == '?' || c == '*'; c = *p++, ++n) - if (((flags & FNM_PATHNAME) && *n == '/') || + if (((flags & FNM_FILE_NAME) && *n == '/') || (c == '?' && *n == '\0')) return FNM_NOMATCH; @@ -75,8 +94,9 @@ { char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + c1 = FOLD (c1); for (--p; *n != '\0'; ++n) - if ((c == '[' || *n == c1) && + if ((c == '[' || FOLD (*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) return 0; return FNM_NOMATCH; @@ -91,7 +111,7 @@ return FNM_NOMATCH; if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/'))) + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; not = (*p == '!' || *p == '^'); @@ -106,13 +126,16 @@ if (!(flags & FNM_NOESCAPE) && c == '\\') cstart = cend = *p++; + cstart = cend = FOLD (cstart); + if (c == '\0') /* [ (unterminated) loses. */ return FNM_NOMATCH; c = *p++; + c = FOLD (c); - if ((flags & FNM_PATHNAME) && c == '/') + if ((flags & FNM_FILE_NAME) && c == '/') /* [/] can never match. */ return FNM_NOMATCH; @@ -123,10 +146,12 @@ cend = *p++; if (cend == '\0') return FNM_NOMATCH; + cend = FOLD (cend); + c = *p++; } - if (*n >= cstart && *n <= cend) + if (FOLD (*n) >= cstart && FOLD (*n) <= cend) goto matched; if (c == ']') @@ -146,7 +171,7 @@ c = *p++; if (!(flags & FNM_NOESCAPE) && c == '\\') - /* 1003.2d11 is unclear if this is right. %%% */ + /* XXX 1003.2d11 is unclear if this is right. */ ++p; } if (not) @@ -155,7 +180,7 @@ break; default: - if (c != *n) + if (c != FOLD (*n)) return FNM_NOMATCH; } @@ -171,3 +196,5 @@ return FNM_NOMATCH; } + +#endif /* _LIBC or not __GNU_LIBRARY__. */ diff -ruN make-3.63/glob/fnmatch.h make-3.64/glob/fnmatch.h --- make-3.63/glob/fnmatch.h Fri Jan 22 19:32:20 1993 +++ make-3.64/glob/fnmatch.h Wed Apr 21 15:19:04 1993 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -29,19 +29,20 @@ #else /* Not C++ or ANSI C. */ #undef __P #define __P(args) () -#undef const -#define const +/* We can get away without defining `const' here only because in this file + it is used only inside the prototype for `fnmatch', which is elided in + non-ANSI C where `const' is problematical. */ #endif /* C++ or ANSI C. */ /* Bits set in the FLAGS argument to `fnmatch'. */ -#define FNM_PATHNAME (1 << 0)/* No wildcard can ever match `/'. */ -#define FNM_NOESCAPE (1 << 1)/* Backslashes don't quote special chars. */ -#define FNM_PERIOD (1 << 2)/* Leading `.' is matched only explicitly. */ -#define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD|FNM_LEADING_DIR) - -#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE) -#define FNM_LEADING_DIR (1 << 3)/* Ignore `/...' after a match. */ -#define FNM_FILE_NAME FNM_PATHNAME +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ + +#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) +#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ diff -ruN make-3.63/glob/glob.c make-3.64/glob/glob.c --- make-3.63/glob/glob.c Fri Jan 22 19:32:18 1993 +++ make-3.64/glob/glob.c Wed Apr 21 15:19:06 1993 @@ -27,6 +27,18 @@ #include #include + +/* 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 + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + #ifdef STDC_HEADERS #include #endif @@ -39,35 +51,26 @@ #define NULL 0 #endif -#if defined (USGr3) && !defined (DIRENT) -#define DIRENT -#endif /* USGr3 */ -#if defined (Xenix) && !defined (SYSNDIR) -#define SYSNDIR -#endif /* Xenix */ - -#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__) +#if defined (POSIX) || defined (DIRENT) || defined (__GNU_LIBRARY__) #include #ifndef __GNU_LIBRARY__ #define D_NAMLEN(d) strlen((d)->d_name) -#else -#define HAVE_D_NAMLEN +#else /* GNU C library. */ #define D_NAMLEN(d) ((d)->d_namlen) -#endif -#else /* not POSIX or DIRENT */ -#define dirent direct -#define D_NAMLEN(d) ((d)->d_namlen) -#define HAVE_D_NAMLEN -#if defined (USG) && !defined (sgi) -#if defined (SYSNDIR) +#endif /* Not GNU C library. */ +#else /* Not POSIX or DIRENT. */ +#define direct dirent +#define D_NAMLEN(d) ((d)->d_namlen) +#ifdef SYSNDIR #include -#else /* SYSNDIR */ -#include "ndir.h" -#endif /* not SYSNDIR */ -#else /* not USG */ +#endif /* SYSNDIR */ +#ifdef SYSDIR #include -#endif /* USG */ -#endif /* POSIX or DIRENT or __GNU_LIBRARY__ */ +#endif /* SYSDIR */ +#ifdef NDIR +#include +#endif /* NDIR */ +#endif /* POSIX or DIRENT or __GNU_LIBRARY__. */ #if defined (POSIX) && !defined (__GNU_LIBRARY__) /* Posix does not require that the d_ino field be present, and some @@ -81,34 +84,32 @@ #include #endif -#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__) \ - || defined (POSIX)) +#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)) #include #include #define ANSI_STRING #else /* No standard headers. */ -#ifdef USG - +#ifdef HAVE_STRING_H #include -#ifdef NEED_MEMORY_H +#define ANSI_STRING +#else +#include +#endif +#ifdef HAVE_MEMORY_H #include #endif -#define ANSI_STRING - -#else /* Not USG. */ -#ifdef NeXT +extern char *malloc (), *realloc (); +extern void free (); -#include +extern void qsort (); +extern void abort (), exit (); -#else /* Not NeXT. */ +#endif /* Standard headers. */ -#include +#ifndef ANSI_STRING -#ifndef bcmp -extern int bcmp (); -#endif #ifndef bzero extern void bzero (); #endif @@ -116,18 +117,7 @@ extern void bcopy (); #endif -#endif /* NeXT. */ - -#endif /* USG. */ - -extern char *malloc (), *realloc (); -extern void free (); -extern void qsort (); - -#endif /* Standard headers. */ - -#ifndef ANSI_STRING -#define memcpy(d, s, n) bcopy((s), (d), (n)) +#define memcpy(d, s, n) bcopy ((s), (d), (n)) #define strrchr rindex /* memset is only used for zero here, but let's be paranoid. */ #define memset(s, better_be_zero, n) \ @@ -209,7 +199,7 @@ static int glob_in_dir __P ((const char *pattern, const char *directory, int flags, int (*errfunc) __P ((const char *, int)), - glob_t * pglob)); + glob_t *pglob)); static int prefix_array __P ((const char *prefix, char **array, size_t n)); static int collated_compare __P ((const __ptr_t, const __ptr_t)); @@ -221,8 +211,8 @@ `glob' returns GLOB_ABEND; if it returns zero, the error is ignored. If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. Otherwise, `glob' returns zero. */ - int - glob (pattern, flags, errfunc, pglob) +int +glob (pattern, flags, errfunc, pglob) const char *pattern; int flags; int (*errfunc) __P ((const char *, int)); @@ -373,6 +363,7 @@ pglob->gl_pathv[pglob->gl_pathc++] = NULL; pglob->gl_pathv[pglob->gl_pathc++] = patcopy; + pglob->gl_pathv[pglob->gl_pathc] = NULL; pglob->gl_flags = flags; } else @@ -395,13 +386,14 @@ return GLOB_NOSPACE; } } - - if (!(flags & GLOB_NOSORT)) - qsort ((__ptr_t) & pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount, - sizeof (char *), collated_compare); } + if (!(flags & GLOB_NOSORT)) + /* Sort the vector. */ + qsort ((__ptr_t) & pglob->gl_pathv[oldcount], + pglob->gl_pathc - oldcount, + sizeof (char *), collated_compare); + return 0; } @@ -441,23 +433,28 @@ } -/* Prepend PREFIX to each of N members of ARRAY, replacing ARRAY's +/* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's elements in place. Return nonzero if out of memory, zero if successful. - A slash is inserted between PREFIX and each elt of ARRAY. - Each old element of ARRAY is freed. */ + A slash is inserted between DIRNAME and each elt of ARRAY, + unless DIRNAME is just "/". Each old element of ARRAY is freed. */ static int -prefix_array (prefix, array, n) - const char *prefix; +prefix_array (dirname, array, n) + const char *dirname; char **array; const size_t n; { register size_t i; - const size_t prelen = strlen (prefix); + size_t dirlen = strlen (dirname); + if (dirlen == 1 && dirname[0] == '/') + /* DIRNAME is just "/", so normal prepending would get us "//foo". + We want "/foo" instead, so don't prepend any chars from DIRNAME. */ + dirlen = 0; + for (i = 0; i < n; ++i) { const size_t eltlen = strlen (array[i]) + 1; - char *new = (char *) malloc (prelen + 1 + eltlen); + char *new = (char *) malloc (dirlen + 1 + eltlen); if (new == NULL) { while (i > 0) @@ -465,9 +462,9 @@ return 1; } - memcpy (new, prefix, prelen); - new[prelen] = '/'; - memcpy (&new[prelen + 1], array[i], eltlen); + memcpy (new, dirname, dirlen); + new[dirlen] = '/'; + memcpy (&new[dirlen + 1], array[i], eltlen); free ((__ptr_t) array[i]); array[i] = new; } @@ -664,3 +661,5 @@ } return GLOB_NOSPACE; } + +#endif /* _LIBC or not __GNU_LIBRARY__. */ diff -ruN make-3.63/implicit.c make-3.64/implicit.c --- make-3.63/implicit.c Wed Jan 6 17:57:30 1993 +++ make-3.64/implicit.c Wed Mar 10 15:41:03 1993 @@ -308,8 +308,7 @@ stem = filename + (rule->suffixes[matches[i]] - rule->targets[matches[i]]) - 1; stemlen = namelen - rule->lens[matches[i]] + 1; - check_lastslash = (lastslash != 0 - && index (rule->targets[matches[i]], '/') == 0); + check_lastslash = checked_lastslash[i]; if (check_lastslash) { stem += lastslash - filename + 1; @@ -331,6 +330,7 @@ register unsigned int i; if (check_lastslash) { + /* Copy directory name from the original FILENAME. */ i = lastslash - filename + 1; bcopy (filename, depname, i); } @@ -354,7 +354,7 @@ "impossible", then the rule fails and don't bother trying it on the second pass either since we know that will fail too. */ - DEBUGP2 ("Rejecting impossible %s dependent `%s'.\n", + DEBUGP2 ("Rejecting impossible %s dependency `%s'.\n", p == depname ? "implicit" : "rule", p); tryrules[i] = 0; break; @@ -364,7 +364,16 @@ DEBUGP2 ("Trying %s dependency `%s'.\n", p == depname ? "implicit" : "rule", p); - if (!rule->subdir && (lookup_file (p) != 0 || file_exists_p (p))) + + /* The DEP->changed flag says that this dependency resides in a + nonexistent directory. So we normally can skip looking for + the file. However, if CHECK_LASTSLASH is set, then the + dependency file we are actually looking for is in a different + directory (the one gotten by prepending FILENAME's directory), + so it might actually exist. */ + + if ((!dep->changed || check_lastslash) + && (lookup_file (p) != 0 || file_exists_p (p))) { found_files[deps_found++] = savestring (p, strlen (p)); continue; @@ -371,7 +380,7 @@ } /* This code, given FILENAME = "lib/foo.o", dependency name "lib/foo.c", and VPATH=src, searches for "src/lib/foo.c". */ - if (vpath_search (&p)) + if (vpath_search (&p, (time_t *) 0)) { DEBUGP2 ("Found dependency as `%s'.%s\n", p, ""); found_files[deps_found++] = p; @@ -532,6 +541,8 @@ file->stem = stem[stemlen] == '\0' ? stem : savestring (stem, stemlen); else { + /* We want to prepend the directory from + the original FILENAME onto the stem. */ file->stem = (char *) xmalloc (((lastslash + 1) - filename) + stemlen + 1); bcopy (filename, file->stem, (lastslash + 1) - filename); diff -ruN make-3.63/job.c make-3.64/job.c --- make-3.63/job.c Fri Jan 22 17:31:27 1993 +++ make-3.64/job.c Wed Apr 14 13:22:35 1993 @@ -344,9 +344,6 @@ if (c->file->update_status != 0) /* We failed to start the commands. */ delete_child_targets (c); - - /* Tell update_file that some actual work has been done. */ - ++files_remade; break; default: @@ -415,7 +412,7 @@ #ifdef POSIX extern sigset_t fatal_signal_set; -static void +void unblock_sigs () { sigset_t empty; @@ -422,13 +419,6 @@ sigemptyset (&empty); sigprocmask (SIG_SETMASK, &empty, (sigset_t *) 0); } -#else -#ifdef HAVE_SIGSETMASK -extern int fatal_signal_mask; -#define unblock_sigs() sigsetmask (0) -#else -#define unblock_sigs() -#endif #endif /* Start a job to run the commands specified in CHILD. @@ -440,17 +430,15 @@ { static int bad_stdin = -1; register char *p; - char noprint = 0, recursive; + int flags = child->file->cmds->lines_flags[child->command_line - 1]; char **argv; - recursive = child->file->cmds->lines_recurse[child->command_line - 1]; - p = child->command_ptr; - child->noerror = 0; + child->noerror = flags & COMMANDS_NOERROR; while (*p != '\0') { if (*p == '@') - noprint = 1; + flags |= COMMANDS_SILENT; else if (*p == '-') child->noerror = 1; else if (!isblank (*p) && *p != '+') @@ -459,7 +447,7 @@ } /* If -q was given, just say that updating `failed'. */ - if (question_flag && !recursive) + if (question_flag && !(flags & COMMANDS_RECURSE)) goto error; /* There may be some preceding whitespace left if there @@ -480,7 +468,7 @@ } } - if (touch_flag && !recursive) + if (touch_flag && !(flags & COMMANDS_RECURSE)) { /* Go on to the next command. It might be the recursive one. We construct ARGV only to find the end of the command line. */ @@ -499,22 +487,26 @@ /* Print out the command. */ - if (just_print_flag || (!noprint && !silent_flag)) + if (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) puts (p); + /* Tell update_goal_chain that a command has been started on behalf of + this target. It is important that this happens here and not in + reap_children (where we used to do it), because reap_children might be + reaping children from a different target. We want this increment to + guaranteedly indicate that a command was started for the dependency + chain (i.e., update_file recursion chain) we are processing. */ + + ++commands_started; + /* If -n was given, recurse to get the next line in the sequence. */ - if (just_print_flag && !recursive) + if (just_print_flag && !(flags & COMMANDS_RECURSE)) { free (argv[0]); free ((char *) argv); if (job_next_command (child)) start_job_command (child); - else - /* Normally, this is set by reap_children to indicate that - some commands were actually run. Under -n, reap_children - never gets called, so we increment it here. */ - ++files_remade; return; } @@ -619,7 +611,11 @@ child->file->command_state = cs_finished; } -static void +/* Try to start a child running. + Returns nonzero if the child was started (and maybe finished), or zero if + the load was too high and the child was put on the `waiting_jobs' chain. */ + +static int start_waiting_job (c) struct child *c; { @@ -638,7 +634,7 @@ c->file->command_state = cs_running; c->next = waiting_jobs; waiting_jobs = c; - return; + return 0; } /* Start the first command; reap_children will run later command lines. */ @@ -669,6 +665,8 @@ abort (); break; } + + return 1; } /* Create a `struct child' for FILE and start its commands running. */ @@ -682,6 +680,10 @@ char **lines; register unsigned int i; + /* Let any previously decided-upon jobs that are waiting + for the load to go down start before this new one. */ + start_waiting_jobs (); + /* Reap any children that might have finished recently. */ reap_children (0, 0); @@ -696,8 +698,103 @@ /* Expand the command lines and store the results in LINES. */ lines = (char **) xmalloc (cmds->ncommand_lines * sizeof (char *)); for (i = 0; i < cmds->ncommand_lines; ++i) - lines[i] = allocated_variable_expand_for_file (cmds->command_lines[i], - file); + { + /* Collapse backslash-newline combinations that are inside variable + or function references. These are left alone by the parser so + that they will appear in the echoing of commands (where they look + nice); and collapsed by construct_command_argv when it tokenizes. + But letting them survive inside function invocations loses because + we don't want the functions to see them as part of the text. */ + + char *in, *out, *ref; + + /* IN points to where in the line we are scanning. + OUT points to where in the line we are writing. + When we collapse a backslash-newline combination, + IN gets ahead out OUT. */ + + in = out = cmds->command_lines[i]; + while ((ref = index (in, '$')) != 0) + { + ++ref; /* Move past the $. */ + + if (out != in) + /* Copy the text between the end of the last chunk + we processed (where IN points) and the new chunk + we are about to process (where REF points). */ + bcopy (in, out, ref - in); + + /* Move both pointers past the boring stuff. */ + out += ref - in; + in = ref; + + if (*ref == '(' || *ref == '{') + { + char openparen = *ref; + char closeparen = openparen == '(' ? ')' : '}'; + int count; + char *p; + + *out++ = *in++; /* Copy OPENPAREN. */ + /* IN now points past the opening paren or brace. + Count parens or braces until it is matched. */ + count = 0; + while (*in != '\0') + { + if (*in == closeparen && --count < 0) + break; + else if (*in == '\\' && in[1] == '\n') + { + /* We have found a backslash-newline inside a + variable or function reference. Eat it and + any following whitespace. */ + + int quoted = 0; + for (p = in - 1; p > ref && *p == '\\'; --p) + quoted = !quoted; + + if (quoted) + /* There were two or more backslashes, so this is + not really a continuation line. We don't collapse + the quoting backslashes here as is done in + collapse_continuations, because the line will + be collapsed again after expansion. */ + *out++ = *in++; + else + { + /* Skip the backslash, newline and + any following whitespace. */ + in = next_token (in + 2); + + /* Discard any preceding whitespace that has + already been written to the output. */ + while (out > ref && isblank (out[-1])) + --out; + + /* Replace it all with a single space. */ + *out++ = ' '; + } + } + else + { + if (*in == openparen) + ++count; + + *out++ = *in++; + } + } + } + } + + /* There are no more references in this line to worry about. + Copy the remaining uninteresting text to the output. */ + if (out != in) + strcpy (out, in); + + /* Finally, expand the line. */ + lines[i] = allocated_variable_expand_for_file (cmds->command_lines[i], + file); + } /* Start the command sequence, record it in a new `struct child', and add that to the chain. */ @@ -786,22 +883,23 @@ void start_waiting_jobs () { - while (waiting_jobs != 0) - { - struct child *c; + struct child *job; + + if (waiting_jobs == 0) + return; + do + { /* Check for recently deceased descendants. */ reap_children (0, 0); - if (job_slots_used > 0 - && (job_slots_used == job_slots || load_too_high ())) - /* We have started all the jobs we can at the moment. */ - return; - - c = waiting_jobs; - waiting_jobs = c->next; - start_waiting_job (c); - } + /* Take a job off the waiting list. */ + job = waiting_jobs; + waiting_jobs = job->next; + + /* Try to start that job. We break out of the loop as soon + as start_waiting_job puts one back on the waiting list. */ + } while (start_waiting_job (job) && waiting_jobs != 0); } /* Replace the current process with one executing the command in ARGV. diff -ruN make-3.63/job.h make-3.64/job.h --- make-3.63/job.h Wed Jan 6 17:57:14 1993 +++ make-3.64/job.h Mon Feb 1 16:03:32 1993 @@ -49,3 +49,14 @@ extern void exec_command (); extern unsigned int job_slots_used; + +#ifdef POSIX +extern void unblock_sigs (); +#else +#ifdef HAVE_SIGSETMASK +extern int fatal_signal_mask; +#define unblock_sigs() sigsetmask (0) +#else +#define unblock_sigs() +#endif +#endif diff -ruN make-3.63/main.c make-3.64/main.c --- make-3.63/main.c Fri Jan 15 13:18:29 1993 +++ make-3.64/main.c Wed Apr 14 14:20:33 1993 @@ -83,6 +83,7 @@ struct command_switch { char c; /* The switch character. */ + enum /* Type of the value. */ { flag, /* Turn int flag on. */ @@ -168,11 +169,15 @@ int keep_going_flag; int default_keep_going_flag = 0; -/* Nonzero means print working directory - before starting and after finishing make. */ +/* Nonzero means print directory before starting and when done (-w). */ int print_directory_flag = 0; +/* Nonzero means ignore print_directory_flag and never print the directory. + This is necessary because print_directory_flag is set implicitly. */ + +int inhibit_print_directory_flag = 0; + /* Nonzero means print version information. */ int print_version_flag = 0; @@ -217,7 +222,7 @@ /* The table of command switches. */ -static struct command_switch switches[] = +static const struct command_switch switches[] = { { 'b', ignore, 0, 0, 0, 0, 0, 0, 0, 0, @@ -289,6 +294,9 @@ { 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0, "print-directory", 0, "Print the current directory" }, + { 1, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0, + "no-print-directory", 0, + "Turn off -w, even if it was turned on implicitly" }, { 'W', string, (char *) &new_files, 0, 0, 0, 0, 0, "what-if", "FILE", "Consider FILE to be infinitely new" }, @@ -301,7 +309,6 @@ { { "quiet", no_argument, 0, 's' }, { "stop", no_argument, 0, 'S' }, - { "new", required_argument, 0, 'W' }, { "new-file", required_argument, 0, 'W' }, { "assume-new", required_argument, 0, 'W' }, { "assume-old", required_argument, 0, 'o' }, @@ -325,6 +332,10 @@ char *program; +/* Our current directory after processing all -C options. */ + +char *starting_directory; + /* Value of the MAKELEVEL variable at startup (or 0). */ unsigned int makelevel; @@ -369,6 +380,7 @@ register struct dep *lastgoal; struct dep *read_makefiles; PATH_VAR (current_directory); + char *directory_before_chdir; default_goal_file = 0; reading_filename = 0; @@ -457,7 +469,11 @@ error ("getwd: %s", current_directory); #endif current_directory[0] = '\0'; + directory_before_chdir = 0; } + else + directory_before_chdir = savestring (current_directory, + strlen (current_directory)); /* Read in variables from the environment. It is important that this be done before `MAKE' and `MAKEOVERRIDES' are figured out so their @@ -498,7 +514,8 @@ continue; /* Try a variable definition. */ - if (try_variable_definition (other_args->list[i], o_command)) + if (try_variable_definition ((char *) 0, 0, + other_args->list[i], o_command)) { /* It succeeded. The variable is already defined. Backslash-quotify it and append it to CMD_DEFS, then clobber it @@ -592,11 +609,34 @@ if (!silent_flag && (directories != 0 || makelevel > 0)) print_directory_flag = 1; + /* Let the user disable that with --no-print-directory. */ + if (inhibit_print_directory_flag) + print_directory_flag = 0; + /* Construct the list of include directories to search. */ construct_include_path (include_directories == 0 ? (char **) 0 : include_directories->list); + /* Figure out where we are now, after chdir'ing. */ + if (directories == 0) + /* We didn't move, so we're still in the same place. */ + starting_directory = current_directory; + else + { + if (getcwd (current_directory, GET_PATH_MAX) == 0) + { +#ifdef HAVE_GETCWD + perror_with_name ("getcwd: ", ""); +#else + error ("getwd: %s", current_directory); +#endif + starting_directory = 0; + } + else + starting_directory = current_directory; + } + /* Tell the user where he is. */ if (print_directory_flag) @@ -656,9 +696,10 @@ /* Set up to handle children dying. This must be done before reading in the makefiles so that `shell' function calls will work. */ -#if defined (SIGCHLD) && !defined (USG) +#ifdef SIGCHLD (void) signal (SIGCHLD, child_handler); -#else +#endif +#ifdef SIGCLD (void) signal (SIGCLD, child_handler); #endif @@ -903,21 +944,21 @@ register unsigned int i, j = 0; for (i = 1; i < argc; ++i) if (!strcmp (argv[i], "-f")) - { - char *p = &argv[i][2]; - if (*p == '\0') - argv[++i] = makefiles->list[j]; - else - argv[i] = concat ("-f", makefiles->list[j], ""); - ++j; - } + { + char *p = &argv[i][2]; + if (*p == '\0') + argv[++i] = makefiles->list[j]; + else + argv[i] = concat ("-f", makefiles->list[j], ""); + ++j; + } } if (directories != 0 && directories->idx > 0) { char bad; - if (current_directory[0] != '\0') + if (directory_before_chdir != 0) { - if (chdir (current_directory) < 0) + if (chdir (directory_before_chdir) < 0) { perror_with_name ("chdir", ""); bad = 1; @@ -992,8 +1033,7 @@ abort (); } } - - if (goals == 0) + else { if (read_makefiles == 0) fatal ("No targets specified and no makefile found"); @@ -1033,7 +1073,9 @@ long_options[i].name = (switches[i].long_name == 0 ? "" : switches[i].long_name); long_options[i].flag = 0; - *p++ = long_options[i].val = switches[i].c; + long_options[i].val = switches[i].c; + if (isalnum (switches[i].c)) + *p++ = switches[i].c; switch (switches[i].type) { case flag: @@ -1046,10 +1088,12 @@ case string: case positive_int: case floating: - *p++ = ':'; + if (isalnum (switches[i].c)) + *p++ = ':'; if (switches[i].noarg_value != 0) { - *p++ = ':'; + if (isalnum (switches[i].c)) + *p++ = ':'; long_options[i].has_arg = optional_argument; } else @@ -1075,7 +1119,7 @@ int env; { int bad = 0; - register struct command_switch *cs; + register const struct command_switch *cs; register struct stringlist *sl; register int c; @@ -1252,12 +1296,18 @@ } p = buf; - sprintf (buf, " -%c%s", cs->c, arg); - p += strlen (p); + + if (isalnum (cs->c)) + { + sprintf (buf, " -%c%s", cs->c, arg); + p += strlen (p); + } if (cs->long_name != 0) { unsigned int i; - sprintf (p, ", --%s%s", cs->long_name, arg); + sprintf (p, "%s--%s%s", + !isalnum (cs->c) ? " " : ", ", + cs->long_name, arg); p += strlen (p); for (i = 0; i < (sizeof (long_option_aliases) / sizeof (long_option_aliases[0])); @@ -1269,7 +1319,7 @@ } } { - struct command_switch *ncs = cs; + const struct command_switch *ncs = cs; while ((++ncs)->c != '\0') if (ncs->description[0] == '-' && ncs->description[1] == cs->c) @@ -1345,7 +1395,7 @@ args[(value[0] == '-' ? 0 : 1) + len + 1] = '\0'; /* Allocate a vector that is definitely big enough. */ - argv = (char **) alloca (1 + len * sizeof (char *)); + argv = (char **) alloca ((1 + len + 1) * sizeof (char *)); /* getopt will look at the arguments starting at ARGV[1]. Prepend a spacer word. */ @@ -1371,7 +1421,7 @@ define_makeflags (all, makefile) int all, makefile; { - register struct command_switch *cs; + register const struct command_switch *cs; char *flagstring; /* We will construct a linked list of `struct flag's describing @@ -1382,7 +1432,7 @@ struct flag { struct flag *next; - int c; + const struct command_switch *cs; char *arg; unsigned int arglen; }; @@ -1391,7 +1441,7 @@ #define ADD_FLAG(ARG, LEN) \ do { \ struct flag *new = (struct flag *) alloca (sizeof (struct flag)); \ - new->c = cs->c; \ + new->cs = cs; \ new->arg = (ARG); \ new->arglen = (LEN); \ new->next = flags; \ @@ -1400,6 +1450,9 @@ ++flagslen; /* Just a single flag letter. */ \ else \ flagslen += 1 + 1 + 1 + 1 + new->arglen; /* " -x foo" */ \ + if (!isalnum (cs->c)) \ + /* This switch has no single-letter version, so we use the long. */ \ + flagslen += 2 + strlen (cs->long_name); \ } while (0) for (cs = switches; cs->c != '\0'; ++cs) @@ -1430,7 +1483,7 @@ else if (cs->noarg_value != 0 && (*(unsigned int *) cs->value_ptr == *(unsigned int *) cs->noarg_value)) - ADD_FLAG (0, 0); + ADD_FLAG ("", 0); /* Optional value omitted; see below. */ else if (cs->c == 'j') /* Special case for `-j'. */ ADD_FLAG ("1", 1); @@ -1453,7 +1506,7 @@ else if (cs->noarg_value != 0 && (*(double *) cs->value_ptr == *(double *) cs->noarg_value)) - ADD_FLAG (0, 0); + ADD_FLAG ("", 0); /* Optional value omitted; see below. */ else { char *buf = (char *) alloca (100); @@ -1467,10 +1520,15 @@ if (all) { struct stringlist *sl = *(struct stringlist **) cs->value_ptr; - register unsigned int i; if (sl != 0) - for (i = 0; i < sl->idx; ++i) - ADD_FLAG (sl->list[i], strlen (sl->list[i])); + { + /* Add the elements in reverse order, because + all the flags get reversed below; and the order + matters for some switches (like -I). */ + register unsigned int i = sl->idx; + while (i-- > 0) + ADD_FLAG (sl->list[i], strlen (sl->list[i])); + } } break; } @@ -1490,18 +1548,39 @@ *p++ = '-'; do { - /* Add the flag letter to the string. */ - *p++ = flags->c; + /* Add the flag letter or name to the string. */ + if (!isalnum (flags->cs->c)) + { + *p++ = '-'; + strcpy (p, flags->cs->long_name); + p += strlen (p); + } + else + *p++ = flags->cs->c; if (flags->arg != 0) { - /* Add its argument too. */ - *p++ = ' '; - bcopy (flags->arg, p, flags->arglen); - p += flags->arglen; + /* A flag that takes an optional argument which in this case + is omitted is specified by ARG being "" and ARGLEN being 0. + We must distinguish because a following flag appended without + an intervening " -" is considered the arg for the first. */ + if (flags->arglen > 0) + { + /* Add its argument too. */ + *p++ = !isalnum (flags->cs->c) ? '=' : ' '; + bcopy (flags->arg, p, flags->arglen); + p += flags->arglen; + } /* Write a following space and dash, for the next flag. */ *p++ = ' '; *p++ = '-'; } + else if (!isalnum (flags->cs->c)) + { + /* Long options must each go in their own word, + so we write the following space and dash. */ + *p++ = ' '; + *p++ = '-'; + } flags = flags->next; } while (flags != 0); @@ -1613,7 +1692,6 @@ int entering; { static int entered = 0; - PATH_VAR (pwdbuf); char *message = entering ? "Entering" : "Leaving"; if (entering) @@ -1631,15 +1709,8 @@ else printf ("%s[%u]: %s ", program, makelevel, message); - if (getcwd (pwdbuf, GET_PATH_MAX) == 0) - { -#ifdef HAVE_GETCWD - perror_with_name ("getcwd: ", ""); -#else - error ("getwd: %s", pwdbuf); -#endif - puts ("an unknown directory"); - } + if (starting_directory == 0) + puts ("an unknown directory"); else - printf ("directory `%s'\n", pwdbuf); + printf ("directory `%s'\n", starting_directory); } diff -ruN make-3.63/make-stds.texi make-3.64/make-stds.texi --- make-3.63/make-stds.texi Sun Jan 17 17:37:18 1993 +++ make-3.64/make-stds.texi Thu Apr 8 12:40:51 1993 @@ -53,14 +53,15 @@ because @file{foo.man} and @file{sedscript} are not in the current directory. -Relying on @samp{VPATH} to find the source file will work in the case -where there is a single dependency file, since the @file{make} automatic -variable @samp{$<} will represent the source file wherever it is. A -makefile target like +When using GNU @code{make}, relying on @samp{VPATH} to find the source +file will work in the case where there is a single dependency file, +since the @file{make} automatic variable @samp{$<} will represent the +source file wherever it is. (Many versions of @code{make} set @samp{$<} +only in implicit rules.) A makefile target like @example foo.o : bar.c - $(CC) $(CFLAGS) -I. -I$(srcdir) -c bar.c -o foo.o + $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o @end example @noindent @@ -244,6 +245,16 @@ installed. @end table + The following target is suggested as a conventional name, for programs +in which it is useful. + +@table @code +@item installcheck +Perform installation tests (if any). The user must build and install +the program before running the tests. You should not assume that +@file{$(bindir)} is in the search path. +@end table + @node Command Variables @section Variables for Specifying Commands @@ -277,9 +288,9 @@ @example CFLAGS = -g -ALL_CFLAGS = $(CFLAGS) -I. +ALL_CFLAGS = -I. $(CFLAGS) .c.o: - $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $< + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< @end example Do include the @samp{-g} option in @code{CFLAGS}, because that is not diff -ruN make-3.63/make.h make-3.64/make.h --- make-3.63/make.h Fri Jan 15 13:05:49 1993 +++ make-3.64/make.h Wed Apr 14 13:34:15 1993 @@ -44,6 +44,10 @@ extern int errno; #endif +#ifndef isblank +#define isblank(c) ((c) == ' ' || (c) == '\t') +#endif + #ifdef HAVE_UNISTD_H #include #ifdef _POSIX_VERSION @@ -68,12 +72,13 @@ #include "signame.h" #endif -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif - -#if !defined(NSIG) && defined(_NSIG) +/* Some systems do not define NSIG in . */ +#ifndef NSIG +#ifdef _NSIG #define NSIG _NSIG +#else +#define NSIG 32 +#endif #endif #ifndef RETSIGTYPE @@ -133,38 +138,16 @@ #define ANSI_STRING #else /* No standard headers. */ -#ifdef USG - +#ifdef HAVE_STRING_H #include -#ifdef NEED_MEMORY_H -#include -#endif #define ANSI_STRING - -#else /* Not USG. */ - -#ifdef NeXT - -#include - -#else /* Not NeXT. */ - +#else #include - -#ifndef bcmp -extern int bcmp (); -#endif -#ifndef bzero -extern void bzero (); #endif -#ifndef bcopy -extern void bcopy (); +#ifdef HAVE_MEMORY_H +#include #endif -#endif /* NeXT. */ - -#endif /* USG. */ - extern char *malloc (), *realloc (); extern void free (); @@ -174,6 +157,7 @@ #endif /* Standard headers. */ #ifdef ANSI_STRING + #ifndef index #define index(s, c) strchr((s), (c)) #endif @@ -190,6 +174,19 @@ #ifndef bcopy #define bcopy(s, d, n) memcpy ((d), (s), (n)) #endif + +#else /* Not ANSI_STRING. */ + +#ifndef bcmp +extern int bcmp (); +#endif +#ifndef bzero +extern void bzero (); +#endif +#ifndef bcopy +extern void bcopy (); +#endif + #endif /* ANSI_STRING. */ #undef ANSI_STRING @@ -198,13 +195,13 @@ #undef alloca #define alloca(n) __builtin_alloca (n) #else /* Not GCC. */ -#if defined (sparc) || defined (HAVE_ALLOCA_H) +#ifdef HAVE_ALLOCA_H #include -#else /* Not sparc or HAVE_ALLOCA_H. */ +#else /* Not HAVE_ALLOCA_H. */ #ifndef _AIX extern char *alloca (); #endif /* Not AIX. */ -#endif /* sparc or HAVE_ALLOCA_H. */ +#endif /* HAVE_ALLOCA_H. */ #endif /* GCC. */ #ifndef iAPX286 @@ -273,13 +270,9 @@ #include #endif -#if defined(__GNU_LIBRARY__) || defined(POSIX) - -#include - -#else +#if !defined (__GNU_LIBRARY__) && !defined (POSIX) -#ifndef USG +#ifdef HAVE_SIGSETMASK extern int sigsetmask (); extern int sigblock (); #endif @@ -289,8 +282,9 @@ extern int unlink (), stat (), fstat (); extern int pipe (), close (), read (), write (), open (); extern long int lseek (); -#endif /* GNU C library or POSIX. */ +#endif /* Not GNU C library or POSIX. */ + #ifdef HAVE_GETCWD extern char *getcwd (); #else @@ -320,9 +314,10 @@ extern double max_load_average; extern char *program; - +extern char *starting_directory; extern unsigned int makelevel; -extern unsigned int files_remade; + +extern unsigned int commands_started; #define DEBUGPR(msg) \ diff -ruN make-3.63/make.man make-3.64/make.man --- make-3.63/make.man Mon Sep 23 23:33:24 1991 +++ make-3.64/make.man Mon Mar 8 13:38:35 1993 @@ -127,7 +127,11 @@ .BR "\-C " /etc. This is typically used with recursive invocations of .IR make . +.B \-e +Give variables taken from the environment precedence +over variables from makefiles. .TP 0.5i +.TP 0.5i .B \-d Print debugging information in addition to normal processing. The debugging information says which files are being considered for @@ -139,7 +143,8 @@ .TP 0.5i .BI "\-f " file Use -.I file as a makefile. +.I file +as a makefile. .TP 0.5i .B \-i Ignore all errors in commands executed to remake files. diff -ruN make-3.63/make.texinfo make-3.64/make.texinfo --- make-3.63/make.texinfo Fri Jan 15 14:56:31 1993 +++ make-3.64/make.texinfo Mon Apr 19 15:42:09 1993 @@ -3,56 +3,19 @@ @setfilename make.info @settitle GNU @code{make} @setchapternewpage odd -@smallbook @c %**end of header -@set EDITION 0.40 -@set VERSION 3.63 Beta -@set UPDATED 14 January 1993 -@set UPDATE-MONTH January 1993 +@c For publication, format makebook.texi instead of using this file directly. +@set EDITION 0.41 +@set VERSION 3.64 Beta +@set UPDATED 16 April 1993 +@set UPDATE-MONTH April 1993 + @c finalout @c ISPELL CHECK: done, 14 Jan 1993 --bob -@ifset two-level-index -@tex -% trying for a two-level index -% You need the rewritten texindex program for this to work. - -\gdef\singleindexerfoo#1, #2\par{% -% Use a box register to test if #2 is empty. -\setbox0=\hbox{#2}% -\ifvoid0{ % A one-level entry. -\doind{\indexname}{#1}}\else{ % A two-level entry. -\dosubind{\indexname}{#1}{#2} -}\fi}% -\gdef\singleindexer#1{\singleindexerfoo#1, \par}% - -% This version writes two sort strings. -\gdef\dosubind #1#2#3{% -{\count10=\lastpenalty % -{\indexdummies % Must do this here, since \bf, etc expand at this stage -\escapechar=`\\% -{\let\folio=0% -\def\rawbackslashxx{\indexbackslash}% -% -% Now process the index-string once, with all font commands turned off, -% to get the string to sort the index by. -{\indexnofonts -\xdef\tempa{#2}% -\xdef\tempb{#3}% -}% -% Now produce the complete index entry. We process the index-string again, -% this time with font commands expanded, to get what to print in the index. -\edef\temp{% -\write \csname#1indfile\endcsname{% -\realbackslash entry {\tempa}{\folio}{#2}{#3}{\tempb}}}% -\temp}% -}\penalty\count10}} -@end tex -@end ifset - @c Combine the variable and function indices: @syncodeindex vr fn @c Combine the program and concept indices: @@ -93,9 +56,9 @@ by the Foundation. @end ifinfo -@ifset shorttitlepage +@iftex @shorttitlepage GNU Make -@end ifset +@end iftex @titlepage @title GNU Make @subtitle A Program for Directing Recompilation @@ -271,6 +234,8 @@ * Advanced:: Advanced features for referencing a variable. * Values:: All the ways variables get their values. * Setting:: How to set a variable in the makefile. +* Appending:: How to append more text to the old value + of a variable. * Override Directive:: How to set a variable in the makefile even if the user has set it with a command argument. * Defining:: An alternate way to set a variable @@ -3053,6 +3018,23 @@ CFLAGS=-O}, so that all C compilations will be optimized, the sub-@code{make} is run with @samp{cd subdir; /bin/make CFLAGS=-O}.@refill +@vindex MAKE_COMMAND +@vindex MAKEOVERRIDES +The @code{MAKE} variable actually just refers to two other variables +which contain these special values. In fact, @code{MAKE} is always +defined as @samp{$(MAKE_COMMAND) $(MAKEOVERRIDES)}. The variable +@code{MAKE_COMMAND} is the file name with which @code{make} was invoked +(such as @file{/bin/make}, above). The variable @code{MAKEOVERRIDES} +contains definitions for the variables defined on the command line; in +the above example, its value is @samp{CFLAGS=-O}. If you @emph{do not} +want these variable definitions done in all recursive @code{make} +invocations, you can redefine the @code{MAKEOVERRIDES} variable to +remove them. You do this in any of the normal ways for defining +variables: in a makefile (@pxref{Setting, ,Setting Variables}); on the command +line with an argument like @samp{MAKEOVERRIDES=} +(@pxref{Overriding, ,Overriding Variables}); or with an environment variable +(@pxref{Environment, ,Variables from the Environment}). + As a special feature, using the variable @code{MAKE} in the commands of a rule alters the effects of the @samp{-t} (@samp{--touch}), @samp{-n} (@samp{--just-print}), or @samp{-q} (@w{@samp{--question}}) option. @@ -3111,6 +3093,9 @@ Some shells cannot cope with environment variable names consisting of characters other than letters, numbers, and underscores. +The special variables @code{SHELL} and @code{MAKEFLAGS} are always exported. +@code{MAKEFILES} is exported if you set it to anything. + Variables are @emph{not} normally passed down if they were created by default by @code{make} (@pxref{Implicit Variables, ,Variables Used by Implicit Rules}). The sub-@code{make} will define these for @@ -3164,6 +3149,23 @@ export @var{variable} @end example +Likewise, + +@example +export @var{variable} += value +@end example + +@noindent +is just like: + +@example +@var{variable} += value +export @var{variable} +@end example + +@noindent +@xref{Appending, ,Appending More Text to Variables}. + You may notice that the @code{export} and @code{unexport} directives work in @code{make} in the same way they work in the shell, @code{sh}. @@ -3360,10 +3362,15 @@ @cindex @code{-w}, and recursion @cindex @code{--print-directory}, and @code{--directory} @cindex @code{--print-directory}, and recursion +@cindex @code{--no-print-directory} +@cindex @code{--print-directory}, disabling +@cindex @code{-w}, disabling Normally, you do not need to specify this option because @samp{make} does it for you: @samp{-w} is turned on automatically when you use the -@samp{-C} option, and in sub-@code{make}s (unless you also use -@samp{-s}, which says to be silent). +@samp{-C} option, and in sub-@code{make}s. @code{make} will not +automatically turn on @samp{-w} if you also use @samp{-s}, which says to +be silent, or if you use @samp{--no-print-directory} to explicitly +disable it. @node Sequences, Empty Commands, Recursion, Commands @section Defining Canned Command Sequences @@ -3422,6 +3429,41 @@ commands based on the file names involved (@pxref{Implicit Rules, ,Using Implicit Rules}). +@cindex @@, and @code{define} +@cindex -, and @code{define} +@cindex +, and @code{define} +In command execution, each line of a canned sequence is treated just as +if the line appeared on its own in the rule, preceded by a tab. In +particular, @code{make} invokes a separate subshell for each line. You +can use the special prefix characters that affect command lines +(@samp{@@}, @samp{-}, and @samp{+}) on each line of a canned sequence. +@xref{Commands, ,Writing the Commands in Rules}. +For example, using this canned sequence: + +@example +define frobnicate +@@echo "frobnicating target $@@" +frob-step-1 $< -o $@@-step-1 +frob-step-2 $@@-step-1 -o $@@ +endef +@end example + +@noindent +@code{make} will not echo the first line, the @code{echo} command. +But it @emph{will} echo the following two command lines. + +On the other hand, prefix characters on the command line that refers to +a canned sequence apply to every line in the sequence. So the rule: + +@example +frob.out: frob.in + @@$(frobnicate) +@end example + +@noindent +does not echo @emph{any} commands. +(@xref{Echoing, ,Command Echoing}, for a full explanation of @samp{@@}.) + @node Empty Commands, , Sequences, Commands @section Using Empty Commands @cindex empty commands @@ -3496,6 +3538,8 @@ * Advanced:: Advanced features for referencing a variable. * Values:: All the ways variables get their values. * Setting:: How to set a variable in the makefile. +* Appending:: How to append more text to the old value + of a variable. * Override Directive:: How to set a variable in the makefile even if the user has set it with a command argument. * Defining:: An alternate way to set a variable @@ -3840,8 +3884,10 @@ which becomes @samp{$(z)} which becomes @samp{Hello}. Nested variable references can also contain modified references and -function invocations (@pxref{Functions, ,Functions for Transforming Text}), just like any other reference. -For example, using the @code{subst} function (@pxref{Text Functions, ,Functions for String Substitution and Analysis}): +function invocations (@pxref{Functions, ,Functions for Transforming Text}), +just like any other reference. +For example, using the @code{subst} function +(@pxref{Text Functions, ,Functions for String Substitution and Analysis}): @example @group @@ -3997,9 +4043,10 @@ @xref{Implicit Variables, ,Variables Used by Implicit Rules}. @end itemize -@node Setting, Override Directive, Values, Using Variables +@node Setting, Appending, Values, Using Variables @section Setting Variables @cindex setting variables +@cindex variables, setting @cindex = @cindex := @@ -4038,13 +4085,140 @@ automatically to a new value for each rule; these are called the @dfn{automatic} variables (@pxref{Automatic, ,Automatic Variables}). -@node Override Directive, Defining, Setting, Using Variables +@node Appending, Override Directive, Setting, Using Variables +@section Appending More Text to Variables +@cindex += +@cindex appending to variables +@cindex variables, appending to + +Often it is useful to add more text to the value of a variable already defined. +You do this with a line containing @samp{+=}, like this: + +@example +objects += another.o +@end example + +@noindent +This takes the value of the variable @code{objects}, and adds the text +@samp{another.o} to it (preceded by a single space). Thus: + +@example +objects = main.o foo.o bar.o utils.o +objects += another.o +@end example + +@noindent +sets @code{objects} to @samp{main.o foo.o bar.o utils.o another.o}. + +Using @samp{+=} is similar to: + +@example +objects = main.o foo.o bar.o utils.o +objects := $(objects) another.o +@end example + +@noindent +but differs in ways that become important when you use more complex values. + +When the variable in question has not been defined before, @samp{+=} +acts just like normal @samp{=}: it defines a recursively-expanded +variable. However, when there @emph{is} a previous definition, exactly +what @samp{+=} does depends on what flavor of variable you defined +originally. @xref{Flavors, ,The Two Flavors of Variables}, for an +explanation of the two flavors of variables. + +When you add to a variable's value with @samp{+=}, @code{make} acts +essentially as if you had included the extra text in the initial +definition of the variable. If you defined it first with @samp{:=}, +making it a simply-expanded variable, @samp{+=} adds to that +simply-expanded definition, and expands the new text before appending it +to the old value just as @samp{:=} does +(@pxref{Setting, ,Setting Variables}, for a full explanation of @samp{:=}). +In fact, + +@example +variable := value +variable += more +@end example + +@noindent +is exactly equivalent to: + +@noindent +@example +variable := value +variable := $(variable) more +@end example + +On the other hand, when you use @samp{+=} with a variable that you defined +first to be recursively-expanded using plain @samp{=}, @code{make} does +something a bit different. Recall that when you define a +recursively-expanded variable, @code{make} does not expand the value you set +for variable and function references immediately. Instead it stores the text +verbatim, and saves these variable and function references to be expanded +later, when you refer to the new variable (@pxref{Flavors, ,The Two Flavors +of Variables}). When you use @samp{+=} on a recursively-expanded variable, +it is this unexpanded text to which @code{make} appends the new text you +specify. + +@example +variable = value +variable += more +@end example + +@noindent +is roughly equivalent to: + +@example +temp = value +variable = $(temp) more +@end example + +@noindent +except that of course it never defines a variable called @code{temp}. +The importance of this comes when the variable's old value contains +variable references. Take this common example: + +@example +CFLAGS = $(includes) -O +@dots{} +CFLAGS += -pg # enable profiling +@end example + +@noindent +The first line defines the @code{CFLAGS} variable with a reference to another +variable, @code{includes}. (@code{CFLAGS} is used by the rules for C +compilation; @pxref{Catalogue of Rules, ,Catalogue of Implicit Rules}.) +Using @samp{=} for the definition makes @code{CFLAGS} a recursively-expanded +variable, meaning @w{@samp{$(includes) -O}} is @emph{not} expanded when +@code{make} processes the definition of @code{CFLAGS}. Thus, @code{includes} +need not be defined yet for its value to take effect. It only has to be +defined before any reference to @code{CFLAGS}. If we tried to append to the +value of @code{CFLAGS} without using @samp{+=}, we might do it like this: + +@example +CFLAGS := $(CFLAGS) -pg # enable profiling +@end example + +@noindent +This is close, but not quite what we want. Using @samp{:=} redefines +@code{CFLAGS} as a simply-expanded variable; this means @code{make} expands +the text @w{@samp{$(CFLAGS) -pg}} before setting the variable. If +@code{includes} is not yet defined, we get @w{@samp{ -O -pg}}, and a later +definition of @code{includes} will have no effect. Conversely, by using +@samp{+=} we set @code{CFLAGS} to the @emph{unexpanded} value +@w{@samp{$(includes) -O -pg}}. Thus we preserve the reference to +@code{includes}, so if that variable gets defined at any later point, a +reference like @samp{$(CFLAGS)} still uses its value. + +@node Override Directive, Defining, Appending, Using Variables @section The @code{override} Directive @findex override @cindex overriding with @code{override} -@cindex variable, overriding +@cindex variables, overriding -If a variable has been set with a command argument (@pxref{Overriding, ,Overriding Variables}), +If a variable has been set with a command argument +(@pxref{Overriding, ,Overriding Variables}), then ordinary assignments in the makefile are ignored. If you want to set the variable in the makefile even though it was set with a command argument, you can use an @code{override} directive, which is a line that @@ -4054,6 +4228,7 @@ override @var{variable} = @var{value} @end example +@noindent or @example @@ -4060,6 +4235,15 @@ override @var{variable} := @var{value} @end example +To append more text to a variable defined on the command line, use: + +@example +override @var{variable} += @var{more text} +@end example + +@noindent +@xref{Appending, ,Appending More Text to Variables}. + The @code{override} directive was not invented for escalation in the war between makefiles and command arguments. It was invented so you can alter and add to values that the user specifies with command arguments. @@ -4070,7 +4254,7 @@ @code{override} directive: @example -override CFLAGS := $(CFLAGS) -g +override CFLAGS += -g @end example You can also use @code{override} directives with @code{define} directives. @@ -4096,7 +4280,7 @@ @findex endef @cindex verbatim variable definition @cindex defining variables verbatim -@cindex variable, defining verbatim +@cindex variables, defining verbatim Another way to set the value of a variable is to use the @code{define} directive. This directive has an unusual syntax which allows newline @@ -4134,7 +4318,10 @@ @end example @noindent -since the shell will interpret the semicolon and the newline identically. +since two commands separated by semicolon behave much like two separate +shell commands. However, note that using two separate lines means +@code{make} will invoke the shell twice, running an independent subshell +for each line. @xref{Execution, ,Command Execution}. If you want variable definitions made with @code{define} to take precedence over command-line variable definitions, you can use the @@ -4153,7 +4340,7 @@ @node Environment, , Defining, Using Variables @section Variables from the Environment -@cindex variable, environment +@cindex variables, environment @cindex environment Variables in @code{make} can come from the environment in which @code{make} is run. Every environment variable that @code{make} sees when @@ -4810,8 +4997,7 @@ compiler, like this: @example -override CFLAGS := $(CFLAGS) \ - $(patsubst %,-I%,$(subst :, ,$(VPATH))) +override CFLAGS += $(patsubst %,-I%,$(subst :, ,$(VPATH))) @end example @noindent @@ -5107,7 +5293,7 @@ @node Origin Function, Shell Function, Foreach Function, Functions @section The @code{origin} Function @findex origin -@cindex variable, origin of +@cindex variables, origin of @cindex origin of variable The @code{origin} function is unlike most other functions in that it does @@ -5428,6 +5614,7 @@ and how to update each target. But updating the targets is not always what you want. Certain options specify other activities for @code{make}. +@comment Extra blank lines make it print better. @table @samp @item -n @itemx --just-print @@ -5437,6 +5624,7 @@ @cindex @code{--dry-run} @cindex @code{--recon} @cindex @code{-n} + ``No-op''. The activity is to print what commands would be used to make the targets up to date, but not actually execute them. @@ -5446,6 +5634,7 @@ @cindex touching files @cindex target, touching @cindex @code{-t} + ``Touch''. The activity is to mark the targets as up to date without actually changing them. In other words, @code{make} pretends to compile the targets but does not really change their contents. @@ -5455,6 +5644,7 @@ @cindex @code{--question} @cindex @code{-q} @cindex question mode + ``Question''. The activity is to find out silently whether the targets are up to date already; but execute no commands in either case. In other words, neither compilation nor output will occur. @@ -5469,6 +5659,7 @@ @cindex @code{--new-file} @cindex what if @cindex files, assuming new + ``What if''. Each @samp{-W} flag is followed by a file name. The given files' modification times are recorded by @code{make} as being the present time, although the actual modification times remain the same. @@ -5575,9 +5766,9 @@ @node Overriding, Testing, Avoiding Compilation, Running @section Overriding Variables @cindex overriding variables with arguments -@cindex variable, overriding with arguments +@cindex variables, overriding with arguments @cindex command line variables -@cindex variable, command line +@cindex variables, command line An argument that contains @samp{=} specifies the value of a variable: @samp{@var{v}=@var{x}} sets the value of the variable @var{v} to @var{x}. @@ -5888,6 +6079,13 @@ rarely need to specify this option since @samp{make} does it for you; see @ref{-w Option, ,The @samp{--print-directory} Option}.) +@itemx --no-print-directory +@cindex @code{--no-print-directory} +Disable printing of the working directory under @code{-w}. +This option is useful when @code{-w} is turned on automatically, +but you do not want to see the extra messages. +@xref{-w Option, ,The @samp{--print-directory} Option}. + @item -W @var{file} @cindex @code{-W} @itemx --what-if @var{file} @@ -6051,23 +6249,22 @@ canceling or overriding an implicit rule. The @samp{-r} or @samp{--no-builtin-rules} option cancels all predefined rules. -Not all of these rules will always be defined, even when the @samp{-r} -option is not given. Many of the predefined implicit rules are -implemented in @code{make} as suffix rules, so which ones will be -defined depends on the @dfn{suffix list} (the list of dependencies of -the special target @code{.SUFFIXES}). The default suffix list is: -@code{.out}, @code{.a}, @code{.ln}, @code{.o}, @code{.c}, @code{.cc}, -@code{.C}, @code{.p}, @code{.f}, @code{.F}, @code{.r}, @code{.y}, -@code{.l}, @code{.s}, @code{.S}, @code{.mod}, @code{.sym}, -@code{.def}, @code{.h}, @code{.info}, @code{.dvi}, @code{.tex}, -@code{.texinfo}, @code{.texi}, @code{.cweb}, @code{.web}, @code{.sh}, -@code{.elc}, @code{.el}. All of the implicit rules described below -whose dependencies have one of these suffixes are actually suffix -rules. If you modify the suffix list, the only predefined suffix -rules in effect will be those named by one or two of the suffixes that -are on the list you specify; rules whose suffixes fail to be on the -list are disabled. @xref{Suffix Rules, ,Old-Fashioned Suffix Rules}, -for full details on suffix rules. +Not all of these rules will always be defined, even when the @samp{-r} option +is not given. Many of the predefined implicit rules are implemented in +@code{make} as suffix rules, so which ones will be defined depends on the +@dfn{suffix list} (the list of dependencies of the special target +@code{.SUFFIXES}). The default suffix list is: @code{.out}, @code{.a}, +@code{.ln}, @code{.o}, @code{.c}, @code{.cc}, @code{.C}, @code{.p}, +@code{.f}, @code{.F}, @code{.r}, @code{.y}, @code{.l}, @code{.s}, @code{.S}, +@code{.mod}, @code{.sym}, @code{.def}, @code{.h}, @code{.info}, @code{.dvi}, +@code{.tex}, @code{.texinfo}, @code{.texi}, @code{.txinfo}, @code{.cweb}, +@code{.web}, @code{.sh}, @code{.elc}, @code{.el}. All of the implicit rules +described below whose dependencies have one of these suffixes are actually +suffix rules. If you modify the suffix list, the only predefined suffix +rules in effect will be those named by one or two of the suffixes that are on +the list you specify; rules whose suffixes fail to be on the list are +disabled. @xref{Suffix Rules, ,Old-Fashioned Suffix Rules}, for full details +on suffix rules. @table @asis @item Compiling C programs @@ -6074,6 +6271,8 @@ @cindex C, rule to compile @pindex cc @pindex gcc +@pindex .o +@pindex .c @file{@var{n}.o} is made automatically from @file{@var{n}.c} with a command of the form @samp{$(CC) -c $(CPPFLAGS) $(CFLAGS)}.@refill @@ -6080,6 +6279,8 @@ @item Compiling C++ programs @cindex C++, rule to compile @pindex g++ +@pindex .C +@pindex .cc @file{@var{n}.o} is made automatically from @file{@var{n}.cc} or @file{@var{n}.C} with a command of the form @samp{$(CXX) -c $(CPPFLAGS) $(CXXFLAGS)}. We encourage you to use the suffix @samp{.cc} for C++ @@ -6088,6 +6289,7 @@ @item Compiling Pascal programs @cindex Pascal, rule to compile @pindex pc +@pindex .p @file{@var{n}.o} is made automatically from @file{@var{n}.p} with the command @samp{$(PC) -c $(PFLAGS)}.@refill @@ -6095,6 +6297,9 @@ @cindex Fortran, rule to compile @cindex Ratfor, rule to compile @pindex f77 +@pindex .f +@pindex .r +@pindex .F @file{@var{n}.o} is made automatically from @file{@var{n}.r}, @file{@var{n}.F} or @file{@var{n}.f} by running the Fortran compiler. The precise command used is as follows:@refill @@ -6124,6 +6329,9 @@ @item Compiling Modula-2 programs @cindex Modula-2, rule to compile @pindex m2c +@pindex .sym +@pindex .def +@pindex .mod @file{@var{n}.sym} is made from @file{@var{n}.def} with a command of the form @samp{$(M2C) $(M2FLAGS) $(DEFFLAGS)}. @file{@var{n}.o} is made from @file{@var{n}.mod}; the form is: @@ -6133,10 +6341,12 @@ @item Assembling and preprocessing assembler programs @cindex assembly, rule to compile @pindex as +@pindex .s @file{@var{n}.o} is made automatically from @file{@var{n}.s} by running the assembler, @code{as}. The precise command is @samp{$(AS) $(ASFLAGS)}.@refill +@pindex .S @file{@var{n}.s} is made automatically from @file{@var{n}.S} by running the C preprocessor, @code{cpp}. The precise command is @w{@samp{$(CPP) $(CPPFLAGS)}}. @@ -6187,6 +6397,7 @@ @item Yacc for C programs @pindex yacc @cindex Yacc, rule to run +@pindex .y @file{@var{n}.c} is made automatically from @file{@var{n}.y} by running Yacc with the command @samp{$(YACC) $(YFLAGS)}. @@ -6193,6 +6404,7 @@ @item Lex for C programs @pindex lex @cindex Lex, rule to run +@pindex .l @file{@var{n}.c} is made automatically from @file{@var{n}.l} by by running Lex. The actual command is @samp{$(LEX) $(LFLAGS)}. @@ -6221,6 +6433,7 @@ @item Making Lint Libraries from C, Yacc, or Lex programs @pindex lint @cindex @code{lint}, rule to run +@pindex .ln @file{@var{n}.ln} is made from @file{@var{n}.c} with a command of the form @w{@samp{$(LINT) $(LINTFLAGS) $(CPPFLAGS) -i}}. The same command is used on the C code produced from @@ -6234,6 +6447,10 @@ @pindex weave @pindex tangle @pindex ctangle +@pindex .dvi +@pindex .tex +@pindex .web +@pindex .cweb @file{@var{n}.dvi} is made from @file{@var{n}.tex} with the command @samp{$(TEX)}. @file{@var{n}.tex} is made from @file{@var{n}.web} with @samp{$(WEAVE)}, or from @file{@var{n}.cweb} @@ -6246,14 +6463,19 @@ @cindex Info, rule to format @pindex texi2dvi @pindex makeinfo -@file{@var{n}.dvi} is made from @file{@var{n}.texinfo} or -@file{@var{n}.texi} with the @samp{$(TEXI2DVI)} command. -@file{@var{n}.info} is made from @file{@var{n}.texinfo} or -@file{@var{n}.texi} with the @samp{$(MAKEINFO)} command .@refill +@pindex .texinfo +@pindex .info +@pindex .texi +@pindex .txinfo +@file{@var{n}.dvi} is made from @file{@var{n}.texinfo}, @file{@var{n}.texi}, +or @file{@var{n}.txinfo}, with the @samp{$(TEXI2DVI)} command. +@file{@var{n}.info} is made from @file{@var{n}.texinfo}, @file{@var{n}.texi}, +or @file{@var{n}.txinfo}, with the @samp{$(MAKEINFO)} command.@refill @item RCS @cindex RCS, rule to extract from @pindex co +@pindex ,v @r{(RCS file extension)} Any file @file{@var{n}} is extracted if necessary from an RCS file named either @file{@var{n},v} or @file{RCS/@var{n},v}. The precise command used is @w{@samp{$(CO) $(COFLAGS)}}. @file{@var{n}} will not be @@ -6266,6 +6488,7 @@ @item SCCS @cindex SCCS, rule to extract from @pindex get +@pindex s. @r{(SCCS file prefix)} Any file @file{@var{n}} is extracted if necessary from an SCCS file named either @file{s.@var{n}} or @file{SCCS/s.@var{n}}. The precise command used is @w{@samp{$(GET) $(GFLAGS)}}. The rules for SCCS are @@ -6273,6 +6496,7 @@ so SCCS files cannot be generated from another source; they must actually exist.@refill +@pindex .sh For the benefit of SCCS, a file @file{@var{n}} is copied from @file{@var{n}.sh} and made executable (by everyone). This is for shell scripts that are checked into SCCS. Since RCS preserves the @@ -6729,8 +6953,8 @@ @node Automatic, Pattern Match, Pattern Examples, Pattern Rules @subsection Automatic Variables @cindex automatic variables -@cindex variable, automatic -@cindex variable, and implicit rule +@cindex variables, automatic +@cindex variables, and implicit rule Suppose you are writing a pattern rule to compile a @samp{.c} file into a @samp{.o} file: how do you write the @samp{cc} command so that it operates @@ -7590,6 +7814,10 @@ The special significance of @samp{+} characters preceding command lines (@pxref{Instead of Execution, ,Instead of Executing the Commands}) is mandated by draft 11.2 of IEEE Std 1003.2 (POSIX).@refill + +@item +The @samp{+=} syntax to append to the value of a variable comes from SunOS +4.0 @code{make}. @xref{Appending, , Appending More Text to Variables}. @end itemize The remaining features are inventions new in GNU @code{make}: @@ -7759,9 +7987,10 @@ and thus make this feature obsolete.@refill @item -In some Unix @code{make}s, implicit rule search (@pxref{Implicit Rules, ,Using Implicit Rules}) is -apparently done for @emph{all} targets, not just those without commands. -This means you can do:@refill +In some Unix @code{make}s, implicit rule search +(@pxref{Implicit Rules, ,Using Implicit Rules}) is apparently done for +@emph{all} targets, not just those without commands. This means you can +do:@refill @example @group @@ -7782,6 +8011,26 @@ GNU @code{make} does not include any built-in implicit rules for compiling or preprocessing EFL programs. If we hear of anyone who is using EFL, we will gladly add them. + +@item +It appears that in SVR4 @code{make}, a suffix rule can be specified with +no commands, and it is treated as if it had empty commands +(@pxref{Empty Commands}). For example: + +@example +.c.a: +@end example + +@noindent +will override the built-in @file{.c.a} suffix rule. + +We feel that it is cleaner for a rule without commands to always simply +add to the dependency list for the target. The above example can be +easily rewritten to get the desired behavior in GNU @code{make}: + +@example +.c.a: ; +@end example @end itemize @comment The makefile standards are in a separate file that is also @@ -7827,6 +8076,7 @@ @item override @var{variable} = @var{value} @itemx override @var{variable} := @var{value} +@itemx override @var{variable} += @var{value} @itemx override define @var{variable} @itemx endef @@ -7842,6 +8092,7 @@ @item export @var{variable} @itemx export @var{variable} = @var{value} @itemx export @var{variable} := @var{value} +@itemx export @var{variable} += @var{value} @itemx unexport @var{variable} Tell @code{make} whether or not to export a particular variable to child diff -ruN make-3.63/misc.c make-3.64/misc.c --- make-3.63/misc.c Fri Jan 22 16:32:00 1993 +++ make-3.64/misc.c Thu Apr 15 18:42:20 1993 @@ -135,7 +135,7 @@ backslash = 0; bs_write = 0; - for (p2 = p - 1; p2 > line && *p2 == '\\'; --p2) + for (p2 = p - 1; p2 >= line && *p2 == '\\'; --p2) { if (backslash) ++bs_write; @@ -499,6 +499,22 @@ #define access_inited (user_uid != -1) static enum { make, user } current_access; + +/* Under -d, write a message describing the current IDs. */ + +static void +log_access (flavor) + char *flavor; +{ + if (! debug_flag) + return; + + printf ("%s access: user %d (real %d), group %d (real %d)\n", + flavor, geteuid (), getuid (), getegid (), getgid ()); + fflush (stdout); +} + + static void init_access () { @@ -512,6 +528,8 @@ if (user_uid == -1 || user_gid == -1 || make_uid == -1 || make_gid == -1) pfatal_with_name ("get{e}[gu]id"); + log_access ("Initialized"); + current_access = make; } @@ -572,6 +590,8 @@ current_access = user; + log_access ("User"); + #endif /* GETLOADAVG_PRIVILEGED */ } @@ -608,6 +628,8 @@ current_access = make; + log_access ("Make"); + #endif /* GETLOADAVG_PRIVILEGED */ } @@ -618,6 +640,9 @@ { #ifdef GETLOADAVG_PRIVILEGED + if (!access_inited) + abort (); + /* Set both the real and effective UID and GID to the user's. They cannot be changed back to make's. */ @@ -636,6 +661,8 @@ if (setregid (user_gid, user_gid) < 0) pfatal_with_name ("child_access: setregid"); #endif + + log_access ("Child"); #endif /* GETLOADAVG_PRIVILEGED */ } diff -ruN make-3.63/read.c make-3.64/read.c --- make-3.63/read.c Mon Jan 18 19:14:29 1993 +++ make-3.64/read.c Thu Apr 15 18:30:01 1993 @@ -1,4 +1,5 @@ -/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. +/* Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 + Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -343,6 +344,8 @@ p = collapsed; while (isspace (*p)) ++p; + /* We cannot consider a line containing just a tab to be empty + because it might constitute an empty command for a target. */ if (*p == '\0' && lb.buffer[0] != '\t') continue; @@ -401,7 +404,9 @@ lineno, infile, filename); } } - else if (!ignoring && !try_variable_definition (p2, o_override)) + else if (!ignoring + && !try_variable_definition (filename, lineno, + p2, o_override)) makefile_error (filename, lineno, "empty `override' directive"); continue; @@ -418,39 +423,40 @@ unsigned int len; if (no_targets) - { - /* Ignore the commands in a rule with no targets. */ - no_targets = 0; - continue; - } - - if (filenames == 0) - makefile_fatal (filename, lineno, - "commands with no associated target"); + /* Ignore the commands in a rule with no targets. */ + continue; - /* Add this command line to end of the line being accumulated. */ - p = lb.buffer; - if (commands_idx == 0) - commands_started = lineno; - len = strlen (p); - if (len + 1 + commands_idx > commands_len) - { - commands_len = (len + 1 + commands_idx) * 2; - commands = (char *) xrealloc (commands, commands_len); - } - bcopy (p, &commands[commands_idx], len); - commands_idx += len; - commands[commands_idx++] = '\n'; + /* If there is no preceding rule line, don't treat this line + as a command, even though it begins with a tab character. + SunOS 4 make appears to behave this way. */ + + if (filenames != 0) + { + /* Append this command line to the line being accumulated. */ + p = lb.buffer; + if (commands_idx == 0) + commands_started = lineno; + len = strlen (p); + if (len + 1 + commands_idx > commands_len) + { + commands_len = (len + 1 + commands_idx) * 2; + commands = (char *) xrealloc (commands, commands_len); + } + bcopy (p, &commands[commands_idx], len); + commands_idx += len; + commands[commands_idx++] = '\n'; - continue; + continue; + } } - else if (word1eq ("export", 6)) + + if (word1eq ("export", 6)) { struct variable *v; p2 = next_token (p + 6); if (*p2 == '\0') export_all_variables = 1; - v = try_variable_definition (p2, o_file); + v = try_variable_definition (filename, lineno, p2, o_file); if (v != 0) v->export = v_export; else @@ -500,7 +506,8 @@ p2 = p; files = multi_glob (parse_file_seq (&p2, '\0', sizeof (struct nameseq)), - sizeof (struct nameseq)); + sizeof (struct nameseq), + 1); free (p); /* Save the state of conditionals and start @@ -539,8 +546,6 @@ { pattern = savestring (p, len); p = find_next_token (&p2, &len); - if (p != 0) - p = savestring (p, len); /* No searchpath means remove all previous selective VPATH's with the same pattern. */ } @@ -550,11 +555,9 @@ construct_vpath_list (pattern, p); if (pattern != 0) free (pattern); - if (p != 0) - free (p); } #undef word1eq - else if (try_variable_definition (p, o_file)) + else if (try_variable_definition (filename, lineno, p, o_file)) /* This line has been dealt with. */ ; else @@ -610,8 +613,9 @@ } filenames = multi_glob (parse_file_seq (&p2, ':', - sizeof (struct nameseq), 1), - sizeof (struct nameseq)); + sizeof (struct nameseq)), + sizeof (struct nameseq), + 1); if (*p2++ == '\0') makefile_fatal (filename, lineno, "missing separator"); /* Is this a one-colon or two-colon entry? */ @@ -652,8 +656,9 @@ /* Parse the dependencies. */ deps = (struct dep *) - multi_glob (parse_file_seq (&p2, '\0', sizeof (struct dep), 1), - sizeof (struct dep)); + multi_glob (parse_file_seq (&p2, '\0', sizeof (struct dep)), + sizeof (struct dep), + 1); commands_idx = 0; if (cmdleft != 0) @@ -1415,13 +1420,16 @@ SIZE is how big to construct chain elements. This is useful if we want them actually to be other structures - that have room for additional info. */ + that have room for additional info. + If STRIP is nonzero, strip `./'s off the beginning. */ + struct nameseq * -parse_file_seq (stringp, stopchar, size) +parse_file_seq (stringp, stopchar, size, strip) char **stringp; char stopchar; unsigned int size; + int strip; { register struct nameseq *new = 0; register struct nameseq *new1; @@ -1453,14 +1461,15 @@ } p--; - /* Skip leading `./'s. */ - while (p - q > 2 && q[0] == '.' && q[1] == '/') - { - q += 2; /* Skip "./". */ - while (q < p && *q == '/') - /* Skip following slashes: ".//foo" is "foo", not "/foo". */ - ++q; - } + if (strip) + /* Skip leading `./'s. */ + while (p - q > 2 && q[0] == '.' && q[1] == '/') + { + q += 2; /* Skip "./". */ + while (q < p && *q == '/') + /* Skip following slashes: ".//foo" is "foo", not "/foo". */ + ++q; + } /* Extract the filename just found, and skip it. */ diff -ruN make-3.63/remake.c make-3.64/remake.c --- make-3.63/remake.c Fri Jan 22 17:02:48 1993 +++ make-3.64/remake.c Mon Apr 12 16:52:45 1993 @@ -22,19 +22,17 @@ #include "dep.h" #include "file.h" -#if !defined (USG) && !defined (POSIX) -#ifndef sgi -#include -#endif -#else +#ifdef HAVE_FCNTL_H #include +#else +#include #endif extern int try_implicit_rule (); -/* Incremented when a file has been remade. */ -unsigned int files_remade = 0; +/* Incremented when a command is started (under -n, when one would be). */ +unsigned int commands_started = 0; static int update_file (), update_file_1 (), check_dep (), touch_file (); static void remake_file (); @@ -65,6 +63,17 @@ goals = copy_dep_chain (goals); + { + /* Clear the `changed' flag of each goal in the chain. + We will use the flag below to notice when any commands + have actually been run for a target. When no commands + have been run, we give an "up to date" diagnostic. */ + + struct dep *g; + for (g = goals; g != 0; g = g->next) + g->changed = 0; + } + if (makefiles) /* Only run one job at a time. */ job_slots = 1; @@ -87,6 +96,7 @@ g = goals; while (g != 0) { + unsigned int ocommands_started; int x; time_t mtime = MTIME (g->file); check_renamed (g->file); @@ -103,14 +113,26 @@ touch_flag = question_flag = just_print_flag = 0; } + /* Save the old value of `commands_started' so we can compare later. + It will be incremented when any commands are actually run. */ + ocommands_started = commands_started; + x = update_file (g->file, makefiles ? 1 : 0); check_renamed (g->file); + + /* Set the goal's `changed' flag if any commands were started + by calling update_file above. We check this flag below to + decide when to give an "up to date" diagnostic. */ + g->changed += commands_started - ocommands_started; + if (x != 0 || g->file->updated) { int stop = 0; + /* If STATUS was not already 1, set it to 1 if updating failed, or to 0 if updating succeeded. Leave STATUS as it is if no updating was done. */ + if (status < 1) { if (g->file->update_status != 0) @@ -135,9 +157,27 @@ } } - g->file = g->file->prev; - if (stop || g->file == 0) + if (stop || g->file->prev == 0) { + /* If we have found nothing whatever to do for the goal, + print a message saying nothing needs doing. */ + + if (!makefiles + /* If the update_status is zero, we updated successfully + or not at all. G->changed will have been set above if + any commands were actually started for this goal. */ + && g->file->update_status == 0 && !g->changed + /* Never give a message under -s or -q. */ + && !silent_flag && !question_flag) + { + if (g->file->phony || g->file->cmds == 0) + message ("Nothing to be done for `%s'.", + g->file->name); + else + message ("`%s' is up to date.", g->file->name); + fflush (stdout); + } + /* This goal is finished. Remove it from the chain. */ if (lastgoal == 0) goals = g->next; @@ -149,6 +189,15 @@ g = lastgoal == 0 ? goals : lastgoal->next; } + else if (g->file->updated) + /* This instance of the target is done being updated. + Go to the next instance (:: rule). + update_file cycles through all instances, but under -j, + update_file can return while the file is running, + then reap_children can change its command state and + updated flag, leaving G->file done, but some of its + other instances needing work. */ + g->file = g->file->prev; if (stop) break; @@ -191,7 +240,6 @@ { register int status = 0; register struct file *f; - unsigned int ofiles_remade = files_remade; for (f = file; f != 0; f = f->prev) { @@ -221,26 +269,6 @@ } } - /* For a top level target, if we have found nothing whatever to do for it, - print a message saying nothing needs doing. */ - - /* Give a message iff updated successfully, and never under -s or -q. */ - if (status == 0 && !silent_flag && !question_flag - /* files_remade will have been incremented iff we actually - ran any commands (under -n, if we would have). */ - && files_remade == ofiles_remade - /* Only give the diagnostic for top-level targets. - The makefile chain run is done with DEPTH==1 precisely - to avoid this message. */ - && depth == 0) - { - if (file->phony || file->cmds == 0) - message ("Nothing to be done for `%s'.", file->name); - else - message ("`%s' is up to date.", file->name); - fflush (stdout); - } - return status; } @@ -570,7 +598,7 @@ we don't want to do the touching. */ unsigned int i; for (i = 0; i < file->cmds->ncommand_lines; ++i) - if (!file->cmds->lines_recurse[i]) + if (!(file->cmds->lines_flags[i] & COMMANDS_RECURSE)) goto have_nonrecursing; } else @@ -609,7 +637,7 @@ We do this instead of just invalidating the cached time so that a vpath_search can happen. Otherwise, it would never be done because the target is already updated. */ - (void) f_mtime (d->file); + (void) f_mtime (d->file, 0); } } @@ -810,7 +838,7 @@ register struct file *file; int search; { - register time_t mtime; + time_t mtime; /* File's mtime is not known; must get it from the system. */ @@ -882,11 +910,15 @@ { /* If name_mtime failed, search VPATH. */ char *name = file->name; - if (vpath_search (&name) + if (vpath_search (&name, &mtime) /* Last resort, is it a library (-lxxx)? */ || (name[0] == '-' && name[1] == 'l' - && library_search (&name))) + && library_search (&name, &mtime))) { + if (mtime != 0) + /* vpath_search and library_search store zero in MTIME + if they didn't need to do a stat call for their work. */ + file->last_mtime = mtime; rename_file (file, name); check_renamed (file); return file_mtime (file); @@ -925,8 +957,9 @@ directories. */ static int -library_search (lib) +library_search (lib, mtime_ptr) char **lib; + time_t *mtime_ptr; { static char *dirs[] = { @@ -937,6 +970,7 @@ }; char *libname = &(*lib)[2]; /* Name without the `-l'. */ + time_t mtime; /* Buffer to construct possible names in. */ char *buf = xmalloc (sizeof (LIBDIR) + 8 + strlen (libname) + 4 + 2 + 1); @@ -945,9 +979,12 @@ /* Look first for `libNAME.a' in the current directory. */ sprintf (buf, "lib%s.a", libname); - if (name_mtime (buf) != (time_t) -1) + mtime = name_mtime (buf); + if (mtime != (time_t) -1) { *lib = buf; + if (mtime_ptr != 0) + *mtime_ptr = mtime; return 1; } @@ -954,7 +991,7 @@ /* Now try VPATH search on that. */ file = buf; - if (vpath_search (&file)) + if (vpath_search (&file, mtime_ptr)) { free (buf); *lib = file; @@ -966,9 +1003,12 @@ for (dp = dirs; *dp != 0; ++dp) { sprintf (buf, "%s/lib%s.a", *dp, libname); - if (name_mtime (buf) != (time_t) -1) + mtime = name_mtime (buf); + if (mtime != (time_t) -1) { *lib = buf; + if (mtime_ptr != 0) + *mtime_ptr = mtime; return 1; } } diff -ruN make-3.63/remote-cstms.c make-3.64/remote-cstms.c --- make-3.63/remote-cstms.c Sat Jul 4 20:52:45 1992 +++ make-3.64/remote-cstms.c Thu Feb 4 13:31:53 1993 @@ -4,7 +4,7 @@ Please do not send bug reports or questions about it to the Make maintainers. -Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc. +Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -23,33 +23,88 @@ #include "make.h" #include "commands.h" -#include "customs.h" +#include "job.h" #include +#include + +#define __STRICT_BSD__ /* Don't make conflicting declarations. */ +#include "customs.h" char *remote_description = "Customs"; +/* File name of the Customs `export' client command. + A full path name can be used to avoid some path-searching overhead. */ +#define EXPORT_COMMAND "/usr/local/bin/export" /* ExportPermit gotten by start_remote_job_p, and used by start_remote_job. */ static ExportPermit permit; +/* Normalized path name of the current directory. */ +static char *normalized_cwd; + /* Return nonzero if the next job should be done remotely. */ int start_remote_job_p () { - if (Customs_Host (EXPORT_SAME, &permit) != RPC_SUCCESS) + static int inited = 0; + int status; + + /* Allow the user to turn off job exportation + (useful while he is debugging Customs, for example). */ + if (getenv ("GNU_MAKE_NO_CUSTOMS") != 0) + return 0; + + if (!inited) + { + /* For secure Customs, make is installed setuid root and + Customs requires a privileged source port be used. */ + make_access (); + + /* Ping the daemon once to see if it is there. */ + inited = Customs_Ping () == RPC_SUCCESS ? 1 : -1; + + /* Return to normal user access. */ + user_access (); + + if (starting_directory == 0) + /* main couldn't figure it out. */ + inited = -1; + else + { + /* Normalize the current directory path name to something + that should work on all machines exported to. */ + + normalized_cwd = (char *) xmalloc (GET_PATH_MAX); + strcpy (normalized_cwd, starting_directory); + if (Customs_NormPath (normalized_cwd, GET_PATH_MAX) < 0) + /* Path normalization failure means using Customs + won't work, but it's not really an error. */ + inited = -1; + } + } + + if (inited < 0) return 0; + status = Customs_Host (EXPORT_SAME, &permit); + if (status != RPC_SUCCESS) + { + if (debug_flag) + printf ("Customs won't export: %s\n", Rpc_ErrorMessage (status)); + return 0; + } + return !CUSTOMS_FAIL (&permit.addr); } -/* Start a remote job running the command in ARGV, - with environment from ENVP. It gets standard input from STDIN_FD. On - failure, return nonzero. On success, return zero, and set *USED_STDIN - to nonzero if it will actually use STDIN_FD, zero if not, set *ID_PTR to - a unique identification, and set *IS_REMOTE to zero if the job is local, - nonzero if it is remote (meaning *ID_PTR is a process ID). */ +/* Start a remote job running the command in ARGV, with environment from + ENVP. It gets standard input from STDIN_FD. On failure, return + nonzero. On success, return zero, and set *USED_STDIN to nonzero if it + will actually use STDIN_FD, zero if not, set *ID_PTR to a unique + identification, and set *IS_REMOTE to nonzero if the job is remote, zero + if it is local (meaning *ID_PTR is a process ID). */ int start_remote_job (argv, envp, stdin_fd, is_remote, id_ptr, used_stdin) @@ -60,7 +115,6 @@ int *used_stdin; { extern int vfork (), execve (); - PATH_VAR (cwd); char waybill[MAX_DATA_SIZE], msg[128]; struct timeval timeout; struct sockaddr_in sin; @@ -69,17 +123,6 @@ Rpc_Stat status; int pid; - /* Find the current directory. */ - if (getcwd (cwd, GET_PATH_MAX) == 0) - { -#ifdef HAVE_GETCWD - perror_with_name ("exporting: getcwd: ", ""); -#else - error ("exporting: getwd: %s", cwd); -#endif - return 1; - } - /* Create the return socket. */ retsock = Rpc_UdpCreate (True, 0); if (retsock < 0) @@ -89,7 +132,7 @@ } /* Get the return socket's port number. */ - len = sizeof(sin); + len = sizeof (sin); if (getsockname (retsock, (struct sockaddr *) &sin, &len) < 0) { (void) close (retsock); @@ -102,9 +145,16 @@ sock = Rpc_TcpCreate (False, 0); /* Create a WayBill to give to the server. */ - len = Customs_MakeWayBill (&permit, cwd, argv[0], argv, + len = Customs_MakeWayBill (&permit, normalized_cwd, argv[0], argv, envp, retport, waybill); + /* Modify the waybill as if the remote child had done `child_access ()'. */ + { + WayBill *wb = (WayBill *) waybill; + wb->euid = wb->ruid; + wb->rgid = wb->rgid; + } + /* Send the request to the server, timing out in 20 seconds. */ timeout.tv_usec = 0; timeout.tv_sec = 20; @@ -129,6 +179,14 @@ error ("CUSTOMS_IMPORT: %s", msg); return 1; } + else if (debug_flag) + { + struct hostent *host = gethostbyaddr (&permit.addr, sizeof (permit.addr), + AF_INET); + printf ("Job exported to %s ID %u\n", + host == 0 ? inet_ntoa (permit.addr) : host->h_name, + permit.id); + } fflush (stdout); fflush (stderr); @@ -145,7 +203,7 @@ /* Child side. Run `export' to handle the connection. */ static char sock_buf[20], retsock_buf[20], id_buf[20]; static char *new_argv[6] = - { "export", "-id", sock_buf, retsock_buf, id_buf, 0 }; + { EXPORT_COMMAND, "-id", sock_buf, retsock_buf, id_buf, 0 }; /* Set up the arguments. */ (void) sprintf (sock_buf, "%d", sock); @@ -152,10 +210,15 @@ (void) sprintf (retsock_buf, "%d", retsock); (void) sprintf (id_buf, "%x", permit.id); + /* Get the right stdin. */ + if (stdin_fd != 0) + (void) dup2 (stdin_fd, 0); + + /* Unblock signals in the child. */ + unblock_sigs (); + /* Run the command. */ - (void) execvp (new_argv[0], new_argv); - perror_with_name ("execvp: ", new_argv[0]); - _exit (127); + exec_command (new_argv, envp); } /* Parent side. Return the `export' process's ID. */ diff -ruN make-3.63/remote.c make-3.64/remote.c --- make-3.63/remote.c Thu May 17 18:28:11 1990 +++ make-3.64/remote.c @@ -1,5 +0,0 @@ -#ifdef CUSTOMS -#include "remote-cstms.c" -#else /* Not CUSTOMS. */ -#include "remote-stub.c" -#endif /* CUSTOMS. */ diff -ruN make-3.63/rule.c make-3.64/rule.c --- make-3.63/rule.c Fri Nov 13 18:14:36 1992 +++ make-3.64/rule.c Thu Apr 15 18:29:57 1993 @@ -1,5 +1,5 @@ /* Pattern and suffix rule internals for GNU Make. -Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -107,21 +107,25 @@ bcopy (dep->name, name, p - dep->name); name[p - dep->name] = '\0'; - if (!dir_file_exists_p (name, ".")) + /* In the deps of an implicit rule the `changed' flag + actually indicates that the dependency is in a + nonexistent subdirectory. */ + + dep->changed = !dir_file_exists_p (name, ""); + if (dep->changed && *name == '/') { - /* The name is absolute and the directory does not exist. */ - if (*name == '/') - { - freerule (rule, lastrule); - --num_pattern_rules; - goto end_main_loop; - } - else - /* The directory does not exist, but - it might be found in a VPATH directory. */ - rule->subdir = 1; + /* The name is absolute and the directory does not exist. + This rule can never possibly match, since this dependency + can never possibly exist. So just remove the rule from + the list. */ + freerule (rule, lastrule); + --num_pattern_rules; + goto end_main_loop; } } + else + /* This dependency does not reside in a subdirectory. */ + dep->changed = 0; } if (ndeps > max_pattern_deps) @@ -250,7 +254,6 @@ register struct rule *r, *lastrule; register unsigned int i, j; - rule->subdir = 0; rule->in_use = 0; rule->terminal = 0; @@ -350,7 +353,8 @@ ptr = p->dep; r->deps = (struct dep *) multi_glob (parse_file_seq (&ptr, '\0', sizeof (struct dep)), - sizeof (struct dep)); + sizeof (struct dep), + 1); if (new_pattern_rule (r, 0)) { @@ -472,7 +476,7 @@ void print_rule_data_base () { - register unsigned int rules, terminal, subdir; + register unsigned int rules, terminal; register struct rule *r; register struct dep *d; register unsigned int i; @@ -479,7 +483,7 @@ puts ("\n# Implicit Rules"); - rules = terminal = subdir = 0; + rules = terminal = 0; for (r = pattern_rules; r != 0; r = r->next) { ++rules; @@ -503,12 +507,6 @@ printf (" %s", dep_name (d)); putchar ('\n'); - if (r->subdir) - { - ++subdir; - puts ("# references nonexistent subdirectory."); - } - if (r->cmds != 0) print_commands (r->cmds); } @@ -522,12 +520,6 @@ printf (" (%.1f%%)", (double) terminal / (double) rules * 100.0); #endif puts (" terminal."); - - printf ("# %u", subdir); -#ifndef NO_FLOAT - printf (" (%.1f%%)", (double) subdir / (double) rules * 100.0); -#endif - puts (" reference nonexistent subdirectories."); } if (num_pattern_rules != rules) diff -ruN make-3.63/rule.h make-3.64/rule.h --- make-3.63/rule.h Sun Aug 2 06:11:29 1992 +++ make-3.64/rule.h Sun Feb 21 16:56:09 1993 @@ -1,4 +1,4 @@ -/* Copyright (C) 1988, 1989, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify @@ -26,7 +26,6 @@ struct dep *deps; /* Dependencies of the rule. */ struct commands *cmds; /* Commands to execute. */ char terminal; /* If terminal (double-colon). */ - char subdir; /* If references nonexistent subdirectory. */ char in_use; /* If in use by a parent pattern_search. */ }; diff -ruN make-3.63/signame.c make-3.64/signame.c --- make-3.63/signame.c Wed Jan 6 20:47:18 1993 +++ make-3.64/signame.c Sun Feb 21 14:53:02 1993 @@ -16,6 +16,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include /* Some systems need this for . */ #include #ifdef HAVE_CONFIG_H diff -ruN make-3.63/texinfo.tex make-3.64/texinfo.tex --- make-3.63/texinfo.tex Thu Jan 14 17:56:26 1993 +++ make-3.64/texinfo.tex Tue Apr 20 17:01:35 1993 @@ -22,7 +22,7 @@ %You are forbidden to forbid anyone else to use, share and improve %what you give them. Help stamp out software-hoarding! -\def\texinfoversion{2.93} +\def\texinfoversion{2.106} \message{Loading texinfo package [Version \texinfoversion]:} \message{} @@ -179,6 +179,7 @@ % If the next token is an obeyed space (from an @example environment or % the like), remove it and recurse. Otherwise, we're done. \def\parseargx{% + % \obeyedspace is defined far below, after the definition of \sepspaces. \ifx\obeyedspace\temp \expandafter\parseargdiscardspace \else @@ -190,8 +191,6 @@ {\obeyspaces % \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} -\def\obeyedspace{\ } - {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. @@ -354,11 +353,11 @@ \errmessage{@group invalid in context where filling is enabled}% \fi % - % The \vtop we start below produces a box with large depth; thus, TeX - % puts \baselineskip glue before it, and (when the next line of text - % is done) \lineskip glue after it. (See p.82 of the TeXbook.) But - % the next line of text also gets us \parskip glue. Final result: - % space below is slightly more than space above. + % The \vtop we start below produces a box with normal height and large + % depth; thus, TeX puts \baselineskip glue before it, and (when the + % next line of text is done) \lineskip glue after it. (See p.82 of + % the TeXbook.) But the next line of text also gets us \parskip glue. + % Final result: space below is slightly more than space above. \def\Egroup{% \egroup % End the \vtop. \endgroup % End the \group. @@ -365,6 +364,14 @@ }% % \vtop\bgroup + % We have to put a strut on the last line in case the @group is in + % the midst of an example, rather than completely enclosing it. + % Otherwise, the interline space between the last line of the group + % and the first line afterwards is too small. But we can't put the + % strut in \Egroup, since there it would be on a line by itself. + % Hence this just inserts a strut at the beginning of each line. + \everypar = {\strut}% + % % We do @comment here in case we are called inside an environment, % such as @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after @@ -463,8 +470,13 @@ % @include file insert text of that file as input. \def\include{\parsearg\includezzz} -\def\includezzz #1{{\def\thisfile{#1}\input #1 -}} +%Use \input\thisfile to avoid blank after \input, which may be an active +%char (in which case the blank would become the \input argument). +%The grouping keeps the value of \thisfile correct even when @include +%is nested. +\def\includezzz #1{\begingroup +\def\thisfile{#1}\input\thisfile +\endgroup} \def\thisfile{} @@ -543,6 +555,16 @@ \let\defun = \relax \let\defvar = \relax \let\defvr = \relax + \let\ref = \relax + \let\xref = \relax + \let\printindex = \relax + \let\pxref = \relax + \let\settitle = \relax + \let\include = \relax + \let\lowersections = \relax + \let\down = \relax + \let\raisesections = \relax + \let\up = \relax } % Ignore @ignore ... @end ignore. @@ -575,10 +597,35 @@ % \def\enddoignore{\endgroup\ignorespaces}% +\newif\ifwarnedobs\warnedobsfalse +\def\obstexwarn{% + \ifwarnedobs\relax\else + % We need to warn folks that they may have trouble with TeX 3.0. + % This uses \immediate\write16 rather than \message to get newlines. + \immediate\write16{} + \immediate\write16{***WARNING*** for users of Unix TeX 3.0!} + \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} + \immediate\write16{If you are running another version of TeX, relax.} + \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} + \immediate\write16{ Then upgrade your TeX installation if you can.} + \immediate\write16{If you are stuck with version 3.0, run the} + \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} + \immediate\write16{ to use a workaround.} + \immediate\write16{} + \warnedobstrue + \fi +} + +% **In TeX 3.0, setting text in \nullfont hangs tex. For a +% workaround (which requires the file ``dummy.tfm'' to be installed), +% uncomment the following line: +%%%%%\font\nullfont=dummy\let\obstexwarn=\relax + % Ignore text, except that we keep track of conditional commands for % purposes of nesting, up to an `@end #1' command. % \def\nestedignore#1{% + \obstexwarn % We must actually expand the ignored text to look for the @end % command, so that nested ignore constructs work. Thus, we put the % text into a \vbox and then do nothing with the result. To minimize @@ -608,6 +655,7 @@ % might have that installed. Therefore, math mode will still % produce output, but that should be an extremely small amount of % stuff compared to the main input. + % \nullfont \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont @@ -624,6 +672,9 @@ % % Do minimal line-breaking. \pretolerance = 10000 + % + % Do not execute instructions in @tex + \def\tex{\doignore{tex}} } % @set VAR sets the variable VAR to an empty value. @@ -638,16 +689,16 @@ \def\setxxx#1{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% \def\temp{#2}% - \ifx\temp\empty \expandafter\let\csname SET#1\endcsname = \empty + \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. \fi } -\def\setzzz#1#2 \endsetzzz{\expandafter\edef\csname SET#1\endcsname{#2}} +\def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}} % @clear VAR clears (i.e., unsets) the variable VAR. % \def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\expandafter\let\csname SET#1\endcsname=\relax} +\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} % @value{foo} gets the text saved in variable foo. % @@ -739,6 +790,7 @@ \def\node{\ENVcheck\parsearg\nodezzz} \def\nodezzz#1{\nodexxx [#1,]} \def\nodexxx[#1,#2]{\gdef\lastnode{#1}} +\let\nwnode=\node \let\lastnode=\relax \def\donoderef{\ifx\lastnode\relax\else @@ -992,7 +1044,25 @@ }% \null } -\let\code=\tclose + +% We *must* turn on hyphenation at `-' and `_' in \code. +% Otherwise, it is too hard to avoid overful hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate an a dash. +% -- rms. +{ +\catcode `\-=\active +\catcode `\_=\active +\global\def\code{\begingroup \catcode `\-=\active \let-\codedash \let_\codeunder \codex} +} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{\normalunderscore\discretionary{}{}{}} +\def\codex #1{\tclose{#1}\endgroup} + %\let\exp=\tclose %Was temporary % @kbd is like @code, except that if the argument is just one @key command, @@ -1027,7 +1097,6 @@ % First the title page. Must do @settitle before @titlepage. \def\titlefont#1{{\titlerm #1}} -\newtoks\realeverypar \newif\ifseenauthor \newif\iffinishedtitlepage @@ -1614,6 +1683,8 @@ \def\file##1{\realbackslash file {##1}}% \def\var##1{\realbackslash var {##1}}% \def\kbd##1{\realbackslash kbd {##1}}% +\def\dfn##1{\realbackslash dfn {##1}}% +\def\emph##1{\realbackslash emph {##1}}% } % \indexnofonts no-ops all font-change commands. @@ -2005,8 +2076,80 @@ \def\dfn##1{\realbackslash dfn {##1}} } +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raise/lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% Choose a numbered-heading macro +% #1 is heading level if unmodified by @raisesections or @lowersections +% #2 is text for heading +\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 +\ifcase\absseclevel + \chapterzzz{#2} +\or + \seczzz{#2} +\or + \numberedsubseczzz{#2} +\or + \numberedsubsubseczzz{#2} +\else + \ifnum \absseclevel<0 + \chapterzzz{#2} + \else + \numberedsubsubseczzz{#2} + \fi +\fi +} + +% like \numhead, but chooses appendix heading levels +\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 +\ifcase\absseclevel + \appendixzzz{#2} +\or + \appendixsectionzzz{#2} +\or + \appendixsubseczzz{#2} +\or + \appendixsubsubseczzz{#2} +\else + \ifnum \absseclevel<0 + \appendixzzz{#2} + \else + \appendixsubsubseczzz{#2} + \fi +\fi +} + +% like \numhead, but chooses numberless heading levels +\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 +\ifcase\absseclevel + \unnumberedzzz{#2} +\or + \unnumberedseczzz{#2} +\or + \unnumberedsubseczzz{#2} +\or + \unnumberedsubsubseczzz{#2} +\else + \ifnum \absseclevel<0 + \unnumberedzzz{#2} + \else + \unnumberedsubsubseczzz{#2} + \fi +\fi +} + + \def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapterzzz} +\outer\def\chapter{\parsearg\chapteryyy} +\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz #1{\seccheck{chapter}% \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}% @@ -2026,7 +2169,8 @@ \global\let\subsubsection = \numberedsubsubsec }} -\outer\def\appendix{\parsearg\appendixzzz} +\outer\def\appendix{\parsearg\appendixyyy} +\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz \def\appendixzzz #1{\seccheck{appendix}% \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}% @@ -2045,8 +2189,9 @@ \global\let\subsubsection = \appendixsubsubsec }} -\outer\def\top{\parsearg\unnumberedzzz} -\outer\def\unnumbered{\parsearg\unnumberedzzz} +\outer\def\top{\parsearg\unnumberedyyy} +\outer\def\unnumbered{\parsearg\unnumberedyyy} +\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz \def\unnumberedzzz #1{\seccheck{unnumbered}% \secno=0 \subsecno=0 \subsubsecno=0 % @@ -2074,7 +2219,8 @@ \global\let\subsubsection = \unnumberedsubsubsec }} -\outer\def\numberedsec{\parsearg\seczzz} +\outer\def\numberedsec{\parsearg\secyyy} +\def\secyyy #1{\numhead1{#1}} % normally calls seczzz \def\seczzz #1{\seccheck{section}% \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% @@ -2087,8 +2233,9 @@ \penalty 10000 % }} -\outer\def\appendixsection{\parsearg\appendixsectionzzz} -\outer\def\appendixsec{\parsearg\appendixsectionzzz} +\outer\def\appenixsection{\parsearg\appendixsecyyy} +\outer\def\appendixsec{\parsearg\appendixsecyyy} +\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz \def\appendixsectionzzz #1{\seccheck{appendixsection}% \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% @@ -2101,7 +2248,8 @@ \penalty 10000 % }} -\outer\def\unnumberedsec{\parsearg\unnumberedseczzz} +\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} +\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz \def\unnumberedseczzz #1{\seccheck{unnumberedsec}% \plainsecheading {#1}\gdef\thissection{#1}% {\chapternofonts% @@ -2112,7 +2260,8 @@ \penalty 10000 % }} -\outer\def\numberedsubsec{\parsearg\numberedsubseczzz} +\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} +\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz \def\numberedsubseczzz #1{\seccheck{subsection}% \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% @@ -2125,7 +2274,8 @@ \penalty 10000 % }} -\outer\def\appendixsubsec{\parsearg\appendixsubseczzz} +\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} +\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz \def\appendixsubseczzz #1{\seccheck{appendixsubsec}% \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% @@ -2138,7 +2288,8 @@ \penalty 10000 % }} -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz} +\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} +\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}% \plainsecheading {#1}\gdef\thissection{#1}% {\chapternofonts% @@ -2149,7 +2300,8 @@ \penalty 10000 % }} -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubseczzz} +\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} +\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz \def\numberedsubsubseczzz #1{\seccheck{subsubsection}% \gdef\thissection{#1}\global\advance \subsubsecno by 1 % \subsubsecheading {#1} @@ -2165,7 +2317,8 @@ \penalty 10000 % }} -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz} +\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} +\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}% \gdef\thissection{#1}\global\advance \subsubsecno by 1 % \subsubsecheading {#1} @@ -2180,7 +2333,8 @@ \penalty 10000 % }} -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} +\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} +\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}% \plainsecheading {#1}\gdef\thissection{#1}% {\chapternofonts% @@ -2617,11 +2771,18 @@ {\obeyspaces% \gdef\lisppar{\null\endgraf}} -% Cause \obeyspaces to make each Space cause a word-separation -% rather than the default which is that it acts punctuation. -% This is because space in tt font looks funny. +% Make each space character in the input produce a normal interword +% space in the output. Don't allow a line break at this space, as this +% is used only in environments like @example, where each line of input +% should produce a line of output anyway. +% {\obeyspaces % -\gdef\sepspaces{\def {\ }}} +\gdef\sepspaces{\obeyspaces\let =\tie}} + +% Define \obeyedspace to be our active space, whatever it is. This is +% for use in \parsearg. +{\sepspaces % +\global\let\obeyedspace= } % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt @@ -2696,29 +2857,38 @@ \endgroup }} -\def\lisp{\aboveenvbreak -\begingroup\inENV % This group ends at the end of the @lisp body -\hfuzz=12truept % Don't be fussy -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% Single space lines -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \inENV % This group ends at the end of the body + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \singlespace % single space lines + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + % @cartouche defines \nonarrowing to inhibit narrowing + % at next level down. + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \let\exdent=\nofillexdent + \let\nonarrowing=\relax + \fi +} + \def\Elisp{\endgroup\afterenvbreak}% -\parskip=0pt -% @cartouche defines \nonarrowing to inhibit narrowing -% at next level down. -\ifx\nonarrowing\relax -\advance \leftskip by \lispnarrowing -\exdentamount=\lispnarrowing -\let\exdent=\nofillexdent -\let\nonarrowing=\relax -\fi -\parindent=0pt -\obeyspaces \obeylines \tt \rawbackslash -\gobble + +\def\lisp{\begingroup + \nonfillstart + \def\Elisp{\endgroup\afterenvbreak}% + \tt + \rawbackslash % output the \ character from the current font + \gobble } % Define the \E... control sequence only if we are inside the @@ -2730,111 +2900,55 @@ \def\example{\begingroup \def\Eexample{\Elisp\endgroup}\lisp} \def\smallexample{\begingroup \def\Esmallexample{\Elisp\endgroup}\lisp} -% Macro for 9 pt. examples, necessary to print with 5" lines. -% From Pavel@xerox. This is not really used unless the +% Macro for 9 pt. examples, necessary to print with 5" lines. From +% Pavel@xerox. This is not used for @smallexamples unless the % @smallbook command is given. - -\def\smalllispx{\aboveenvbreak\begingroup\inENV -% This group ends at the end of the @lisp body -\hfuzz=12truept % Don't be fussy -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% Single space lines -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Esmalllisp{\endgroup\afterenvbreak}% -%%%% Smaller baseline skip for small examples. -\baselineskip 10pt -\parskip=0pt -% @cartouche defines \nonarrowing to inhibit narrowing -% at next level down. -\ifx\nonarrowing\relax -\advance \leftskip by \lispnarrowing -\exdentamount=\lispnarrowing -\let\exdent=\nofillexdent -\let\nonarrowing=\relax -\fi -\parindent=0pt -\obeyspaces \obeylines \ninett \indexfonts \rawbackslash -\def\next##1{}\next} +% +\def\smalllispx{\begingroup + \nonfillstart + \def\Esmalllisp{\endgroup\afterenvbreak}% + % + % Smaller interline space and fonts for small examples. + \baselineskip 10pt + \indexfonts \tt + \rawbackslash % output the \ character from the current font + \gobble +} % This is @display; same as @lisp except use roman font. - -\def\display{\begingroup\inENV %This group ends at the end of the @display body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% Single space lines -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Edisplay{\endgroup\afterenvbreak}% -\parskip=0pt -% @cartouche defines \nonarrowing to inhibit narrowing -% at next level down. -\ifx\nonarrowing\relax -\advance \leftskip by \lispnarrowing -\exdentamount=\lispnarrowing -\let\exdent=\nofillexdent -\let\nonarrowing=\relax -\fi -\parindent=0pt -\obeyspaces \obeylines -\def\next##1{}\next} - -% This is @format; same as @lisp except use roman font and don't narrow margins +% +\def\display{\begingroup + \nonfillstart + \def\Edisplay{\endgroup\afterenvbreak}% + \gobble +} -\def\format{\begingroup\inENV %This group ends at the end of the @format body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -\singlespace % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -\let\par=\lisppar -\def\Eformat{\endgroup\afterenvbreak} -\parskip=0pt \parindent=0pt -\obeyspaces \obeylines -\def\next##1{}\next} - -% @flushleft and @flushright - -\def\flushleft{% -\begingroup\inENV %This group ends at the end of the @format body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -% This also causes @ to work when the directive name -% is terminated by end of line. -\let\par=\lisppar -\def\Eflushleft{\endgroup\afterenvbreak}% -\parskip=0pt \parindent=0pt -\obeyspaces \obeylines -\def\next##1{}\next} - -\def\flushright{% -\begingroup\inENV %This group ends at the end of the @format body -\aboveenvbreak -% Make spaces be word-separators rather than space tokens. -\sepspaces % -% The following causes blank lines not to be ignored -% by adding a space to the end of each line. -% This also causes @ to work when the directive name -% is terminated by end of line. -\let\par=\lisppar -\def\Eflushright{\endgroup\afterenvbreak}% -\parskip=0pt \parindent=0pt -\advance \leftskip by 0pt plus 1fill -\obeyspaces \obeylines -\def\next##1{}\next} +% This is @format; same as @display except don't narrow margins. +% +\def\format{\begingroup + \let\nonarrowing = t + \nonfillstart + \def\Eformat{\endgroup\afterenvbreak} + \gobble +} -% @quotation - narrow the margins. +% @flushleft (same as @format) and @flushright. +% +\def\flushleft{\begingroup + \let\nonarrowing = t + \nonfillstart + \def\Eflushleft{\endgroup\afterenvbreak}% + \gobble +} +\def\flushright{\begingroup + \let\nonarrowing = t + \nonfillstart + \def\Eflushright{\endgroup\afterenvbreak}% + \advance\leftskip by 0pt plus 1fill + \gobble} +% @quotation does normal linebreaking and narrows the margins. +% \def\quotation{% \begingroup\inENV %This group ends at the end of the @quotation body {\parskip=0pt % because we will skip by \parskip too, later @@ -3509,6 +3623,7 @@ \catcode `\\=\other \openin 1 \jobname.aux \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue +\global\warnedobstrue \fi % Open the new aux file. Tex will close it automatically at exit. \openout \auxfile=\jobname.aux @@ -3531,20 +3646,50 @@ \let\ptexfootnote=\footnote {\catcode `\@=11 -\long\gdef\footnote #1{\global\advance \footnoteno by \@ne -\unskip -\edef\thisfootno{$^{\the\footnoteno}$}% -\let\@sf\empty -\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi -\thisfootno\@sf \footnotezzz{#1}} -% \parsearg\footnotezzz} - -\long\gdef\footnotezzz #1{\insert\footins{ -\interlinepenalty\interfootnotelinepenalty -\splittopskip\ht\strutbox % top baseline for broken footnotes -\splitmaxdepth\dp\strutbox \floatingpenalty\@MM -\leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip -\footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}} +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \footnotezzz +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +\long\gdef\footnotezzz#1{\insert\footins{% + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + % Hang the footnote text off the number. + \hang + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + #1\strut}% +} }%end \catcode `\@=11 @@ -3636,7 +3781,10 @@ % stretch added to depend on the line length, hence the dependence on % \hsize. This makes it come to about 9pt for the 8.5x11 format. % -\ifx\emergencystretch\thisisundefined \else +\ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% +\else \emergencystretch = \hsize \divide\emergencystretch by 45 \fi diff -ruN make-3.63/variable.c make-3.64/variable.c --- make-3.63/variable.c Wed Jan 13 16:09:20 1993 +++ make-3.64/variable.c Mon Apr 12 16:02:24 1993 @@ -355,7 +355,7 @@ /* This won't override any definition, but it will provide one if there isn't one there. */ v = define_variable ("SHELL", 5, default_shell, o_default, 0); - v->export = v_export; + v->export = v_export; /* Always export SHELL. */ /* Don't let SHELL come from the environment. */ if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override) @@ -362,12 +362,28 @@ { free (v->value); v->origin = o_file; - v->value = savestring (default_shell, 7); + v->value = savestring (default_shell, strlen (default_shell)); } /* Make sure MAKEFILES gets exported if it is set. */ v = define_variable ("MAKEFILES", 9, "", o_default, 0); v->export = v_ifset; + + /* Define the magic D and F variables in terms of + the automatic variables they are variations of. */ + + define_variable ("@D", 2, "$(dir $@)", o_automatic, 1); + define_variable ("%D", 2, "$(dir $%)", o_automatic, 1); + define_variable ("*D", 2, "$(dir $*)", o_automatic, 1); + define_variable ("export) { case v_default: + if (v->origin == o_default || v->origin == o_automatic) + /* Only export default variables by explicit request. */ + continue; + if (!export_all_variables && v->origin != o_command && v->origin != o_env && v->origin != o_env_override @@ -490,11 +510,18 @@ for (b = table[i]; b != 0; b = b->next) { register struct variable *v = b->variable; - /* If V is recursively expanded, expand its value. */ - char *value = v->recursive ? recursively_expand (v) : v->value; - result[nvariables++] = concat (v->name, "=", value); - if (v->recursive) - free (value); + /* If V is recursively expanded and didn't come from the environment, + expand its value. If it came from the environment, it should + go back into the environment unchanged. */ + if (v->recursive + && v->origin != o_env && v->origin != o_env_override) + { + char *value = recursively_expand (v); + result[nvariables++] = concat (v->name, "=", value); + free (value); + } + else + result[nvariables++] = concat (v->name, "=", v->value); } } result[nvariables] = (char *) xmalloc (100); @@ -521,7 +548,9 @@ If not, NULL is returned. */ struct variable * -try_variable_definition (line, origin) +try_variable_definition (filename, lineno, line, origin) + char *filename; + unsigned int lineno; char *line; enum variable_origin origin; { @@ -529,8 +558,8 @@ register char *p = line; register char *beg; register char *end; - register int recursive; - char *name, *expanded_name; + enum { bogus, simple, recursive, append } flavor = bogus; + char *name, *expanded_name, *value; struct variable *v; while (1) @@ -540,36 +569,102 @@ return 0; if (c == '=') { - recursive = 1; + end = p - 1; + flavor = recursive; break; } else if (c == ':') if (*p == '=') { - ++p; - recursive = 0; + end = p++ - 1; + flavor = simple; break; } else + /* A colon other than := is a rule line, not a variable defn. */ return 0; + else if (c == '+' && *p == '=') + { + end = p++ - 1; + flavor = append; + break; + } } - beg = next_token (line); - end = p - 1; - if (!recursive) - --end; while (isblank (end[-1])) --end; + beg = next_token (line); p = next_token (p); /* Expand the name, so "$(foo)bar = baz" works. */ - name = savestring (beg, end - beg); + name = (char *) alloca (end - beg + 1); + bcopy (beg, name, end - beg); + name[end - beg] = '\0'; expanded_name = allocated_variable_expand (name); - free (name); + + if (expanded_name[0] == '\0') + { + if (filename == 0) + fatal ("empty variable name"); + else + makefile_fatal (filename, lineno, "empty variable name"); + } + + /* Calculate the variable's new value in VALUE. */ + + switch (flavor) + { + case bogus: + /* Should not be possible. */ + abort (); + break; + case simple: + /* A simple variable definition "var := value". Expand the value. */ + value = variable_expand (p); + break; + case recursive: + /* A recursive variable definition "var = value". + The value is used verbatim. */ + value = p; + break; + case append: + /* An appending variable definition "var += value". + Extract the old value and append the new one. */ + v = lookup_variable (expanded_name, strlen (expanded_name)); + if (v == 0) + { + /* There was no old value. + This becomes a normal recursive definition. */ + value = p; + flavor = recursive; + } + else + { + /* Paste the old and new values together in VALUE. */ + + unsigned int oldlen, newlen; + + if (v->recursive) + /* The previous definition of the variable was recursive. + The new value comes from the unexpanded old and new values. */ + flavor = recursive; + else + /* The previous definition of the variable was simple. + The new value comes from the old value, which was expanded + when it was set; and from the expanded new value. */ + p = variable_expand (p); + + oldlen = strlen (v->value); + newlen = strlen (p); + value = (char *) alloca (oldlen + 1 + newlen + 1); + bcopy (v->value, value, oldlen); + value[oldlen] = ' '; + bcopy (p, &value[oldlen + 1], newlen + 1); + } + } v = define_variable (expanded_name, strlen (expanded_name), - recursive ? p : variable_expand (p), - origin, recursive); + value, origin, flavor == recursive); free (expanded_name); @@ -682,7 +777,7 @@ #ifndef NO_FLOAT printf ("# average of %.1f variables per bucket, \ max %u in one bucket.\n", - ((double) nvariables) * 100.0 / (double) set->buckets, + (double) nvariables / (double) set->buckets, per_bucket); #endif } diff -ruN make-3.63/version.c make-3.64/version.c --- make-3.63/version.c Fri Jan 22 19:08:41 1993 +++ make-3.64/version.c Wed Apr 21 15:17:53 1993 @@ -1,4 +1,4 @@ -char *version_string = "3.63"; +char *version_string = "3.64"; /* Local variables: diff -ruN make-3.63/vpath.c make-3.64/vpath.c --- make-3.63/vpath.c Mon Jan 11 17:46:31 1993 +++ make-3.64/vpath.c Wed Mar 24 15:13:56 1993 @@ -191,24 +191,24 @@ if (len > 1 && p[-1] == '/') --len; - if (len == 1 && *v == '.') - continue; - - v = savestring (v, len); + if (len > 1 || *v != '.') + { + v = savestring (v, len); - /* Verify that the directory actually exists. */ + /* Verify that the directory actually exists. */ - if (dir_file_exists_p (v, "")) - { - /* It does. Put it in the list. */ - vpath[elem++] = dir_name (v); - free (v); - if (len > maxvpath) - maxvpath = len; + if (dir_file_exists_p (v, "")) + { + /* It does. Put it in the list. */ + vpath[elem++] = dir_name (v); + free (v); + if (len > maxvpath) + maxvpath = len; + } + else + /* The directory does not exist. Omit from the list. */ + free (v); } - else - /* The directory does not exist. Omit from the list. */ - free (v); /* Skip over colons and blanks between entries. */ while (*p == ':' || isblank (*p)) @@ -246,13 +246,15 @@ } /* Search the VPATH list whose pattern matches *FILE for a directory - where the name pointed to by FILE exists. If it is found, the pointer - in FILE is set to the newly malloc'd name of the existing file and - we return 1. Otherwise we return 0. */ + where the name pointed to by FILE exists. If it is found, we set *FILE to + the newly malloc'd name of the existing file, *MTIME_PTR (if MTIME_PTR is + not NULL) to its modtime (or zero if no stat call was done), and return 1. + Otherwise we return 0. */ int -vpath_search (file) +vpath_search (file, mtime_ptr) char **file; + time_t *mtime_ptr; { register struct vpath *v; @@ -264,11 +266,11 @@ for (v = vpaths; v != 0; v = v->next) if (pattern_matches (v->pattern, v->percent, *file)) - if (selective_vpath_search (v, file)) + if (selective_vpath_search (v, file, mtime_ptr)) return 1; if (general_vpath != 0 - && selective_vpath_search (general_vpath, file)) + && selective_vpath_search (general_vpath, file, mtime_ptr)) return 1; return 0; @@ -276,14 +278,16 @@ /* Search the given VPATH list for a directory where the name pointed - to by FILE exists. If it is found, the pointer in FILE - is set to the newly malloc'd name of the existing file and we return 1. + to by FILE exists. If it is found, we set *FILE to the newly malloc'd + name of the existing file, *MTIME_PTR (if MTIME_PTR is not NULL) to + its modtime (or zero if no stat call was done), and we return 1. Otherwise we return 0. */ static int -selective_vpath_search (path, file) +selective_vpath_search (path, file, mtime_ptr) struct vpath *path; char **file; + time_t *mtime_ptr; { int not_target; char *name, *n; @@ -323,6 +327,8 @@ /* Try each VPATH entry. */ for (i = 0; vpath[i] != 0; ++i) { + int exists_in_cache = 0; + n = name; /* Put the next VPATH entry into NAME at N and increment N past it. */ @@ -340,8 +346,12 @@ /* Now add the name-within-directory at the end of NAME. */ if (n != name && n[-1] != '/') - *n = '/'; - bcopy (filename, n + 1, flen + 1); + { + *n = '/'; + bcopy (filename, n + 1, flen + 1); + } + else + bcopy (filename, n, flen + 1); if (not_target) /* Since *FILE is not a target, if the file is @@ -360,20 +370,38 @@ /* We know the directory is in the hash table now because either construct_vpath_list or the code just above put it there. Does the file we seek exist in it? */ - exists = dir_file_exists_p (name, filename); + exists_in_cache = exists = dir_file_exists_p (name, filename); } if (exists) { - /* We have found a file. - Store the name we found into *FILE for the caller. */ + /* The file is in the directory cache. + Now check that it actually exists in the filesystem. + The cache may be out of date. When vpath thinks a file + exists, but stat fails for it, confusion results in the + higher levels. */ + + struct stat st; /* Put the slash back in NAME. */ *n = '/'; - *file = savestring (name, (n + 1 - name) + flen); + if (!exists_in_cache /* Makefile-mentioned file need not exist. */ + || stat (name, &st) == 0) /* Does it really exist? */ + { + /* We have found a file. + Store the name we found into *FILE for the caller. */ + + *file = savestring (name, (n + 1 - name) + flen); + + if (mtime_ptr != 0) + /* Store the modtime into *MTIME_PTR for the caller. + If we have had no need to stat the file here, + we record a zero modtime to indicate this. */ + *mtime_ptr = exists_in_cache ? st.st_mtime : (time_t) 0; - return 1; + return 1; + } } }