This file contains diffs from version 3.67 of GNU Make to version 3.68. Changes in files that are generated by etags and TeX have been omitted. diff -ruN make-3.67/ChangeLog make-3.68/ChangeLog --- make-3.67/ChangeLog Sat May 22 21:00:00 1993 +++ make-3.68/ChangeLog Wed Jul 28 17:41:31 1993 @@ -1,3 +1,217 @@ +Wed Jul 28 17:41:12 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.68. + +Mon Jul 26 14:36:49 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.8. + +Sun Jul 25 22:09:08 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.7. + + * compatMakefile ($(infodir)/make.info): Don't use $(instname). + Run install-info script if present. + +Fri Jul 23 16:03:50 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * make.h [STAT_MACROS_BROKEN]: Test this instead of [uts]. + + * configure.in: Add AC_STAT_MACROS_BROKEN. + +Wed Jul 14 18:48:11 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.6. + + * read.c (read_makefile): Recognize directive `-include', like + `include' but sets RM_DONTCARE flag. + + * variable.c (target_environment): If FILE is nil, use + current_variable_set_list in place of FILE->variables. + * function.c (expand_function: `shell'): Get an environment for + the child from target_environment instead of using environ. + + * dep.h: Declare read_all_makefiles here. + (RM_*): Define new enum constants. + * read.c (read_makefile): Second arg is FLAGS instead of TYPE. + Treat it as a bit mask containing RM_*. + (read_all_makefiles): For default makefiles, set D->changed to + RM_DONTCARE instead of 1. + * main.c: Don't declare read_all_makefiles here. + (main): Check `changed' member of read_makefiles elts for RM_* + flags instead of specific integer values. + +Mon Jul 12 22:42:17 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * make.h [sequent && i386]: #undef POSIX. From trost@cse.ogi.edu. + +Thu Jul 8 19:51:23 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * vpath.c (construct_vpath_list): If ELEM is zero 0, free PATTERN + as well as VPATH. + (build_vpath_lists): Empty `vpaths' around construct_vpath_list + call for $(VPATH). Expand $(strip $(VPATH)), not just $(VPATH). + + * rule.c (convert_suffix_rule): Use alloca instead of xmalloc for + PERCENTS, whose storage is not consumed by create_pattern_rule. + + * make.h [__mips && _SYSTYPE_SVR3]: #undef POSIX. + +Wed Jun 30 18:11:40 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.5. + + * rule.c (max_pattern_targets): New variable. + (count_implicit_rule_limits): Compute its value. + * rule.h: Declare it. + * implicit.c (pattern_search): Make TRYRULES max_target_patterns + times bigger. Move adding new TRYRULES elt inside the inner + targets loop, so each matching target gets its own elt in MATCHES + and CHECKED_LASTSLASH. + + * file.c (remove_intermediates): If SIG!=0 say `intermediate file' + instead of just `file' in error msg. + +Fri Jun 25 14:55:15 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * job.c (construct_command_argv): Turn off + --warn-undefined-variables around expansion of SHELL and IFS. + * read.c (tilde_expand): Likewise for HOME. + (read_all_makefiles): Likewise for MAKEFILES. + * vpath.c (build_vpath_lists): Likewise for VPATH. + + * main.c (warn_undefined_variables_flag): New flag variable. + (switches): Add --warn-undefined-variables. + * make.h (warn_undefined_variables_flag): Declare it. + * expand.c (warn_undefined): New function. + (reference_variable): Call it if the variable is undefined. + (variable_expand): In substitution ref, call warn_undefined if the + variable is undefined. + + * default.c (default_pattern_rules): Add `%.c: %.w %.ch' and + `%.tex: %.w %.ch' rules. + (default_suffix_rules: .w.c, .w.tex): Pass three args: $< - $@. + (default_suffixes): Add `.ch'. + +Mon Jun 21 17:55:39 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * default.c (default_suffixes): Replace `.cweb' with `.w'. + (default_suffix_rules): Rename `.cweb.c' and `.cweb.tex' to `.w.c' + and `.w.tex'. + +Fri Jun 11 14:42:09 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * compatMakefile ($(bindir)/$(instname)): Add missing backslash. + +Thu Jun 10 18:14:08 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.4. + + * read.c (multi_glob): Don't free OLD and OLD->name in the + FOUND!=0 fork. Use new block-local variable F instead of + clobbering OLD. + + * ar.c (glob_pattern_p): New function, snarfed from glob/glob.c. + (ar_glob): Call it; return nil immediately if MEMBER_PATTERN + contains no metacharacters. + +Wed Jun 9 16:25:35 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * ar.c (ar_glob{_match,_alphacompare}): New function. + + * dep.h [! NO_ARCHIVES]: Declare it. + * read.c (multi_glob) [! NO_ARCHIVES]: Use it on archive member elts. + + * read.c (read_makefile): Pass flag (1) to parse_file_seq, not to + multi_glob (which doesn't take a 3rd arg). + * rule.c (install_pattern_rule): Likewise. + * default.c (set_default_suffixes): Here too. + * function.c (string_glob): Don't pass gratuitous arg to multi_glob. + + * read.c (parse_file_seq) [! NO_ARCHIVES]: Add post-processing + loop to translate archive refs "lib(a b)" into "lib(a) lib(b)". + +Mon Jun 7 19:26:51 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * compatMakefile (installdirs): Actually pass directory names. + ($(bindir)/$(instname)): Test chgrp&&chmod exit status with `if'; + if it fails, echo a warning msg, but don't make the rule fail. + + * read.c (tilde_expand): New function, broken out of tilde_expand. + (multi_glob): Call it. + (construct_include_path): Expand ~ in directory names. + * dep.h: Declare tilde_expand. + * main.c (enter_command_line_file): Expand ~ at the start of NAME. + (main): Expand ~ in -C args. + * read.c (read_makefile): Expand ~ in FILENAME unless TYPE==2. + +Fri Jun 4 13:34:47 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * main.c (decode_env_switches): Use xmalloc instead of alloca for ARGS. + + * main.c (main): Put result of alloca in temporary variable with + simple assignment, to make SGI compiler happy. + +Thu Jun 3 20:15:46 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.3. + + * main.c (main): Before re-execing, remove intermediate files, and + print the data base under -p. Sexier debugging message. + + * implicit.c (pattern_search): Allocate an extra copy of the name + of a winning intermediate file when putting it in FOUND_FILES. + +Wed Jun 2 16:38:08 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * read.c (read_makefile): Pass flag (1) to parse_file_seq, not to + multi_glob (which doesn't take a 3rd arg). + + * dir.c (dir_contents_file_exists_p): When reading dirents, ignore + chars within D_NAMLEN that are NULs. + + * main.c (decode_switches): Don't savestring ARGV[0] to put it + into `other_args'. + For string switch, don't savestring `optarg'. + (main): Don't free elts of makefiles->list that are "-". + Use alloca'd rather than savestring'd storage for elts of + makefiles->list that are temporary file names. + * read.c (read_all_makefiles): Don't free *MAKEFILES. + * file.c (enter_file): Don't strip `./'s. + * main.c (enter_command_line_file): New function. + (main): Use it in place of enter_file for command-line goals from + other_files, and for old_files and new_files. + +Mon May 31 18:41:40 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.2. + + * compatMakefile (.SUFFIXES): Add .info. + ($(infodir)/$(instname).info): Find make.info* in cwd if there, + else in $srcdir. Use basename to remove dir name from installed name. + +Thu May 27 17:35:02 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * implicit.c (pattern_search): When interning FOUND_FILES, try + lookup_file first; if found, free the storage for our copy of the name. + +Wed May 26 14:31:20 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Version 3.67.1. + + * main.c (decode_switches): In usage msg, write `--switch=ARG' or + `--switch[=OPTARG]' rather than `--switch ARG' or `--switch [ARG]'. + +Mon May 24 16:17:31 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * rule.c (convert_suffix_rule): New function. + (convert_to_pattern): Use it instead of doing all the work here + several times. + For target suffix `.a', generate both the archive magic rule and + the normal rule. + + * compatMakefile (distclean): Remove stamp-config. + Sat May 22 16:15:18 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) * Version 3.67. @@ -6914,7 +7128,3 @@ * Took Make out of RCS. * Split the monolithic `make.c' into several smaller files. - -Local Variables: -eval: (if (fboundp 'change-log-mode) (change-log-mode) (indented-text-mode) (setq left-margin 8)) -End: diff -ruN make-3.67/Makefile.in make-3.68/Makefile.in --- make-3.67/Makefile.in Sat May 22 21:02:06 1993 +++ make-3.68/Makefile.in Wed Jul 28 17:45:01 1993 @@ -39,6 +39,7 @@ # without complaint but produce losing code, # so beware. # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline. +# See also `config.h'. defines = @DEFS@ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" # Which flavor of remote job execution support to use. @@ -134,7 +135,7 @@ .SUFFIXES: -.SUFFIXES: .o .c .h .ps .dvi .texinfo +.SUFFIXES: .o .c .h .ps .dvi .info .texinfo .PHONY: all check info dvi all: make @@ -178,28 +179,41 @@ .PHONY: install installdirs install: installdirs \ - $(bindir)/$(instname) $(infodir)/$(instname).info \ + $(bindir)/$(instname) $(infodir)/make.info \ $(mandir)/$(instname).$(manext) installdirs: - $(SHELL) ${srcdir}/mkinstalldirs + $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(mandir) $(bindir)/$(instname): make $(INSTALL_PROGRAM) make $@.new -# These are necessary for load-average checking to work on most Unix machines. - if $(install_setgid); then \ - chgrp $(group) $@.new && chmod g+s $@.new; \ - else true; fi + @if $(install_setgid); then \ + if chgrp $(group) $@.new && chmod g+s $@.new; then \ + echo "chgrp $(group) $@.new && chmod g+s $@.new"; \ + else \ + echo "$@ needs to be owned by group $(group) and setgid;"; \ + echo "otherwise the \`-l' option will probably not work."; \ + echo "You may need special priveleges to install $@."; \ + fi; \ + 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 \ +$(infodir)/make.info: make.info + if [ -r ./make.info ]; then dir=.; else dir=$(srcdir); fi; \ + for file in $${dir}/make.info*; do \ + name="`basename $$file`"; \ $(INSTALL_DATA) $$file \ - `echo $@ | sed "s,$(instname).info\$$,$$file,"`; \ + `echo $@ | sed "s,make.info\$$,$$name,"`; \ done +# Run install-info only if it exists. +# Use `if' instead of just prepending `-' to the +# line so we notice real errors from install-info. + if install-info --version >/dev/null 2>&1; then \ + install-info --infodir=$(infodir) $$d/foo.info; \ + else true; fi $(mandir)/$(instname).$(manext): make.man $(INSTALL_DATA) $(srcdir)/make.man $@ @@ -208,7 +222,7 @@ clean: glob-clean -rm -f make *.o core distclean: clean glob-realclean - -rm -f Makefile config.h config.status build.sh + -rm -f Makefile config.h config.status build.sh stamp-config -rm -f TAGS tags make.info* make.dvi -rm -f make.?? make.??s make.log make.toc make.*aux realclean: distclean @@ -253,7 +267,7 @@ function.o : function.c make.h config.h variable.h dep.h commands.h job.h vpath.o : vpath.c make.h config.h file.h variable.h version.o : version.c -ar.o : ar.c make.h config.h file.h +ar.o : ar.c make.h config.h file.h dep.h arscan.o : arscan.c make.h config.h signame.o : signame.c config.h signame.h remote-stub.o : remote-stub.c make.h config.h commands.h diff -ruN make-3.67/NEWS make-3.68/NEWS --- make-3.67/NEWS Fri May 14 17:50:04 1993 +++ make-3.68/NEWS Wed Jul 14 22:33:13 1993 @@ -1,9 +1,35 @@ -GNU make NEWS -- history of user-visible changes. 12 April 1993 +GNU make NEWS -- history of user-visible changes. 14 July 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.68 + +* You can list several archive member names inside parenthesis: + `lib(mem1 mem2 mem3)' is equivalent to `lib(mem1) lib(mem2) lib(mem3)'. + +* You can use wildcards inside archive member references. For example, + `lib(*.o)' expands to all existing members of `lib' whose names end in + `.o' (e.g. `lib(a.o) lib(b.o)'); `*.a(*.o)' expands to all such members + of all existing files whose names end in `.a' (e.g. `foo.a(a.o) + foo.a(b.o) bar.a(c.o) bar.a(d.o)'. + +* A suffix rule `.X.a' now produces two pattern rules: + (%.o): %.X # Previous versions produced only this. + %.a: %.X # Now produces this as well, just like other suffixes. + +* The new flag `--warn-undefined-variables' says to issue a warning message + whenever Make expands a reference to an undefined variable. + +* The new `-include' directive is just like `include' except that there is + no error (not even a warning) for a nonexistent makefile. + +* Commands in an invocation of the `shell' function are now run with a + modified environment like target commands are, so you can use `export' et + al to set up variables for them. They used to run with the environment + that `make' started with. Version 3.66 diff -ruN make-3.67/README make-3.68/README --- make-3.67/README Sat May 22 21:01:24 1993 +++ make-3.68/README Wed Jul 28 17:44:30 1993 @@ -1,4 +1,4 @@ -This directory contains the 3.67 test release of GNU Make. +This directory contains the 3.68 test release of GNU Make. All bugs reported for previous test releases have been fixed. Some bugs surely remain. diff -ruN make-3.67/alloca.c make-3.68/alloca.c --- make-3.67/alloca.c Fri May 21 19:39:17 1993 +++ make-3.68/alloca.c Tue Jul 13 12:37:01 1993 @@ -45,7 +45,7 @@ /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ -#ifdef CRAY +#if defined (CRAY) && defined (CRAY_STACKSEG_END) long i00afunc (); #define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) #else @@ -60,6 +60,21 @@ #define NULL 0 +/* Different portions of Emacs need to call different versions of + malloc. The Emacs executable needs alloca to call xmalloc, because + ordinary malloc isn't protected from input signals. On the other + hand, the utilities in lib-src need alloca to call malloc; some of + them are very simple, and don't have an xmalloc routine. + + Non-Emacs programs expect this to call use xmalloc. + + Callers below should use malloc. */ + +#ifndef emacs +#define malloc xmalloc +extern pointer xmalloc (); +#endif + /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. @@ -189,7 +204,7 @@ } } -#ifdef CRAY +#if defined (CRAY) && defined (CRAY_STACKSEG_END) #ifdef DEBUG_I00AFUNC #include diff -ruN make-3.67/ar.c make-3.68/ar.c --- make-3.67/ar.c Thu Apr 29 19:57:58 1993 +++ make-3.68/ar.c Thu Jun 10 18:13:54 1993 @@ -17,10 +17,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "make.h" -#include "file.h" #ifndef NO_ARCHIVES +#include "file.h" +#include "dep.h" +#include + /* Defined in arscan.c. */ extern long int ar_scan (); extern int ar_member_touch (); @@ -174,5 +177,136 @@ return val; } + +/* State of an `ar_glob' run, passed to `ar_glob_match'. */ + +struct ar_glob_state + { + char *arname; + char *pattern; + unsigned int size; + struct nameseq *chain; + unsigned int n; + }; + +/* This function is called by `ar_scan' to match one archive + element against the pattern in STATE. */ + +static long int +ar_glob_match (desc, mem, truncated, + hdrpos, datapos, size, date, uid, gid, mode, + state) + int desc; + char *mem; + int truncated; + long int hdrpos, datapos, size, date; + int uid, gid, mode; + struct ar_glob_state *state; +{ + if (fnmatch (state->pattern, mem, FNM_PATHNAME|FNM_PERIOD) == 0) + { + /* We have a match. Add it to the chain. */ + struct nameseq *new = (struct nameseq *) xmalloc (state->size); + new->name = concat (state->arname, mem, ")"); + new->next = state->chain; + state->chain = new; + ++state->n; + } + + return 0L; +} + +/* Alphabetic sorting function for `qsort'. */ + +static int +ar_glob_alphacompare (a, b) + char **a, **b; +{ + return strcmp (*a, *b); +} + +/* Return nonzero if PATTERN contains any metacharacters. + Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ +static int +glob_pattern_p (pattern, quote) + const char *pattern; + const int quote; +{ + register const char *p; + int open = 0; + + for (p = pattern; *p != '\0'; ++p) + switch (*p) + { + case '?': + case '*': + return 1; + + case '\\': + if (quote) + ++p; + break; + + case '[': + open = 1; + break; + + case ']': + if (open) + return 1; + break; + } + + return 0; +} + +/* Glob for MEMBER_PATTERN in archive ARNAME. + Return a malloc'd chain of matching elements (or nil if none). */ + +struct nameseq * +ar_glob (arname, member_pattern, size) + char *arname, *member_pattern; + unsigned int size; +{ + struct ar_glob_state state; + char **names; + struct nameseq *n; + unsigned int i; + + if (! glob_pattern_p (member_pattern, 1)) + return 0; + + /* Scan the archive for matches. + ar_glob_match will accumulate them in STATE.chain. */ + i = strlen (arname); + state.arname = (char *) alloca (i + 2); + bcopy (arname, state.arname, i); + state.arname[i] = '('; + state.arname[i + 1] = '\0'; + state.pattern = member_pattern; + state.size = size; + state.chain = 0; + state.n = 0; + (void) ar_scan (arname, ar_glob_match, (long int) &state); + + if (state.chain == 0) + return 0; + + /* Now put the names into a vector for sorting. */ + names = (char **) alloca (state.n * sizeof (char *)); + i = 0; + for (n = state.chain; n != 0; n = n->next) + names[i++] = n->name; + + /* Sort them alphabetically. */ + qsort ((char *) names, i, sizeof (*names), ar_glob_alphacompare); + + /* Put them back into the chain in the sorted order. */ + i = 0; + for (n = state.chain; n != 0; n = n->next) + n->name = names[i++]; + + return state.chain; +} -#endif +#endif /* Not NO_ARCHIVES. */ diff -ruN make-3.67/config.h.in make-3.68/config.h.in --- make-3.67/config.h.in Sat May 22 21:02:24 1993 +++ make-3.68/config.h.in Wed Jul 28 17:45:26 1993 @@ -1,8 +1,35 @@ -/* Generated automatically from configure.in by autoheader. DO NOT EDIT! */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* 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 to empty if the keyword does not work. */ +#undef const + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define for DGUX with . */ +#undef DGUX + /* Define if you have dirent.h. */ #undef DIRENT +/* Define to the type of elements in the array set by `getgroups'. + Usually this is either `int' or `gid_t'. */ +#undef GETGROUPS_T + +/* Define if the `getloadavg' function needs to be run setuid or setgid. */ +#undef GETLOADAVG_PRIVILEGED + +/* Define to `int' if doesn't define. */ +#undef gid_t + /* Define if you have alloca.h and it should be used (not Ultrix). */ #undef HAVE_ALLOCA_H @@ -9,6 +36,9 @@ /* Define if you have the strcoll function and it is properly defined. */ #undef HAVE_STRCOLL +/* Define if `union wait' is the type of the first arg to wait functions. */ +#undef HAVE_UNION_WAIT + /* Define if you have unistd.h. */ #undef HAVE_UNISTD_H @@ -15,8 +45,11 @@ /* Define if you have vfork.h. */ #undef HAVE_VFORK_H -/* Define vfork as fork if vfork does not work. */ -#undef vfork +/* Define if on MINIX. */ +#undef _MINIX + +/* Define if you don't have dirent.h, but have ndir.h. */ +#undef NDIR /* Define if your struct nlist has an n_un member. */ #undef NLIST_NAME_UNION @@ -27,6 +60,16 @@ /* Define if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define if the system does not provide POSIX.1 features except + with this defined. */ +#undef _POSIX_1_SOURCE + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE @@ -35,6 +78,18 @@ before release 3. */ #undef SETVBUF_REVERSED +/* 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 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -44,30 +99,11 @@ /* Define if you don't have dirent.h, but have sys/ndir.h. */ #undef SYSNDIR -/* Define if you do not have strings.h, index, bzero, etc.. */ -#undef USG - -/* Define if the closedir function returns void instead of int. */ -#undef VOID_CLOSEDIR - -/* 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 - -/* Define if on MINIX. */ -#undef _POSIX_1_SOURCE - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE +/* Define if `sys_siglist' is declared by . */ +#undef SYS_SIGLIST_DECLARED -/* Define on System V Release 4. */ -#undef SVR4 +/* Define to `int' if doesn't define. */ +#undef uid_t /* Define for Encore UMAX. */ #undef UMAX @@ -76,75 +112,18 @@ instead of . */ #undef UMAX4_3 -/* Define to `int' if doesn't define. */ -#undef uid_t -#undef gid_t -#undef pid_t - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define for DGUX with . */ -#undef DGUX - -/* Define if the `getloadavg' function needs to be run setuid or setgid. */ -#undef GETLOADAVG_PRIVILEGED - -/* 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 +/* Define if you do not have strings.h, index, bzero, etc.. */ +#undef USG -/* 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 vfork as fork if vfork does not work. */ +#undef vfork -/* Define to the type of elements in the array set by `getgroups'. - Usually this is either `int' or `gid_t'. */ -#undef GETGROUPS_T +/* Define if the closedir function returns void instead of int. */ +#undef VOID_CLOSEDIR /* Define to the name of the SCCS `get' command. */ #undef SCCS_GET -/* Define if you have getdtablesize. */ -#undef HAVE_GETDTABLESIZE - -/* Define if you have sys_siglist. */ -#undef HAVE_SYS_SIGLIST - -/* 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 - -/* Define if you have getcwd. */ -#undef HAVE_GETCWD - -/* Define if you have sigsetmask. */ -#undef HAVE_SIGSETMASK - -/* Define if you have getgroups. */ -#undef HAVE_GETGROUPS - -/* Define if you have setlinebuf. */ -#undef HAVE_SETLINEBUF - -/* Define if you have setreuid. */ -#undef HAVE_SETREUID - -/* Define if you have setregid. */ -#undef HAVE_SETREGID - /* Define if you have waitpid. */ #undef HAVE_WAITPID @@ -171,3 +150,18 @@ /* Define if you have the header file. */ #undef HAVE_SYS_WAIT_H + +/* Define if you have the util library (-lutil). */ +#undef HAVE_UTIL + +/* Define if you have the getloadavg library (-lgetloadavg). */ +#undef HAVE_GETLOADAVG + +/* Define if you have the dgc library (-ldgc). */ +#undef HAVE_DGC + +/* Define if you have the elf library (-lelf). */ +#undef HAVE_ELF + +/* Define if you have the seq library (-lseq). */ +#undef HAVE_SEQ diff -ruN make-3.67/configure make-3.68/configure --- make-3.67/configure Sat May 22 21:01:41 1993 +++ make-3.68/configure Wed Jul 28 17:44:52 1993 @@ -78,12 +78,13 @@ fi done -trap 'rm -f conftest* core; exit 1' 1 3 15 +trap 'rm -fr conftest* core; exit 1' 1 3 15 -# Needed for some versions of `tr' so that character classes in `[]' work. -if test "${LANG+set}" = "set" ; then - LANG=C -fi +# NLS nuisances. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi rm -f conftest* compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' @@ -118,6 +119,9 @@ .|/*|~*) ;; *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. esac + +# Save the original args to write them into config.status later. +configure_args="$*" # We want these before the checks, so the checks can modify their values. @@ -212,9 +216,13 @@ echo checking how to run the C preprocessor if test -z "$CPP"; then - CPP='${CC-cc} -E' + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and ``${CC-cc}'' will simply confuse + # make. It must be expanded now. + CPP="${CC-cc} -E" cat > conftest.c < +Syntax Error EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then @@ -224,6 +232,7 @@ fi rm -f conftest* fi +test ".${verbose}" != "." && echo " setting CPP to $CPP" echo checking for AIX cat > conftest.c < conftest.out 2>&1" if egrep "yes" conftest.out >/dev/null 2>&1; then - { + +{ test -n "$verbose" && \ -echo ' defining' _ALL_SOURCE +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} @@ -252,9 +262,10 @@ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then ISC=1 # If later tests want to check for ISC. - { + +{ test -n "$verbose" && \ -echo ' defining' _POSIX_SOURCE +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} @@ -281,9 +292,10 @@ # The Minix shell can't assign to the same variable on the same line! if test -n "$MINIX"; then - { + +{ test -n "$verbose" && \ -echo ' defining' _POSIX_SOURCE +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} @@ -291,9 +303,10 @@ " } - { + +{ test -n "$verbose" && \ -echo ' defining' _POSIX_1_SOURCE to be '2' +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} @@ -301,9 +314,10 @@ " } - { + +{ test -n "$verbose" && \ -echo ' defining' _MINIX +echo " defining _MINIX" DEFS="$DEFS -D_MINIX=1" SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD} \${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD} @@ -339,9 +353,10 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - { + +{ test -n "$verbose" && \ -echo ' defining' STDC_HEADERS +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} @@ -363,9 +378,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' HAVE_UNISTD_H +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} @@ -387,9 +403,10 @@ int t() { DIR *dirp = opendir ("/"); } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' DIRENT +echo " defining DIRENT" DEFS="$DEFS -DDIRENT=1" SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD} \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD} @@ -409,9 +426,10 @@ int t() { DIR *dirp = opendir ("/"); } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' SYSNDIR +echo " defining SYSNDIR" DEFS="$DEFS -DSYSNDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD} \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD} @@ -431,9 +449,10 @@ int t() { DIR *dirp = opendir ("/"); } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' SYSDIR +echo " defining SYSDIR" DEFS="$DEFS -DSYSDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD} \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD} @@ -453,9 +472,10 @@ int t() { DIR *dirp = opendir ("/"); } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' NDIR +echo " defining NDIR" DEFS="$DEFS -DNDIR=1" SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD} \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD} @@ -477,9 +497,10 @@ if test -s conftest && (./conftest; exit) 2>/dev/null; then : else - { + +{ test -n "$verbose" && \ -echo ' defining' VOID_CLOSEDIR +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} @@ -496,9 +517,10 @@ if egrep "uid_t" conftest.out >/dev/null 2>&1; then : else - { + +{ test -n "$verbose" && \ -echo ' defining' uid_t to be 'int' +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} @@ -505,9 +527,10 @@ \${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD} " } - { + +{ test -n "$verbose" && \ -echo ' defining' gid_t to be 'int' +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} @@ -543,9 +566,10 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - { + +{ test -n "$verbose" && \ -echo ' defining' GETGROUPS_T to be 'gid_t' +echo " defining GETGROUPS_T to be gid_t" DEFS="$DEFS -DGETGROUPS_T=gid_t" SEDDEFS="${SEDDEFS}\${SEDdA}GETGROUPS_T\${SEDdB}GETGROUPS_T\${SEDdC}gid_t\${SEDdD} \${SEDuA}GETGROUPS_T\${SEDuB}GETGROUPS_T\${SEDuC}gid_t\${SEDuD} @@ -554,9 +578,10 @@ } else - { + +{ test -n "$verbose" && \ -echo ' defining' GETGROUPS_T to be 'int' +echo " defining GETGROUPS_T to be int" DEFS="$DEFS -DGETGROUPS_T=int" SEDDEFS="${SEDDEFS}\${SEDdA}GETGROUPS_T\${SEDdB}GETGROUPS_T\${SEDdC}int\${SEDdD} \${SEDuA}GETGROUPS_T\${SEDuB}GETGROUPS_T\${SEDuC}int\${SEDuD} @@ -573,9 +598,10 @@ if egrep "pid_t" conftest.out >/dev/null 2>&1; then : else - { + +{ test -n "$verbose" && \ -echo ' defining' pid_t to be 'int' +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} @@ -598,9 +624,10 @@ int t() { int i; } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' RETSIGTYPE to be 'void' +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} @@ -609,9 +636,10 @@ } else - { + +{ test -n "$verbose" && \ -echo ' defining' RETSIGTYPE to be 'int' +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} @@ -632,9 +660,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' ${trhdr} +echo " defining ${trhdr}" DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} @@ -651,16 +680,35 @@ # 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 +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 then - : + # Test first that cc exists at all. + if cc -c conftest.c >/dev/null 2>&1 + then + if 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 + +{ +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 + fi else - { + +{ test -n "$verbose" && \ -echo ' defining' NO_MINUS_C_MINUS_O +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} @@ -680,7 +728,7 @@ 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); +ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; @@ -715,9 +763,10 @@ if eval $compile; then : else - { + +{ test -n "$verbose" && \ -echo ' defining' const to be 'empty' +echo " defining const to be empty" DEFS="$DEFS -Dconst=" SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD} \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD} @@ -736,9 +785,10 @@ if eval $compile; then : else - { + +{ test -n "$verbose" && \ -echo ' defining' USG +echo " defining USG" DEFS="$DEFS -DUSG=1" SEDDEFS="${SEDDEFS}\${SEDdA}USG\${SEDdB}USG\${SEDdC}1\${SEDdD} \${SEDuA}USG\${SEDuB}USG\${SEDuC}1\${SEDuD} @@ -749,6 +799,48 @@ fi rm -f conftest* +echo checking for broken stat file mode macros +cat > conftest.c < +#include +#ifdef S_ISBLK +#if S_ISBLK (S_IFDIR) +You lose. +#endif +#ifdef S_IFCHR +#if S_ISBLK (S_IFCHR) +You lose. +#endif +#endif /* S_IFCHR */ +#endif /* S_ISBLK */ +#ifdef S_ISLNK +#if S_ISLNK (S_IFREG) +You lose. +#endif +#endif /* S_ISLNK */ +#ifdef S_ISSOCK +#if S_ISSOCK (S_IFREG) +You lose. +#endif +#endif /* S_ISSOCK */ + +EOF +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "You lose" conftest.out >/dev/null 2>&1; then + +{ +test -n "$verbose" && \ +echo " defining STAT_MACROS_BROKEN" +DEFS="$DEFS -DSTAT_MACROS_BROKEN=1" +SEDDEFS="${SEDDEFS}\${SEDdA}STAT_MACROS_BROKEN\${SEDdB}STAT_MACROS_BROKEN\${SEDdC}1\${SEDdD} +\${SEDuA}STAT_MACROS_BROKEN\${SEDuB}STAT_MACROS_BROKEN\${SEDuC}1\${SEDuD} +\${SEDeA}STAT_MACROS_BROKEN\${SEDeB}STAT_MACROS_BROKEN\${SEDeC}1\${SEDeD} +" +} + +fi +rm -f conftest* + @@ -776,7 +868,7 @@ if eval $compile; then { test -n "$verbose" && \ -echo ' defining' ${trfunc} +echo " defining ${trfunc}" DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} @@ -797,9 +889,10 @@ int t() { char *p = alloca(2 * sizeof(int)); } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' HAVE_ALLOCA_H +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} @@ -864,7 +957,7 @@ if eval $compile; then { test -n "$verbose" && \ -echo ' defining' CRAY_STACKSEG_END to be '_getb67' +echo " defining CRAY_STACKSEG_END to be _getb67" DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD} @@ -892,7 +985,7 @@ if eval $compile; then { test -n "$verbose" && \ -echo ' defining' CRAY_STACKSEG_END to be 'GETB67' +echo " defining CRAY_STACKSEG_END to be GETB67" DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD} @@ -920,7 +1013,7 @@ if eval $compile; then { test -n "$verbose" && \ -echo ' defining' CRAY_STACKSEG_END to be 'getb67' +echo " defining CRAY_STACKSEG_END to be getb67" DEFS="$DEFS -DCRAY_STACKSEG_END=getb67" SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD} \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD} @@ -967,9 +1060,10 @@ if test -n "$cross_compiling" then - { + +{ test -n "$verbose" && \ -echo ' defining' STACK_DIRECTION to be '0' +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} @@ -998,9 +1092,10 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - { + +{ test -n "$verbose" && \ -echo ' defining' STACK_DIRECTION to be '1' +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} @@ -1009,9 +1104,10 @@ } else - { + +{ test -n "$verbose" && \ -echo ' defining' STACK_DIRECTION to be '-1' +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} @@ -1030,9 +1126,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' HAVE_VFORK_H +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} @@ -1114,9 +1211,10 @@ if test -s conftest && (./conftest; exit) 2>/dev/null; then : else - { + +{ test -n "$verbose" && \ -echo ' defining' vfork to be 'fork' +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} @@ -1129,9 +1227,12 @@ cat > conftest.c < +/* If setvbuf has the reversed format, exit 0. */ main () { - /* If setvbuf has the reversed format, exit 0. */ - if (setvbuf(stdout, _IOLBF, (char *) 0, BUFSIZ) != 0)/* The reversed way. */ + /* This call has the arguments reversed. + A reversed system may check and see that the address of main + is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ + if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) exit(1); putc('\r', stdout); exit(0); /* Non-reversed systems segv here. */ @@ -1139,9 +1240,10 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - { + +{ test -n "$verbose" && \ -echo ' defining' SETVBUF_REVERSED +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} @@ -1155,12 +1257,13 @@ # Some definitions of getloadavg require that the program be installed setgid. NEED_SETGID=false +need_func=true # Check for the 4.4BSD definition of getloadavg. LIBS_save="${LIBS}" -LIBS="${LIBS} -lutils" +LIBS="${LIBS} -lutil" have_lib="" -echo checking for -lutils +echo checking for -lutil cat > conftest.c < conftest.c < conftest.c < conftest.c < int main() { exit(0); } -int t() { /* The GNU C library defines this for functions which it implements +int t() { +/* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_${func}) || defined (__stub___${func}) @@ -1252,6 +1359,7 @@ case "$LIBOBJS" in *getloadavg*) +need_func=true echo checking for sys/dg_sys_info.h cat > conftest.c < @@ -1258,9 +1366,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' DGUX +echo " defining DGUX" DEFS="$DEFS -DDGUX=1" SEDDEFS="${SEDDEFS}\${SEDdA}DGUX\${SEDdB}DGUX\${SEDdC}1\${SEDdD} \${SEDuA}DGUX\${SEDuB}DGUX\${SEDuC}1\${SEDuD} @@ -1267,42 +1376,63 @@ \${SEDeA}DGUX\${SEDeB}DGUX\${SEDeC}1\${SEDeD} " } - have_sym=1 -fi -rm -f conftest* - -if test -z "$have_sym"; then -echo checking for dwarf.h + need_func=false +# Some versions of DGUX need -ldgc for dg_sys_info. +LIBS_save="${LIBS}" +LIBS="${LIBS} -ldgc" +have_lib="" +echo checking for -ldgc cat > conftest.c < + +int main() { exit(0); } +int t() { main(); } EOF -err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` -if test -z "$err"; then - { +if eval $compile; then + have_lib="1" +fi +rm -f conftest* +LIBS="${LIBS_save}" +if test -n "${have_lib}"; then + +{ 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} +echo " defining HAVE_LIBDGC" +DEFS="$DEFS -DHAVE_LIBDGC=1" +SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBDGC\${SEDdB}HAVE_LIBDGC\${SEDdC}1\${SEDdD} +\${SEDuA}HAVE_LIBDGC\${SEDuB}HAVE_LIBDGC\${SEDuC}1\${SEDuD} +\${SEDeA}HAVE_LIBDGC\${SEDeB}HAVE_LIBDGC\${SEDeC}1\${SEDeD} " } - LIBS="$LIBS -lelf" have_sym=1 + + LIBS="${LIBS} -ldgc" fi -rm -f conftest* fi -if test -z "$have_sym"; then -# Solaris 2 does not use dwarf, but it's still SVR4. -echo checking for elf.h +rm -f conftest* + +if $need_func; then +# We cannot check for , because Solaris 2 does not use dwarf (it +# uses stabs), but it's still SVR4. We cannot check for because +# Irix 4.0.5F has the header but not the library. +LIBS_save="${LIBS}" +LIBS="${LIBS} -lelf" +have_lib="" +echo checking for -lelf cat > conftest.c < + +int main() { exit(0); } +int t() { main(); } EOF -err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` -if test -z "$err"; then - { +if eval $compile; then + have_lib="1" +fi +rm -f conftest* +LIBS="${LIBS_save}" +if test -n "${have_lib}"; then + :; +{ test -n "$verbose" && \ -echo ' defining' SVR4 +echo " defining SVR4" DEFS="$DEFS -DSVR4=1" SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD} \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD} @@ -1309,7 +1439,7 @@ \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD} " } - LIBS="$LIBS -lelf" have_sym=1 + LIBS="$LIBS -lelf" need_func=false LIBS_save="${LIBS}" LIBS="${LIBS} -lkvm" have_lib="" @@ -1330,11 +1460,12 @@ :; fi +else + :; fi -rm -f conftest* fi -if test -z "$have_sym"; then +if $need_func; then echo checking for inq_stats/cpustats.h cat > conftest.c < @@ -1341,9 +1472,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' UMAX4_3 +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} @@ -1350,9 +1482,10 @@ \${SEDeA}UMAX4_3\${SEDeB}UMAX4_3\${SEDeC}1\${SEDeD} " } - { + +{ test -n "$verbose" && \ -echo ' defining' UMAX +echo " defining UMAX" DEFS="$DEFS -DUMAX=1" SEDDEFS="${SEDDEFS}\${SEDdA}UMAX\${SEDdB}UMAX\${SEDdC}1\${SEDdD} \${SEDuA}UMAX\${SEDuB}UMAX\${SEDuC}1\${SEDuD} @@ -1359,12 +1492,13 @@ \${SEDeA}UMAX\${SEDeB}UMAX\${SEDeC}1\${SEDeD} " } - have_sym=1 + + need_func=false fi rm -f conftest* fi -if test -z "$have_sym"; then +if $need_func; then echo checking for sys/cpustats.h cat > conftest.c < @@ -1371,9 +1505,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' UMAX +echo " defining UMAX" DEFS="$DEFS -DUMAX=1" SEDDEFS="${SEDDEFS}\${SEDdA}UMAX\${SEDdB}UMAX\${SEDdC}1\${SEDdD} \${SEDuA}UMAX\${SEDuB}UMAX\${SEDuC}1\${SEDuD} @@ -1380,12 +1515,12 @@ \${SEDeA}UMAX\${SEDeB}UMAX\${SEDeC}1\${SEDeD} " } - have_sym=1 + need_func=false fi rm -f conftest* fi -if test -z "$have_sym"; then +if $need_func; then for hdr in mach/mach.h do trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'` @@ -1395,9 +1530,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' ${trhdr} +echo " defining ${trhdr}" DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} @@ -1410,7 +1546,7 @@ done fi -if test -z "$have_sym"; then + echo checking for nlist.h cat > conftest.c < @@ -1417,9 +1553,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' NLIST_STRUCT +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} @@ -1434,9 +1571,10 @@ int t() { struct nlist n; n.n_un.n_name = 0; } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' NLIST_NAME_UNION +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} @@ -1449,7 +1587,6 @@ fi rm -f conftest* -fi # Figure out whether we will need to install setgid. cat > conftest.c < conftest.out 2>&1" if egrep "Yowza Am I SETGID yet" conftest.out >/dev/null 2>&1; then - { + +{ test -n "$verbose" && \ -echo ' defining' GETLOADAVG_PRIVILEGED +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} @@ -1479,9 +1617,14 @@ 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/'` + # On Solaris, /dev/kmem is a symlink. Get info on the real file. + ls_output=`ls -lgL /dev/kmem 2>/dev/null` + # If we got an error (system does not support symlinks), try without -L. + test -z "$ls_output" && ls_output=`ls -lg /dev/kmem` + KMEM_GROUP=`echo $ls_output \ + | sed -ne 's/[ ][ ]*/ /g; + s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; + / /s/.* //;p;'` fi echo checking for strcoll @@ -1496,9 +1639,10 @@ EOF eval $compile if test -s conftest && (./conftest; exit) 2>/dev/null; then - { + +{ test -n "$verbose" && \ -echo ' defining' HAVE_STRCOLL +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} @@ -1518,9 +1662,10 @@ EOF err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` if test -z "$err"; then - { + +{ test -n "$verbose" && \ -echo ' defining' ${trhdr} +echo " defining ${trhdr}" DEFS="$DEFS -D${trhdr}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD} \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD} @@ -1553,7 +1698,7 @@ if eval $compile; then { test -n "$verbose" && \ -echo ' defining' ${trfunc} +echo " defining ${trfunc}" DEFS="$DEFS -D${trfunc}=1" SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD} \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD} @@ -1584,9 +1729,10 @@ } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' HAVE_UNION_WAIT +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} @@ -1605,9 +1751,10 @@ int t() { char *msg = *(sys_siglist + 1); } EOF if eval $compile; then - { + +{ test -n "$verbose" && \ -echo ' defining' SYS_SIGLIST_DECLARED +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} @@ -1621,21 +1768,26 @@ # The presence of the following is not meant to imply # that make necessarily works on those systems. -echo checking for DYNIX/ptx libseq +LIBS_save="${LIBS}" +LIBS="${LIBS} -lseq" +have_lib="" +echo checking for -lseq cat > conftest.c < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then - SEQUENT=1 +if eval $compile; then + have_lib="1" fi rm -f conftest* +LIBS="${LIBS_save}" +if test -n "${have_lib}"; then + :; LIBS="$LIBS -lseq" +else + :; +fi -test -n "$SEQUENT" && test -f /usr/lib/libseq.a && - LIBS="$LIBS -lseq" echo checking for Xenix cat > conftest.c <conftest.def </dev/null | sed 1q`: # -# $0 $* +# $0 $configure_args for arg do case "\$arg" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - exec /bin/sh $0 $* ;; + echo running /bin/sh $0 $configure_args + exec /bin/sh $0 $configure_args ;; *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; esac done -trap 'rm -f Makefile build.sh glob/Makefile config.h conftest*; exit 1' 1 3 15 +trap 'rm -fr Makefile build.sh glob/Makefile config.h conftest*; exit 1' 1 3 15 CFLAGS='$CFLAGS' LDFLAGS='$LDFLAGS' CC='$CC' diff -ruN make-3.67/configure.in make-3.68/configure.in --- make-3.67/configure.in Wed May 12 15:24:14 1993 +++ make-3.68/configure.in Fri Jul 23 16:04:35 1993 @@ -24,6 +24,7 @@ AC_MINUS_C_MINUS_O AC_CONST dnl getopt needs this. AC_USG +AC_STAT_MACROS_BROKEN AC_SUBST(LIBOBJS) diff -ruN make-3.67/default.c make-3.68/default.c --- make-3.67/default.c Thu Apr 15 20:54:40 1993 +++ make-3.68/default.c Fri Jun 25 14:59:05 1993 @@ -31,7 +31,7 @@ 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 .txinfo \ -.cweb .web .sh .elc .el"; +.w .ch .web .sh .elc .el"; static struct pspec default_pattern_rules[] = { @@ -44,6 +44,12 @@ { "%.out", "%", "@rm -f $@ \n cp $< $@" }, + /* Syntax is "ctangle foo.w foo.ch foo.c". */ + { "%.c", "%.w %.ch", + "$(CTANGLE) $^ $@" }, + { "%.tex", "%.w %.ch", + "$(CWEAVE) $^ $@" }, + { 0, 0, 0 } }; @@ -171,14 +177,14 @@ ".txinfo.dvi", "$(TEXI2DVI) $<", - ".cweb.c", - "$(CTANGLE) $<", + ".w.c", + "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */ ".web.p", "$(TANGLE) $<", - ".cweb.tex", - "$(CWEAVE) $<", + ".w.tex", + "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */ ".web.tex", "$(WEAVE) $<", @@ -305,8 +311,8 @@ { char *p = default_suffixes; suffix_file->deps = (struct dep *) - multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep)), - sizeof (struct dep), 1); + multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1), + sizeof (struct dep)); (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0); } } diff -ruN make-3.67/dep.h make-3.68/dep.h --- make-3.67/dep.h Sun Aug 2 01:42:58 1992 +++ make-3.68/dep.h Wed Jul 14 18:56:42 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 @@ -40,7 +40,11 @@ extern struct nameseq *multi_glob (), *parse_file_seq (); +extern char *tilde_expand (); +#ifndef NO_ARCHIVES +extern struct nameseq *ar_glob (); +#endif #ifndef iAPX286 #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name) @@ -48,3 +52,18 @@ /* Buggy compiler can't hack this. */ extern char *dep_name (); #endif + +extern struct dep *read_all_makefiles (); + +/* Flag bits for the second argument to `read_makefile'. + These flags are saved in the `changed' field of each + `struct dep' in the chain returned by `read_all_makefiles'. */ +enum + { + RM_NO_DEFAULT_GOAL = 1 << 0, /* Do not set default goal. */ + RM_INCLUDED = 1 << 1, /* Search the makefile search path. */ + RM_DONTCARE = 1 << 2, /* No error if it doesn't exist. */ + RM_NO_TILDE = 1 << 3, /* Don't expand ~ in the file name. */ + RM_NOFLAG = 0 + }; + diff -ruN make-3.67/dir.c make-3.68/dir.c --- make-3.67/dir.c Fri May 14 18:41:07 1993 +++ make-3.68/dir.c Wed Jun 2 16:56:37 1993 @@ -242,12 +242,17 @@ { /* Enter the file in the hash table. */ register unsigned int newhash = 0; + unsigned int len; register unsigned int i; if (!REAL_DIR_ENTRY (d)) continue; - for (i = 0; i < D_NAMLEN(d); ++i) + len = D_NAMLEN (d); + while (d->d_name[len - 1] == '\0') + --len; + + for (i = 0; i < len; ++i) HASH (newhash, d->d_name[i]); newhash %= DIRFILE_BUCKETS; @@ -254,7 +259,7 @@ df = (struct dirfile *) xmalloc (sizeof (struct dirfile)); df->next = dir->files[newhash]; dir->files[newhash] = df; - df->name = savestring (d->d_name, D_NAMLEN(d)); + df->name = savestring (d->d_name, len); df->impossible = 0; /* Check if the name matches the one we're searching for. */ diff -ruN make-3.67/expand.c make-3.68/expand.c --- make-3.67/expand.c Thu May 6 17:14:33 1993 +++ make-3.68/expand.c Fri Jun 25 15:20:36 1993 @@ -104,11 +104,32 @@ return value; } -/* Expand a simple reference to variable NAME, which LENGTH chars long. */ +/* Warn that NAME is an undefined variable. */ #ifdef __GNUC__ __inline #endif +static void +warn_undefined (name, length) + char *name; + unsigned int length; +{ + if (warn_undefined_variables_flag) + { + static const char warnmsg[] = "warning: undefined variable `%.*s'"; + if (reading_filename != 0) + makefile_error (reading_filename, *reading_lineno_ptr, + warnmsg, length, name); + else + error (warnmsg, length, name); + } +} + +/* Expand a simple reference to variable NAME, which is LENGTH chars long. */ + +#ifdef __GNUC__ +__inline +#endif static char * reference_variable (o, name, length) char *o; @@ -117,6 +138,9 @@ { register struct variable *v = lookup_variable (name, length); + if (v == 0) + warn_undefined (name, length); + if (v != 0 && *v->value != '\0') { char *value = (v->recursive ? recursively_expand (v) : v->value); @@ -254,6 +278,8 @@ char *subst_beg, *subst_end, *replace_beg, *replace_end; v = lookup_variable (beg, colon - beg); + if (v == 0) + warn_undefined (beg, colon - beg); subst_beg = colon + 1; count = 0; diff -ruN make-3.67/file.c make-3.68/file.c --- make-3.67/file.c Sat May 22 16:24:37 1993 +++ make-3.68/file.c Wed Jun 30 18:11:36 1993 @@ -88,27 +88,6 @@ if (*name == '\0') abort (); - /* This is also done in parse_file_seq, so this is redundant - for names read from makefiles. It is here for names passed - on the command line. */ - while (name[0] == '.' && name[1] == '/' && name[2] != '\0') - { - name += 2; - while (*name == '/') - /* Skip following slashes: ".//foo" is "foo", not "/foo". */ - ++name; - } - - if (*name == '\0') - { - /* It was all slashes! Move back to the dot and truncate - it after the first slash, so it becomes just "./". */ - do - --name; - while (name[0] != '.'); - name[2] = '\0'; - } - hashval = 0; for (n = name; *n != '\0'; ++n) HASH (hashval, *n); @@ -333,7 +312,7 @@ if (!f->dontcare) { if (sig) - error ("*** Deleting file `%s'", f->name); + error ("*** Deleting intermediate file `%s'", f->name); else if (!silent_flag) { if (! doneany) diff -ruN make-3.67/function.c make-3.68/function.c --- make-3.67/function.c Wed May 12 15:44:41 1993 +++ make-3.68/function.c Wed Jul 14 20:22:55 1993 @@ -324,7 +324,7 @@ case function_shell: { - char **argv; + char **argv, **envp; char *error_prefix; int pipedes[2]; int pid; @@ -337,6 +337,9 @@ if (argv == 0) break; + /* Construct the environment. */ + envp = target_environment ((struct file *) 0); + /* For error messages. */ if (reading_filename != 0) { @@ -357,18 +360,32 @@ if (pid < 0) perror_with_name (error_prefix, "fork"); else if (pid == 0) - child_execute_job (0, pipedes[1], argv, environ); + child_execute_job (0, pipedes[1], argv, envp); else { - /* We are the parent. Set up and read from the pipe. */ - char *buffer = (char *) xmalloc (201); - unsigned int maxlen = 200; + /* We are the parent. */ + + char *buffer; + unsigned int maxlen; int cc; - /* Record the PID for child_handler. */ + /* Free the storage only the child needed. */ + free (argv[0]); + free ((char *) argv); + for (i = 0; envp[i] != 0; ++i) + free (envp[i]); + free ((char *) envp); + + /* Record the PID for reap_children. */ shell_function_pid = pid; shell_function_completed = 0; + + /* Set up and read from the pipe. */ + + maxlen = 200; + buffer = (char *) xmalloc (maxlen + 1); + /* Close the write side of the pipe. */ (void) close (pipedes[1]); @@ -433,8 +450,6 @@ } } - free (argv[0]); - free ((char *) argv); free (buffer); } @@ -1152,12 +1167,13 @@ register struct nameseq *chain; register unsigned int idx; - 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); + chain = multi_glob (parse_file_seq + (&line, '\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), + sizeof (struct nameseq)); if (result == 0) { diff -ruN make-3.67/getloadavg.c make-3.68/getloadavg.c --- make-3.67/getloadavg.c Thu May 20 16:22:34 1993 +++ make-3.68/getloadavg.c Mon Jul 26 20:37:13 1993 @@ -124,7 +124,7 @@ #define SUNOS_5 #endif -#if defined (__osf__) && defined (__alpha__) +#if defined (__osf__) && (defined (__alpha) || defined (__alpha__)) #define OSF_ALPHA #endif @@ -141,11 +141,54 @@ #endif -/* 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) || (defined (ardent) && defined (titan)) || defined (tek4300)) +/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */ +#ifndef LOAD_AVE_TYPE + +#ifdef MORE_BSD +#define LOAD_AVE_TYPE long +#endif + +#ifdef sun +#define LOAD_AVE_TYPE long +#endif + +#ifdef decstation +#define LOAD_AVE_TYPE long +#endif + +#ifdef _SEQUENT_ +#define LOAD_AVE_TYPE long +#endif + +#ifdef sgi +#define LOAD_AVE_TYPE long +#endif + +#ifdef SVR4 +#define LOAD_AVE_TYPE long +#endif + +#ifdef sony_news +#define LOAD_AVE_TYPE long +#endif + +#ifdef sequent +#define LOAD_AVE_TYPE long +#endif + +#ifdef OSF_ALPHA +#define LOAD_AVE_TYPE long +#endif + +#if defined (ardent) && defined (titan) +#define LOAD_AVE_TYPE long +#endif + +#ifdef tek4300 #define LOAD_AVE_TYPE long #endif +#endif /* No LOAD_AVE_TYPE. */ #ifndef FSCALE @@ -160,6 +203,9 @@ #endif #if defined (sgi) || defined (sequent) +/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined + above under #ifdef MIPS. But we want the sgi value. */ +#undef FSCALE #define FSCALE 1000.0 #endif @@ -177,12 +223,60 @@ #define LDAV_CVT(n) (((double) (n)) / FSCALE) #endif -/* 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) || (defined (ardent) && defined (titan)) || defined (tek4300) || defined (butterfly)) +/* VAX C can't handle multi-line #ifs, or lines longer that 256 characters. */ +#ifndef NLIST_STRUCT + +#ifdef MORE_BSD +#define NLIST_STRUCT +#endif + +#ifdef sun +#define NLIST_STRUCT +#endif + +#ifdef decstation +#define NLIST_STRUCT +#endif + +#ifdef hpux +#define NLIST_STRUCT +#endif + +#if defined (_SEQUENT_) || defined (sequent) +#define NLIST_STRUCT +#endif + +#ifdef sgi +#define NLIST_STRUCT +#endif + +#ifdef SVR4 +#define NLIST_STRUCT +#endif + +#ifdef sony_news +#define NLIST_STRUCT +#endif + +#ifdef OSF_ALPHA +#define NLIST_STRUCT +#endif + +#if defined (ardent) && defined (titan) +#define NLIST_STRUCT +#endif + +#ifdef tex4300 #define NLIST_STRUCT #endif +#ifdef butterfly +#define NLIST_STRUCT +#endif + +#endif /* defined (NLIST_STRUCT) */ + #if defined(sgi) || (defined(mips) && !defined(BSD)) #define FIXUP_KERNEL_SYMBOL_ADDR(nl) ((nl)[0].n_value &= ~(1 << 31)) #endif @@ -345,7 +439,7 @@ /* Put the 1 minute, 5 minute and 15 minute load averages into the first NELEM elements of LOADAVG. - Return the number written (never more than 3), + Return the number written (never more than 3, but may be less than NELEM), or -1 if an error occurred. */ int @@ -355,6 +449,14 @@ { int elem = 0; /* Return value. */ +#ifdef NO_GET_LOAD_AVG +#define LDAV_DONE + /* Set errno to zero to indicate that there was no particular error; + this function just can't work at all on this system. */ + errno = 0; + elem = -1; +#endif + #if !defined (LDAV_DONE) && defined (LINUX) #define LDAV_DONE #undef LOAD_AVE_TYPE @@ -395,12 +497,8 @@ 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; - } + /* We only know how to get the 1-minute average for this system, + so even if the caller asks for more than 1, we only return 1. */ if (!getloadavg_initialized) { @@ -540,13 +638,13 @@ #if !defined (LDAV_DONE) && defined (OSF_MIPS) #define LDAV_DONE -#define LDAV_PRIVILEGED struct tbl_loadavg load_ave; table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave)); - loadavg[elem++] = (load_ave.tl_lscale == 0 - ? load_ave.tl_avenrun.d[0] - : (load_ave.tl_avenrun.l[0] / load_ave.tl_lscale)); + loadavg[elem++] + = (load_ave.tl_lscale == 0 + ? load_ave.tl_avenrun.d[0] + : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale)); #endif /* OSF_MIPS */ #if !defined (LDAV_DONE) && defined (VMS) @@ -600,7 +698,6 @@ /* Get the address of LDAV_SYMBOL. */ if (offset == 0) { -#ifndef SUNOS_5 #ifndef sgi #ifndef NLIST_STRUCT strcpy (nl[0].n_name, LDAV_SYMBOL); @@ -615,6 +712,7 @@ #endif /* not NLIST_NAME_UNION */ #endif /* NLIST_STRUCT */ +#ifndef SUNOS_5 if (nlist (KERNEL_FILE, nl) >= 0) /* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i. */ { @@ -623,6 +721,7 @@ #endif offset = nl[0].n_value; } +#endif /* !SUNOS_5 */ #else /* sgi */ int ldav_off; @@ -630,7 +729,6 @@ if (ldav_off != -1) offset = (long) ldav_off & 0x7fffffff; #endif /* sgi */ -#endif /* !SUNOS_5 */ } /* Make sure we have /dev/kmem open. */ @@ -641,10 +739,14 @@ if (channel >= 0) getloadavg_initialized = 1; #else /* SUNOS_5 */ + /* We pass 0 for the kernel, corefile, and swapfile names + to use the currently running kernel. */ kd = kvm_open (0, 0, 0, O_RDONLY, 0); if (kd != 0) { + /* nlist the currently running kernel. */ kvm_nlist (kd, nl); + offset = nl[0].n_value; getloadavg_initialized = 1; } #endif /* SUNOS_5 */ diff -ruN make-3.67/getopt.c make-3.68/getopt.c --- make-3.67/getopt.c Fri May 7 15:29:58 1993 +++ make-3.68/getopt.c Thu Jul 8 13:20:26 1993 @@ -20,31 +20,17 @@ along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* NOTE!!! AIX requires this to be the first thing in the file. - Do not put ANYTHING before it! */ -#if !defined (__GNUC__) && defined (_AIX) - #pragma alloca -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not __GNUC__ */ -#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) -#include -#else -#ifndef _AIX -char *alloca (); -#endif -#endif /* alloca.h */ -#endif /* not __GNUC__ */ - -#if !__STDC__ && !defined(const) && IN_GCC +#ifndef __STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const #define const #endif +#endif /* This tells Alpha OSF/1 not to define a getopt prototype in . */ #ifndef _NO_PROTO @@ -67,12 +53,9 @@ /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ -#undef alloca /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include -#else /* Not GNU C library. */ -#define __alloca alloca #endif /* GNU C library. */ /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a @@ -180,7 +163,6 @@ in GCC. */ #include #define my_index strchr -#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) #else /* Avoid depending on library functions or files @@ -202,16 +184,19 @@ return 0; } -static void -my_bcopy (from, to, size) - const char *from; - char *to; - int size; -{ - int i; - for (i = 0; i < size; i++) - to[i] = from[i]; -} +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. + (Supposedly there are some machines where it might get a warning, + but changing this conditional to __STDC__ is too risky.) */ +#ifdef __GNUC__ +#ifdef IN_GCC +#include "gstddef.h" +#else +#include +#endif +extern size_t strlen (const char *); +#endif + #endif /* GNU C library. */ /* Handle permutation of arguments. */ @@ -236,17 +221,51 @@ exchange (argv) char **argv; { - int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); - char **temp = (char **) __alloca (nonopts_size); - - /* Interchange the two blocks of data in ARGV. */ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ - my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); - my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], - (optind - last_nonopt) * sizeof (char *)); - my_bcopy ((char *) temp, - (char *) &argv[first_nonopt + optind - last_nonopt], - nonopts_size); + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } /* Update records for the slots the non-options now occupy. */ diff -ruN make-3.67/implicit.c make-3.68/implicit.c --- make-3.67/implicit.c Wed Mar 10 15:41:03 1993 +++ make-3.68/implicit.c Wed Jun 30 19:04:21 1993 @@ -113,7 +113,8 @@ /* Buffer in which we store all the rules that are possibly applicable. */ struct rule **tryrules - = (struct rule **) alloca (num_pattern_rules * sizeof (struct rule *)); + = (struct rule **) alloca (num_pattern_rules * max_pattern_targets + * sizeof (struct rule *)); /* Number of valid elements in TRYRULES. */ unsigned int nrules; @@ -164,9 +165,6 @@ nrules = 0; for (rule = pattern_rules; rule != 0; rule = rule->next) { - int specific_rule_may_have_matched = 0; - int check_lastslash; - /* If the pattern rule has deps but no commands, ignore it. Users cancel built-in rules by redefining them without commands. */ if (rule->deps != 0 && rule->cmds == 0) @@ -184,6 +182,7 @@ { char *target = rule->targets[i]; char *suffix = rule->suffixes[i]; + int check_lastslash; /* Rules that can match any filename and are not terminal are ignored if we're recursing, so that they cannot be @@ -237,29 +236,21 @@ /* Record if we match a rule that not all filenames will match. */ if (target[1] != '\0') - specific_rule_may_have_matched = 1; - - /* We have a matching target. Don't search for any more. */ - break; - } - - /* None of the targets matched. */ - if (rule->targets[i] == 0) - continue; + specific_rule_matched = 1; - specific_rule_matched |= specific_rule_may_have_matched; - - /* A rule with no dependencies and no commands exists solely to set - specific_rule_matched when it matches. Don't try to use it. */ - if (rule->deps == 0 && rule->cmds == 0) - continue; + /* A rule with no dependencies and no commands exists solely to set + specific_rule_matched when it matches. Don't try to use it. */ + if (rule->deps == 0 && rule->cmds == 0) + continue; - /* Record this rule in TRYRULES and the index - of the (first) matching target in MATCHES. */ - tryrules[nrules] = rule; - matches[nrules] = i; - checked_lastslash[nrules] = check_lastslash; - ++nrules; + /* Record this rule in TRYRULES and the index of the matching + target in MATCHES. If several targets of the same rule match, + that rule will be in TRYRULES more than once. */ + tryrules[nrules] = rule; + matches[nrules] = i; + checked_lastslash[nrules] = check_lastslash; + ++nrules; + } } /* If we have found a matching rule that won't match all filenames, @@ -408,10 +399,13 @@ p = savestring (p, strlen (p)); intermediate_patterns[deps_found] = intermediate_file->name; - found_files[deps_found] = p; intermediate_file->name = p; intermediate_files[deps_found] = intermediate_file; intermediate_file = 0; + /* Allocate an extra copy to go in FOUND_FILES, + because every elt of FOUND_FILES is consumed + or freed later. */ + found_files[deps_found] = savestring (p, strlen (p)); ++deps_found; continue; } @@ -513,7 +507,14 @@ if (recursions == 0) { dep->name = 0; - dep->file = enter_file (s); + dep->file = lookup_file (s); + if (dep->file == 0) + /* enter_file consumes S's storage. */ + dep->file = enter_file (s); + else + /* A copy of S is already allocated in DEP->file->name. + So we can free S. */ + free (s); } else { diff -ruN make-3.67/job.c make-3.68/job.c --- make-3.67/job.c Wed May 12 15:20:45 1993 +++ make-3.68/job.c Fri Jun 25 16:03:56 1993 @@ -1390,9 +1390,19 @@ char *line, **restp; struct file *file; { - char *shell = allocated_variable_expand_for_file ("$(SHELL)", file); - char *ifs = allocated_variable_expand_for_file ("$(IFS)", file); + char *shell, *ifs; char **argv; + + { + /* Turn off --warn-undefined-variables while we expand SHELL and IFS. */ + int save = warn_undefined_variables_flag; + warn_undefined_variables_flag = 0; + + shell = allocated_variable_expand_for_file ("$(SHELL)", file); + ifs = allocated_variable_expand_for_file ("$(IFS)", file); + + warn_undefined_variables_flag = save; + } argv = construct_command_argv_internal (line, restp, shell, ifs); diff -ruN make-3.67/main.c make-3.68/main.c --- make-3.67/main.c Sat May 22 16:20:16 1993 +++ make-3.68/main.c Wed Jul 14 18:56:38 1993 @@ -26,8 +26,6 @@ extern char *version_string; -extern struct dep *read_all_makefiles (); - extern void print_variable_data_base (); extern void print_dir_data_base (); extern void print_rule_data_base (); @@ -49,35 +47,7 @@ static void print_data_base (), print_version (); static void decode_switches (), decode_env_switches (); static void define_makeflags (); - - -#if 0 /* dummy tag */ -flags () {} -#endif -/* Flags: - * -b ignored for compatibility with System V Make - * -C change directory - * -d debug - * -e env_overrides - * -f makefile - * -i ignore_errors - * -j job_slots - * -k keep_going - * -l max_load_average - * -m ignored for compatibility with something or other - * -n just_print - * -o consider file old - * -p print_data_base - * -q question - * -r no_builtin_rules - * -s silent - * -S turn off -k - * -t touch - * -v print version information - * -w log working directory - * -W consider file new (with -n, `what' if effect) - */ - + /* The structure that describes an accepted command switch. */ struct command_switch @@ -203,7 +173,7 @@ double max_load_average = -1.0; double default_load_average = -1.0; -/* List of directories given with -c switches. */ +/* List of directories given with -C switches. */ static struct stringlist *directories = 0; @@ -222,6 +192,11 @@ /* If nonzero, we should just print usage and exit. */ static int print_usage_flag = 0; + +/* If nonzero, we should print a warning message + for each reference to an undefined variable. */ + +int warn_undefined_variables_flag; /* The table of command switches. */ @@ -303,6 +278,9 @@ { 'W', string, (char *) &new_files, 0, 0, 0, 0, 0, "what-if", "FILE", "Consider FILE to be infinitely new" }, + { 2, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0, + "warn-undefined-variables", 0, + "Warn when an undefined variable is referenced" }, { '\0', } }; @@ -365,6 +343,41 @@ #endif #endif +static struct file * +enter_command_line_file (name) + char *name; +{ + if (name[0] == '~') + { + char *expanded = tilde_expand (name); + if (expanded != 0) + name = expanded; /* Memory leak; I don't care. */ + } + + /* This is also done in parse_file_seq, so this is redundant + for names read from makefiles. It is here for names passed + on the command line. */ + while (name[0] == '.' && name[1] == '/' && name[2] != '\0') + { + name += 2; + while (*name == '/') + /* Skip following slashes: ".//foo" is "foo", not "/foo". */ + ++name; + } + + if (*name == '\0') + { + /* It was all slashes! Move back to the dot and truncate + it after the first slash, so it becomes just "./". */ + do + --name; + while (name[0] != '.'); + name[2] = '\0'; + } + + return enter_file (savestring (name, strlen (name))); +} + int main (argc, argv, envp) int argc; @@ -550,7 +563,7 @@ { /* It was not a variable definition, so it is a target to be made. Enter it as a file and add it to the dep chain of goals. */ - f = enter_file (other_args->list[i]); + f = enter_command_line_file (other_args->list[i]); f->cmd_target = 1; if (goals == 0) @@ -599,8 +612,16 @@ for (i = 0; directories->list[i] != 0; ++i) { char *dir = directories->list[i]; + if (dir[0] == '~') + { + char *expanded = tilde_expand (dir); + if (expanded != 0) + dir = expanded; + } if (chdir (dir) < 0) pfatal_with_name (dir); + if (dir != directories->list[i]) + free (dir); } /* Figure out the level of recursion. */ @@ -663,9 +684,6 @@ static char name[] = "/tmp/GmXXXXXX"; FILE *outfile; - /* Free the storage allocated for "-". */ - free (makefiles->list[i]); - /* Make a unique filename. */ (void) mktemp (name); @@ -686,7 +704,13 @@ /* Replace the name that read_all_makefiles will see with the name of the temporary file. */ - makefiles->list[i] = savestring (name, sizeof name - 1); + { + char *temp; + /* SGI compiler requires alloca's result be assigned simply. */ + temp = (char *) alloca (sizeof (name)); + bcopy (name, temp, sizeof (name)); + makefiles->list[i] = temp; + } /* Make sure the temporary file will not be remade. */ f = enter_file (savestring (name, sizeof name - 1)); @@ -776,7 +800,7 @@ if (old_files != 0) for (p = old_files->list; *p != 0; ++p) { - f = enter_file (*p); + f = enter_command_line_file (*p); f->last_mtime = (time_t) 1; f->updated = 1; f->update_status = 0; @@ -788,7 +812,7 @@ now = time ((time_t *) 0); for (p = new_files->list; *p != 0; ++p) { - f = enter_file (*p); + f = enter_command_line_file (*p); f->last_mtime = now; } } @@ -894,7 +918,7 @@ any_remade |= (file_mtime_no_search (d->file) != makefile_mtimes[i]); } - else if (d->changed != 1) + else if (! (d->changed & RM_DONTCARE)) { time_t mtime; /* The update failed and this makefile was not @@ -908,23 +932,20 @@ } else /* This makefile was not found at all. */ - switch (d->changed) + if (! (d->changed & RM_DONTCARE)) { - case 0: - /* A normal makefile. We must die later. */ - error ("Makefile `%s' was not found", dep_name (d)); - any_failed = 1; - break; - case 1: - /* A makefile from the MAKEFILES variable. - We don't care. */ - break; - case 2: - /* An included makefile. We don't need - to die, but we do want to complain. */ - error ("Included makefile `%s' was not found.", - dep_name (d)); - break; + /* This is a makefile we care about. See how much. */ + if (d->changed & RM_INCLUDED) + /* An included makefile. We don't need + to die, but we do want to complain. */ + error ("Included makefile `%s' was not found.", + dep_name (d)); + else + { + /* A normal makefile. We must die later. */ + error ("Makefile `%s' was not found", dep_name (d)); + any_failed = 1; + } } free ((char *) d); @@ -939,18 +960,23 @@ } case 0: - re_exec:; + re_exec: /* Updated successfully. Re-exec ourselves. */ + + remove_intermediates (0); + + if (print_data_base_flag) + print_data_base (); + if (print_directory_flag) log_working_directory (0); - if (debug_flag) - puts ("Re-execing myself...."); + if (makefiles != 0) { /* These names might have changed. */ register unsigned int i, j = 0; for (i = 1; i < argc; ++i) - if (!strcmp (argv[i], "-f")) + if (!strcmp (argv[i], "-f")) /* XXX */ { char *p = &argv[i][2]; if (*p == '\0') @@ -960,6 +986,7 @@ ++j; } } + if (directories != 0 && directories->idx > 0) { char bad; @@ -978,8 +1005,7 @@ if (bad) fatal ("Couldn't change back to original directory."); } - fflush (stdout); - fflush (stderr); + for (p = environ; *p != 0; ++p) if (!strncmp (*p, "MAKELEVEL=", 10)) { @@ -992,6 +1018,19 @@ sprintf (*p, "MAKELEVEL=%u", makelevel); break; } + + if (debug_flag) + { + char **p; + fputs ("Re-executing:", stdout); + for (p = argv; *p != 0; ++p) + printf (" %s", *p); + puts (""); + } + + fflush (stdout); + fflush (stderr); + exec_command (argv, environ); /* NOTREACHED */ } @@ -1135,7 +1174,7 @@ other_args->max = argc + 1; other_args->list = (char **) xmalloc ((argc + 1) * sizeof (char *)); other_args->idx = 1; - other_args->list[0] = savestring (argv[0], strlen (argv[0])); + other_args->list[0] = argv[0]; } /* getopt does most of the parsing for us. @@ -1205,7 +1244,7 @@ xrealloc ((char *) sl->list, sl->max * sizeof (char *)); } - sl->list[sl->idx++] = savestring (optarg, strlen (optarg)); + sl->list[sl->idx++] = optarg; sl->list[sl->idx] = 0; break; @@ -1279,7 +1318,7 @@ fputs ("Options:\n", stderr); for (cs = switches; cs->c != '\0'; ++cs) { - char buf[1024], arg[50], *p; + char buf[1024], shortarg[50], longarg[50], *p; if (cs->description[0] == '-') continue; @@ -1287,13 +1326,15 @@ switch (long_options[cs - switches].has_arg) { case no_argument: - arg[0] = '\0'; + shortarg[0] = longarg[0] = '\0'; break; case required_argument: - sprintf (arg, " %s", cs->argdesc); + sprintf (longarg, "=%s", cs->argdesc); + sprintf (shortarg, " %s", cs->argdesc); break; case optional_argument: - sprintf (arg, " [%s]", cs->argdesc); + sprintf (longarg, "[=%s]", cs->argdesc); + sprintf (shortarg, " [%s]", cs->argdesc); break; } @@ -1301,7 +1342,7 @@ if (isalnum (cs->c)) { - sprintf (buf, " -%c%s", cs->c, arg); + sprintf (buf, " -%c%s", cs->c, shortarg); p += strlen (p); } if (cs->long_name != 0) @@ -1309,7 +1350,7 @@ unsigned int i; sprintf (p, "%s--%s%s", !isalnum (cs->c) ? " " : ", ", - cs->long_name, arg); + cs->long_name, longarg); p += strlen (p); for (i = 0; i < (sizeof (long_option_aliases) / sizeof (long_option_aliases[0])); @@ -1316,7 +1357,8 @@ ++i) if (long_option_aliases[i].val == cs->c) { - sprintf (p, ", --%s%s", long_option_aliases[i].name, arg); + sprintf (p, ", --%s%s", + long_option_aliases[i].name, longarg); p += strlen (p); } } @@ -1329,11 +1371,11 @@ /* This is another switch that does the same one as the one we are processing. We want to list them all together on one line. */ - sprintf (p, ", -%c%s", ncs->c, arg); + sprintf (p, ", -%c%s", ncs->c, shortarg); p += strlen (p); if (ncs->long_name != 0) { - sprintf (p, ", --%s%s", ncs->long_name, arg); + sprintf (p, ", --%s%s", ncs->long_name, longarg); p += strlen (p); } } @@ -1387,8 +1429,10 @@ return; /* Make a copy of the value in ARGS, where we will munge it. - If it does not begin with a dash, prepend one. */ - args = (char *) alloca (1 + len + 2); + If it does not begin with a dash, prepend one. + We must allocate lasting storage for this (and we never free it) because + decode_switches may save pointers into it for string-valued switches. */ + args = (char *) xmalloc (1 + len + 2); if (value[0] != '-') args[0] = '-'; bcopy (value, value[0] == '-' ? args : &args[1], len + 1); diff -ruN make-3.67/make-stds.texi make-3.68/make-stds.texi --- make-3.67/make-stds.texi Sat May 15 17:26:30 1993 +++ make-3.68/make-stds.texi Fri Jul 23 18:08:18 1993 @@ -43,10 +43,10 @@ when using the @samp{--srcdir} option to @file{configure}. A rule of the form: -@example +@smallexample foo.1 : foo.man sedscript sed -e sedscript foo.man > foo.1 -@end example +@end smallexample @noindent will fail when the current directory is not the source directory, @@ -59,18 +59,18 @@ source file wherever it is. (Many versions of @code{make} set @samp{$<} only in implicit rules.) A makefile target like -@example +@smallexample foo.o : bar.c $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o -@end example +@end smallexample @noindent should instead be written as -@example +@smallexample foo.o : bar.c $(CC) $(CFLAGS) $< -o $@@ -@end example +@end smallexample @noindent in order to allow @samp{VPATH} to work correctly. When the target has @@ -78,10 +78,10 @@ way to make the rule work well. For example, the target above for @file{foo.1} is best written as: -@example +@smallexample foo.1 : foo.man sedscript sed -s $(srcdir)/sedscript $(srcdir)/foo.man > foo.1 -@end example +@end smallexample @node Utilities in Makefiles @section Utilities in Makefiles @@ -131,7 +131,7 @@ @table @samp @item all Compile the entire program. This should be the default target. This -target need not rebuild any documentation files; info files should +target need not rebuild any documentation files; Info files should normally be included in the distribution, and DVI files should be made only when explicitly asked for. @@ -138,15 +138,42 @@ @item install Compile the program and copy the executables, libraries, and so on to the file names where they should reside for actual use. If there is a -simple test to verify that a program is properly installed then run that -test. +simple test to verify that a program is properly installed, this target +should run that test. + +The commands should create all the directories in which files are to be +installed, if they don't already exist. This includes the directories +specified as the values of the variables @code{prefix} and +@code{exec_prefix}, as well as all subdirectories that are needed. +One way to do this is by means of an @code{installdirs} target +as described below. Use @samp{-} before any command for installing a man page, so that @code{make} will ignore any errors. This is in case there are systems that don't have the Unix man page documentation system installed. -In the future, when we have a standard way of installing info files, -@samp{install} targets will be the proper place to do so. +The way to install Info files is to copy them into @file{$(infodir)} +with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run +the @code{install-info} program if it is present. @code{install-info} +is a script that edits the Info @file{dir} file to add or update the +menu entry for the given Info file; it will be part of the Texinfo package. +Here is a sample rule to install an Info file: + +@comment This example has been carefully formatted for the Make manual. +@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu. +@smallexample +$(infodir)/foo.info: foo.info +# There may be a newer info file in . than in srcdir. + -if test -f foo.info; then d=.; \ + else d=$(srcdir); fi; \ + $(INSTALL_DATA) $$d/foo.info $@@; \ +# Run install-info only if it exists. +# Use `if' instead of just prepending `-' to the +# line so we notice real errors from install-info. + if install-info --version >/dev/null 2>&1; then \ + install-info --infodir=$(infodir) $$d/foo.info; \ + else true; fi +@end smallexample @item uninstall Delete all the installed files that the @samp{install} target would @@ -153,7 +180,10 @@ create (but not the noninstalled files such as @samp{make all} would create). +@comment The gratuitous blank line here is to make the table look better +@comment in the printed Make manual. Please leave it in. @item clean + Delete all files from the current directory that are normally created by building the program. Don't delete the files that record the configuration. Also preserve files that could be made by building, but @@ -176,8 +206,8 @@ @item realclean Delete everything from the current directory that can be reconstructed with this Makefile. This typically includes everything deleted by -distclean, plus more: C source files produced by Bison, tags tables, -info files, and so on. +@code{distclean}, plus more: C source files produced by Bison, tags tables, +Info files, and so on. One exception, however: @samp{make realclean} should not delete @file{configure} even if @file{configure} can be remade using a rule in @@ -189,34 +219,35 @@ Update a tags table for this program. @item info -Generate any info files needed. The best way to write the rules is as +Generate any Info files needed. The best way to write the rules is as follows: -@example -info: foo.info +@smallexample +info: foo.info -foo.info: $(srcdir)/foo.texi $(srcdir)/chap1.texi $(srcdir)/chap2.texi +foo.info: foo.texi chap1.texi chap2.texi $(MAKEINFO) $(srcdir)/foo.texi -@end example +@end smallexample @noindent -You must define the variable @code{MAKEINFO} in the Makefile. -It should run the Makeinfo program, which is part of the Texinfo2 distribution. +You must define the variable @code{MAKEINFO} in the Makefile. It should +run the @code{makeinfo} program, which is part of the Texinfo +distribution. @item dvi Generate DVI files for all TeXinfo documentation. For example: -@example +@smallexample dvi: foo.dvi -foo.dvi: $(srcdir)/foo.texi $(srcdir)/chap1.texi $(srcdir)/chap2.texi +foo.dvi: foo.texi chap1.texi chap2.texi $(TEXI2DVI) $(srcdir)/foo.texi -@end example +@end smallexample @noindent You must define the variable @code{TEXI2DVI} in the Makefile. It should -run the program @code{texi2dvi}, which is part of the Texinfo2 +run the program @code{texi2dvi}, which is part of the Texinfo distribution. Alternatively, write just the dependencies, and allow GNU Make to provide the command. @@ -245,8 +276,8 @@ installed. @end table - The following target is suggested as a conventional name, for programs -in which it is useful. +The following targets are suggested as conventional names, for programs +in which they are useful. @table @code @item installcheck @@ -257,24 +288,20 @@ @item installdirs It's useful to add a target named @samp{installdirs} to create the directories where files are installed, and their parent directories. +There is a script called @file{mkinstalldirs} which is convenient for +this; find it in the Texinfo package.@c It's in /gd/gnu/lib/mkinstalldirs. You can use a rule like this: -@example -# Make sure all installation directories, e.g. $(bindir) actually exist by -# making them if necessary. -installdirs: - for file in $(bindir) $(datadir) $(libdir) $(infodir) $(mandir) ; do \ - oIFS="$$@{IFS@}"; IFS='/'; set - $$@{file@}; IFS="$$@{oIFS@}"; \ - pathcomp=''; test ".$$@{1@}" = "." && shift; \ - while test $$# -ne 0 ; do \ - pathcomp="$$@{pathcomp@}/$$@{1@}"; shift; \ - if test ! -d "$$@{pathcomp@}"; then \ - echo "making directory $$pathcomp" 1>&2 ; \ - mkdir "$$@{pathcomp@}"; \ - fi; \ - done; \ - done -@end example +@comment This has been carefully formatted to look decent in the Make manual. +@comment Please be sure not to make it extend any further to the right.--roland +@smallexample +# Make sure all installation directories (e.g. $(bindir)) +# actually exist by making them if necessary. +installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ + $(libdir) $(infodir) \ + $(mandir) +@end smallexample @end table @node Command Variables @@ -308,12 +335,12 @@ independently of @code{CFLAGS}, by writing them explicitly in the compilation commands or by defining an implicit rule, like this: -@example +@smallexample CFLAGS = -g ALL_CFLAGS = -I. $(CFLAGS) .c.o: $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -@end example +@end smallexample Do include the @samp{-g} option in @code{CFLAGS}, because that is not @emph{required} for proper compilation. You can consider it a default @@ -328,8 +355,8 @@ Every Makefile should define the variable @code{INSTALL}, which is the basic command for installing a file into the system. -Every Makefile should also define variables @code{INSTALL_PROGRAM} and -@code{INSTALL_DATA}. (The default for each of these should be +Every Makefile should also define the variables @code{INSTALL_PROGRAM} +and @code{INSTALL_DATA}. (The default for each of these should be @code{$(INSTALL)}.) Then it should use those variables as the commands for actual installation, for executables and nonexecutables respectively. Use these variables as follows: @@ -358,7 +385,7 @@ (at least for now). @item exec_prefix -A prefix used in constructing the default values of the some of the +A prefix used in constructing the default values of some of the variables listed below. The default value of @code{exec_prefix} should be @code{$(prefix)}. @@ -422,14 +449,15 @@ @file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo package. -The way to tell whether @file{foo.h} came from the Foo package is to put -a magic string in the file---part of a comment---and grep for that -string. +To tell whether @file{foo.h} came from the Foo package, put a magic +string in the file---part of a comment---and grep for that string. @item mandir The directory for installing the man pages (if any) for this package. It should include the suffix for the proper section of the -manual---usually @samp{1} for a utility. +manual---usually @samp{1} for a utility. It will normally be +@file{/usr/local/man/man1}, but you should write it as +@file{$(prefix)/man/man1}. @item man1dir The directory for installing section 1 man pages. @@ -446,10 +474,18 @@ @item manext The file name extension for the installed man page. This should contain -a period followed by the appropriate digit. +a period followed by the appropriate digit; it should normally be @samp{.1}. +@item man1ext +The file name extension for installed section 1 man pages. +@item man2ext +The file name extension for installed section 2 man pages. +@item @dots{} +Use these names instead of @samp{manext} if the package needs to install man +pages in more than one section of the manual. + @item infodir -The directory for installing the info files for this package. By +The directory for installing the Info files for this package. By default, it should be @file{/usr/local/info}, but it should be written as @file{$(prefix)/info}. @@ -460,7 +496,7 @@ For example: -@example +@smallexample @c I have changed some of the comments here slightly to fix an overfull @c hbox, so the make manual can format correctly. --roland # Common prefix for installation directories. @@ -473,7 +509,7 @@ libdir = $(exec_prefix)/lib # Where to put the Info files. infodir = $(prefix)/info -@end example +@end smallexample If your program installs a large number of files into one of the standard user-specified directories, it might be useful to group them diff -ruN make-3.67/make.h make-3.68/make.h --- make-3.67/make.h Fri May 14 16:40:38 1993 +++ make-3.68/make.h Fri Jul 23 16:04:37 1993 @@ -55,9 +55,10 @@ #endif #endif -#ifdef butterfly -/* The BBN Butterfly has that defines _POSIX_VERSION, - but isn't really a POSIX.1 system. */ +/* Some systems define _POSIX_VERSION but are not really POSIX.1. */ +#if (defined (butterfly) || \ + (defined (__mips) && defined (_SYSTYPE_SVR3)) || \ + (defined (sequent) && defined (i386))) #undef POSIX #endif @@ -121,7 +122,7 @@ #define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX) #endif -#ifdef uts +#ifdef STAT_MACROS_BROKEN #ifdef S_ISREG #undef S_ISREG #endif @@ -128,7 +129,7 @@ #ifdef S_ISDIR #undef S_ISDIR #endif -#endif /* uts. */ +#endif /* STAT_MACROS_BROKEN. */ #ifndef S_ISREG #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) @@ -306,7 +307,7 @@ extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag; extern int debug_flag, print_data_base_flag, question_flag, touch_flag; extern int env_overrides, no_builtin_rules_flag, print_version_flag; -extern int print_directory_flag; +extern int print_directory_flag, warn_undefined_variables_flag; extern unsigned int job_slots; extern double max_load_average; diff -ruN make-3.67/make.texinfo make-3.68/make.texinfo --- make-3.67/make.texinfo Sun May 16 20:24:00 1993 +++ make-3.68/make.texinfo Mon Jul 26 15:10:51 1993 @@ -7,14 +7,14 @@ @c For publication, format makebook.texi instead of using this file directly. -@set EDITION 0.42 -@set VERSION 3.66 Beta -@set UPDATED 14 May 1993 -@set UPDATE-MONTH May 1993 +@set EDITION 0.43 +@set VERSION 3.68 Beta +@set UPDATED 26 July 1993 +@set UPDATE-MONTH July 1993 @c finalout -@c ISPELL CHECK: done, 14 Jan 1993 --bob +@c ISPELL CHECK: done, 10 June 1993 --roland @c Combine the variable and function indices: @syncodeindex vr fn @@ -43,17 +43,14 @@ @end ignore Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that the text of the translations of the section -entitled ``GNU General Public License'' must be approved for accuracy -by the Foundation. +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Free Software Foundation. @end ifinfo @iftex @@ -64,7 +61,7 @@ @subtitle A Program for Directing Recompilation @subtitle Edition @value{EDITION}, for @code{make} Version @value{VERSION}. @subtitle @value{UPDATE-MONTH} -@author by Richard M. Stallman and Roland McGrath +@author Richard M. Stallman and Roland McGrath @page @vskip 0pt plus 1filll Copyright @copyright{} 1988, '89, '90, '91, '92, '93 Free Software Foundation, Inc. @@ -72,7 +69,8 @@ Published by the Free Software Foundation @* 675 Massachusetts Avenue, @* Cambridge, MA 02139 USA @* -Printed copies are available for $20 each. +Printed copies are available for $20 each. @* +ISBN 1-882114-16-7 @* Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -79,17 +77,14 @@ are preserved on all copies. Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that -the section entitled ``GNU General Public License'' is included exactly as in -the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that the text of the translation of the section -entitled ``GNU General Public License'' must be approved for accuracy by the -Foundation. +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Free Software Foundation. @sp 2 Cover art by Etienne Suvasa. @end titlepage @@ -96,7 +91,7 @@ @page @ifinfo -@node Top, Copying, (dir), (dir) +@node Top, Overview, (dir), (dir) @top Make The GNU @code{make} utility automatically determines which pieces of a @@ -111,7 +106,6 @@ @end ifinfo @menu -* Copying:: * Overview:: Overview of @code{make}. * Introduction:: An introduction to @code{make}. * Makefiles:: Makefiles tell @code{make} what to do. @@ -317,10 +311,7 @@ * Archive Symbols:: How to update archive symbol directories. @end menu -@node Copying, Overview, Top, Top -@include gpl.texinfo - -@node Overview, Introduction, Copying, Top +@node Overview, Introduction, Top, Top @comment node-name, next, previous, up @chapter Overview of @code{make} @@ -1039,7 +1030,7 @@ @cindex @code{--makefile} If you want to use a nonstandard name for your makefile, you can specify the makefile name with the @samp{-f} or @samp{--file} option. The -arguments @w{@samp{-f @var{name}}} or @w{@samp{--file @var{name}}} tell +arguments @w{@samp{-f @var{name}}} or @w{@samp{--file=@var{name}}} tell @code{make} to read the file @var{name} as the makefile. If you use more than one @samp{-f} or @samp{--file} option, you can specify several makefiles. All the makefiles are effectively concatenated in the order @@ -1140,6 +1131,17 @@ Only after it has tried to find a way to remake a makefile and failed, will @code{make} diagnose the missing makefile as a fatal error. +If you want @code{make} to simply ignore a makefile which does not exist +and cannot be remade, with no error message, use the @w{@code{-include}} +directive instead of @code{include}, like this: + +@example +-include @var{filenames}@dots{} +@end example + +This is acts like @code{include} in every way except that there is no +error (not even a warning) if any of the @var{filenames} do not exist. + @node MAKEFILES Variable, Remaking Makefiles, Include, Makefiles @section The Variable @code{MAKEFILES} @cindex makefile, and @code{MAKEFILES} variable @@ -1406,7 +1408,7 @@ appear on the same line, with a semicolon. Either way, the effect is the same. @xref{Commands, ,Writing the Commands in Rules}. -@cindex dollar sign (@code{$}) in rules +@cindex dollar sign (@code{$}), in rules @cindex @code{$}, in rules @cindex rule, and @code{$} Because dollar signs are used to start variable references, if you really @@ -1850,11 +1852,11 @@ (@pxref{Implicit Rules, ,Using Implicit Rules}). For example, when a file @file{foo.o} has no explicit rule, @code{make} -considers implicit rules such as to compile @file{foo.c} if that file -exists. If such a file is lacking in the current directory, the -appropriate directories are searched for it. If @file{foo.c} exists (or is -mentioned in the makefile) in any of the directories, the implicit rule for -C compilation is applied. +considers implicit rules, such as the built-in rule to compile +@file{foo.c} if that file exists. If such a file is lacking in the +current directory, the appropriate directories are searched for it. If +@file{foo.c} exists (or is mentioned in the makefile) in any of the +directories, the implicit rule for C compilation is applied. The commands of implicit rules normally use automatic variables as a matter of necessity; consequently they will use the file names found by @@ -2127,8 +2129,8 @@ You can also list the target pattern of an implicit rule (such as @samp{%.o}) as a dependency file of the special target @code{.PRECIOUS} -to preserve intermediate files whose target patterns match that file's -name. +to preserve intermediate files created by rules whose target patterns +match that file's name. @findex .IGNORE @item .IGNORE @@ -2406,11 +2408,11 @@ @end example @noindent -Here the result of @samp{$(filter %.o,$(files))} is @file{bar.o lose.o}, -and the first static pattern rule causes each of these object files to -be updated by compiling the corresponding C source file. The result of -@w{@samp{$(filter %.elc,$(files))}} is @file{foo.elc}, so that file is -made from @file{foo.el}.@refill +In this example the result of @samp{$(filter %.o,$(files))} is +@file{bar.o lose.o}, and the first static pattern rule causes each of +these object files to be updated by compiling the corresponding C source +file. The result of @w{@samp{$(filter %.elc,$(files))}} is +@file{foo.elc}, so that file is made from @file{foo.el}.@refill Another example shows how to use @code{$*} in static pattern rules: @vindex $*@r{, and static pattern} @@ -3093,7 +3095,8 @@ 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. +The special variables @code{SHELL} and @code{MAKEFLAGS} are always +exported (unless you unexport them). @code{MAKEFILES} is exported if you set it to anything. Variables are @emph{not} normally passed down if they were created by @@ -3526,6 +3529,9 @@ sub-@code{make} (@pxref{Variables/Recursion, ,Communicating Variables to a Sub-@code{make}}). +Variable names are case-sensitive. The names @samp{foo}, @samp{FOO}, +and @samp{Foo} all refer to different variables. + It is traditional to use upper case letters in variable names, but we recommend using lower case letters for variable names that serve internal purposes in the makefile, and reserving upper case for parameters that @@ -4162,8 +4168,10 @@ specify. @example +@group variable = value variable += more +@end group @end example @noindent @@ -4170,8 +4178,10 @@ is roughly equivalent to: @example +@group temp = value variable = $(temp) more +@end group @end example @noindent @@ -4201,15 +4211,16 @@ @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. +This is pretty 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 @@ -4662,7 +4673,7 @@ @node Functions, Running, Conditionals, Top @chapter Functions for Transforming Text -@cindex function +@cindex functions @dfn{Functions} allow you to do text processing in the makefile to compute the files to operate on or the commands to use. You use a function in a @@ -4860,9 +4871,9 @@ single space. Thus, @samp{$(strip a b c )} results in @w{@samp{a b c}}. The function @code{strip} can be very useful when used in conjunction -with conditionals. When comparing something with the null string -@samp{""} using @code{ifeq} or @code{ifneq}, you usually want a string -of just whitespace to match the null string (@pxref{Conditionals}). +with conditionals. When comparing something with the empty string +@samp{} using @code{ifeq} or @code{ifneq}, you usually want a string of +just whitespace to match the empty string (@pxref{Conditionals}). Thus, the following may fail to have the desired results: @@ -5440,8 +5451,8 @@ @noindent sets @code{files} to the expansion of @samp{*.c}. Unless @code{make} is -using a very strange shell, this has the same result as @samp{$(wildcard -*.c)}.@refill +using a very strange shell, this has the same result as +@w{@samp{$(wildcard *.c)}}.@refill @node Running, Implicit Rules, Functions, Top @chapter How to Run @code{make} @@ -5649,10 +5660,10 @@ are up to date already; but execute no commands in either case. In other words, neither compilation nor output will occur. -@item -W -@itemx --what-if -@itemx --assume-new -@itemx --new-file +@item -W @var{file} +@itemx --what-if=@var{file} +@itemx --assume-new=@var{file} +@itemx --new-file=@var{file} @cindex @code{--what-if} @cindex @code{-W} @cindex @code{--assume-new} @@ -5875,7 +5886,7 @@ @item -C @var{dir} @cindex @code{-C} -@itemx --directory @var{dir} +@itemx --directory=@var{dir} @cindex @code{--directory} Change to directory @var{dir} before reading the makefiles. If multiple @samp{-C} options are specified, each is interpreted relative to the @@ -5906,9 +5917,9 @@ @item -f @var{file} @cindex @code{-f} -@itemx --file @var{file} +@itemx --file=@var{file} @cindex @code{--file} -@itemx --makefile @var{file} +@itemx --makefile=@var{file} @cindex @code{--makefile} Read the file named @var{file} as a makefile. @xref{Makefiles, ,Writing Makefiles}. @@ -5930,7 +5941,7 @@ @item -I @var{dir} @cindex @code{-I} -@itemx --include-dir @var{dir} +@itemx --include-dir=@var{dir} @cindex @code{--include-dir} Specifies a directory @var{dir} to search for included makefiles. @xref{Include, ,Including Other Makefiles}. If several @samp{-I} @@ -5939,7 +5950,7 @@ @item -j [@var{jobs}] @cindex @code{-j} -@itemx --jobs [@var{jobs}] +@itemx --jobs=[@var{jobs}] @cindex @code{--jobs} Specifies the number of jobs (commands) to run simultaneously. With no argument, @code{make} runs as many jobs simultaneously as possible. If @@ -5958,12 +5969,12 @@ @item -l [@var{load}] @cindex @code{-l} -@itemx --load-average [@var{load}] +@itemx --load-average[=@var{load}] @cindex @code{--load-average} -@itemx --max-load [@var{load}] +@itemx --max-load[=@var{load}] @cindex @code{--max-load} Specifies that no new jobs (commands) should be started if there are -others jobs running and the load average is at least @var{load} (a +other jobs running and the load average is at least @var{load} (a floating-point number). With no argument, removes a previous load limit. @xref{Parallel, ,Parallel Execution}. @@ -5982,9 +5993,9 @@ @item -o @var{file} @cindex @code{-o} -@itemx --old-file @var{file} +@itemx --old-file=@var{file} @cindex @code{--old-file} -@itemx --assume-old @var{file} +@itemx --assume-old=@var{file} @cindex @code{--assume-old} Do not remake the file @var{file} even if it is older than its dependencies, and do not remake anything on account of changes in @@ -6085,11 +6096,11 @@ @item -W @var{file} @cindex @code{-W} -@itemx --what-if @var{file} +@itemx --what-if=@var{file} @cindex @code{--what-if} -@itemx --new-file @var{file} +@itemx --new-file=@var{file} @cindex @code{--new-file} -@itemx --assume-new @var{file} +@itemx --assume-new=@var{file} @cindex @code{--assume-new} Pretend that the target @var{file} has just been modified. When used with the @samp{-n} flag, this shows you what would happen if you were @@ -6098,6 +6109,14 @@ @code{make}, except that the modification time is changed only in the imagination of @code{make}. @xref{Instead of Execution, ,Instead of Executing the Commands}. + +@item --warn-undefined-variables +@cindex @code{--warn-undefined-variables} +@cindex variables, warning for undefined +@cindex undefined variables, warning message +Issue a warning message whenever @code{make} sees a reference to an +undefined variable. This can be helpful when you are trying to debug +makefiles which use variables in complex ways. @end table @node Implicit Rules, Archives, Running, Top @@ -6246,22 +6265,23 @@ 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{.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. +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{.w}, @code{.ch} @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 @@ -6350,9 +6370,11 @@ @item Linking a single object file @cindex linking, predefined rule for -@file{@var{n}} is made automatically from @file{@var{n}.o} by -running the linker @code{ld} via the C compiler. The precise command -used is @w{@samp{$(CC) $(LDFLAGS) @var{n}.o $(LOADLIBES)}}.@refill +@pindex ld +@pindex .o +@file{@var{n}} is made automatically from @file{@var{n}.o} by running +the linker (usually called @code{ld}) via the C compiler. The precise +command used is @w{@samp{$(CC) $(LDFLAGS) @var{n}.o $(LOADLIBES)}}. This rule does the right thing for a simple program with only one source file. It will also do the right thing if there are multiple @@ -6431,8 +6453,8 @@ @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}}. +@file{@var{n}.ln} is made from @file{@var{n}.c} by running @code{lint}. +The precise command is @w{@samp{$(LINT) $(LINTFLAGS) $(CPPFLAGS) -i}}. The same command is used on the C code produced from @file{@var{n}.y} or @file{@var{n}.l}.@refill @@ -6447,13 +6469,15 @@ @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} -with @samp{$(CWEAVE)}. @file{@var{n}.p} is made from -@file{@var{n}.web} with @samp{$(TANGLE)} and @file{@var{n}.c} is -made from @file{@var{n}.cweb} with @samp{$(CTANGLE)}.@refill +@pindex .w +@pindex .ch +@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}.w} (and from @file{@var{n}.ch} if +it exists or can be made) with @samp{$(CWEAVE)}. @file{@var{n}.p} is +made from @file{@var{n}.web} with @samp{$(TANGLE)} and @file{@var{n}.c} +is made from @file{@var{n}.w} (and from @file{@var{n}.ch} if it exists +or can be made) with @samp{$(CTANGLE)}.@refill @item Texinfo and Info @cindex Texinfo, rule to format @@ -6744,7 +6768,7 @@ used. Ultimately both @file{@var{n}.c} and @file{@var{n}.o} are updated.@refill -@cindex intermediate file +@cindex intermediate files @cindex files, intermediate However, even if @file{@var{n}.c} does not exist and is not mentioned, @code{make} knows how to envision it as the missing link between @@ -6766,7 +6790,7 @@ see @ref{Interrupts}.)@refill @cindex intermediate files, preserving @cindex preserving intermediate files -@cindex preserving with .PRECIOUS +@cindex preserving with @code{.PRECIOUS} @cindex @code{.PRECIOUS} intermediate files A chain can involve more than two implicit rules. For example, it is @@ -6781,7 +6805,7 @@ search for an implicit rule chain. There are some special implicit rules to optimize certain cases that would -otherwise by handled by rule chains. For example, making @file{foo} from +otherwise be handled by rule chains. For example, making @file{foo} from @file{foo.c} could be handled by compiling and linking with separate chained rules, using @file{foo.o} as an intermediate file. But what actually happens is that a special rule for this case does the compilation @@ -6859,8 +6883,6 @@ attaches to every file made by this pattern rule. These unvarying dependencies are useful occasionally. -@c !!! The following sentence should be rewritten. --bob -@c rewritten by roland; does it win now? A pattern rule need not have any dependencies that contain @samp{%}, or in fact any dependencies at all. Such a rule is effectively a general wildcard. It provides a way to make any file that matches the target @@ -7449,7 +7471,7 @@ @item For each pattern rule in the list: -@enumerate +@enumerate a @item Find the stem @var{s}, which is the nonempty part of @var{t} or @var{n} matched by the @samp{%} in the target pattern.@refill @@ -7472,7 +7494,7 @@ If no pattern rule has been found so far, try harder. For each pattern rule in the list: -@enumerate +@enumerate a @item If the rule is terminal, ignore it and go on to the next rule. @@ -7555,6 +7577,27 @@ In fact, nearly all archive member targets are updated in just this way and there is an implicit rule to do it for you. +To specify several members in the same archive, you can write all the +member names together between the parentheses. For example: + +@example +foolib(hack.o kludge.o) +@end example + +@noindent +is equivalent to: + +@example +foolib(hack.o) foolib(kludge.o) +@end example + +@cindex wildcard, in archive member +You can also use shell-style wildcards in an archive member reference. +@xref{Wildcards, ,Using Wildcard Characters in File Names}. For +example, @w{@samp{foolib(*.o)}} expands to all existing members of the +@file{foolib} archive whose names end in @samp{.o}; perhaps +@samp{@w{foolib(hack.o)} @w{foolib(kludge.o)}}. + @node Archive Update, Archive Suffix Rules, Archive Members, Archives @section Implicit Rule for Archive Member Targets @@ -7690,6 +7733,12 @@ @w{@samp{.@var{x}.a}} is converted to a pattern rule with the target pattern @samp{(%.o)} and a dependency pattern of @samp{%.@var{x}}. +Since you might want to use @samp{.a} as the suffix for some other kind +of file, @code{make} also converts archive suffix rules to pattern rules +in the normal way (@pxref{Suffix Rules}). Thus a double-suffix rule +@w{@samp{.@var{x}.a}} produces two pattern rules: @samp{@w{(%.o):} +@w{%.@var{x}}} and @samp{@w{%.a}: @w{%.@var{x}}}.@refill + @node Features, Missing, Archives, Top @chapter Features of GNU @code{make} @cindex features of GNU @code{make} @@ -7800,21 +7849,33 @@ @item Modified variable references using pattern substitution come from -SunOS 4.0. @xref{Reference, ,Basics of Variable References}. +SunOS 4. @xref{Reference, ,Basics of Variable References}. This functionality was provided in GNU @code{make} by the @code{patsubst} function before the alternate syntax was implemented -for compatibility with SunOS 4.0. It is not altogether clear who +for compatibility with SunOS 4. It is not altogether clear who inspired whom, since GNU @code{make} had @code{patsubst} before SunOS -4.0 was released.@refill +4 was released.@refill @item 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 +mandated by +@cite{IEEE Standard 1003.2-1992} (POSIX.2). @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}. +4 @code{make}. @xref{Appending, , Appending More Text to Variables}. + +@item +The syntax @w{@samp{@var{archive}(@var{mem1} @var{mem2}@dots{})}} to list +multiple members in a single archive file comes from SunOS 4 @code{make}. +@xref{Archive Members}. + +@item +The @code{-include} directive to include makefiles with no error for a +nonexistent file comes from SunOS 4 @code{make}. (But note that SunOS 4 +@code{make} does not allow multiple makefiles to be specified in one +@code{-include} directive.) @end itemize The remaining features are inventions new in GNU @code{make}: @@ -7829,7 +7890,7 @@ @code{make}. @item -Simply-expand variables. @xref{Flavors, ,The Two Flavors of Variables}. +Simply-expanded variables. @xref{Flavors, ,The Two Flavors of Variables}. @item Pass command-line variable assignments automatically through the @@ -7869,12 +7930,12 @@ revolutionary concept. @xref{Conditionals, ,Conditional Parts of Makefiles}. @item -Specify the included makefile search path. @xref{Include, ,Including -Other Makefiles}. +Specify a search path for included makefiles. +@xref{Include, ,Including Other Makefiles}. @item -Specify extra makefiles to read. @xref{MAKEFILES Variable, ,The -Variable @code{MAKEFILES}}. +Specify extra makefiles to read with an environment variable. +@xref{MAKEFILES Variable, ,The Variable @code{MAKEFILES}}. @item Strip leading sequences of @samp{./} from file names, so that @@ -7889,7 +7950,7 @@ @item Allow suffixes for suffix rules (@pxref{Suffix Rules, ,Old-Fashioned Suffix Rules}) to contain any -characters. In other version of @code{make}, they must begin with +characters. In other versions of @code{make}, they must begin with @samp{.} and not contain any @samp{/} characters. @item @@ -7924,9 +7985,9 @@ @cindex features, missing The @code{make} programs in various other systems support a few features -that are not implemented in GNU @code{make}. Draft 11.2 of the POSIX.2 -standard which specifies @code{make} does not require any of these -features.@refill +that are not implemented in GNU @code{make}. The POSIX.2 standard +(@cite{IEEE Standard 1003.2-1992}) which specifies @code{make} does not +require any of these features.@refill @itemize @bullet @item @@ -7944,7 +8005,7 @@ have a special meaning to System V @code{make}; they refer to the SCCS file that corresponds to the file one would get without the @samp{~}. For example, the -suffix rule @samp{.c~.o} would make the file @file{@var{n}.o} file from +suffix rule @samp{.c~.o} would make the file @file{@var{n}.o} from the SCCS file @file{s.@var{n}.c}. For complete coverage, a whole series of such suffix rules is required. @xref{Suffix Rules, ,Old-Fashioned Suffix Rules}. @@ -8028,6 +8089,14 @@ @example .c.a: ; @end example + +@item +Some versions of @code{make} invoke the shell with the @samp{-e} flag, +except under @samp{-k} (@pxref{Testing, ,Testing the Compilation of a +Program}). The @samp{-e} flag tells the shell to exit as soon as any +program it runs returns a nonzero status. We feel it is cleaner to +write each shell command line to stand on its own and not require this +special treatment. @end itemize @comment The makefile standards are in a separate file that is also @@ -8040,7 +8109,7 @@ This appendix summarizes the directives, text manipulation functions, and special variables which GNU @code{make} understands. @xref{Special Targets}, @ref{Catalogue of Rules, ,Catalogue of Implicit Rules}, -and @ref{Options Summary, ,Summary of Options}. +and @ref{Options Summary, ,Summary of Options}, for other summaries. Here is a summary of the directives GNU @code{make} recognizes: @@ -8091,22 +8160,18 @@ @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 processes.@* @xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}. @item vpath @var{pattern} @var{path} - Specify a search path for files matching a @samp{%} pattern.@* @xref{Selective Search, , The @code{vpath} Directive}. @item vpath @var{pattern} - Remove all search paths previously specified for @var{pattern}. @item vpath - Remove all search paths previously specified in any @code{vpath} directive. @end table @@ -8115,92 +8180,74 @@ @table @code @item $(subst @var{from},@var{to},@var{text}) - Replace @var{from} with @var{to} in @var{text}.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(patsubst @var{pattern},@var{replacement},@var{text}) - Replace words matching @var{pattern} with @var{replacement} in @var{text}.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(strip @var{string}) - Remove excess whitespace characters from @var{string}.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(findstring @var{find},@var{text}) - Locate @var{find} in @var{text}.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(filter @var{pattern}@dots{},@var{text}) - Select words in @var{text} that match one of the @var{pattern} words.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(filter-out @var{pattern}@dots{},@var{text}) - Select words in @var{text} that @emph{do not} match any of the @var{pattern} words.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(sort @var{list}) - Sort the words in @var{list} lexicographically, removing duplicates.@* @xref{Text Functions, , Functions for String Substitution and Analysis}. @item $(dir @var{names}@dots{}) - Extract the directory part of each file name.@* @xref{Filename Functions, ,Functions for File Names}. @item $(notdir @var{names}@dots{}) - Extract the non-directory part of each file name.@* @xref{Filename Functions, ,Functions for File Names}. @item $(suffix @var{names}@dots{}) - Extract the suffix (the last @samp{.} and following characters) of each file name.@* @xref{Filename Functions, ,Functions for File Names}. @item $(basename @var{names}@dots{}) - Extract the base name (name without suffix) of each file name.@* @xref{Filename Functions, ,Functions for File Names}. @item $(addsuffix @var{suffix},@var{names}@dots{}) - Append @var{suffix} to each word in @var{names}.@* @xref{Filename Functions, ,Functions for File Names}. @item $(addprefix @var{prefix},@var{names}@dots{}) - Prepend @var{prefix} to each word in @var{names}.@* @xref{Filename Functions, ,Functions for File Names}. @item $(join @var{list1},@var{list2}) - Join two parallel lists of words.@* @xref{Filename Functions, ,Functions for File Names}. @item $(word @var{n},@var{text}) - Extract the @var{n}th word (one-origin) of @var{text}.@* @xref{Filename Functions, ,Functions for File Names}. @item $(words @var{text}) - Count the number of words in @var{text}.@* @xref{Filename Functions, ,Functions for File Names}. @item $(firstword @var{names}@dots{}) - Extract the first word of @var{names}.@* @xref{Filename Functions, ,Functions for File Names}. @item $(wildcard @var{pattern}@dots{}) - Find file names matching a shell file name pattern (@emph{not} a @samp{%} pattern).@* @xref{Wildcard Function, ,The Function @code{wildcard}}. @@ -8427,7 +8474,7 @@ # -DMKDIR_MISSING If you lack mkdir and # rmdir system calls. # -DRENAME_MISSING If you lack rename system call. -# -DFTRUNCATE_MISSING If you lack frtruncate +# -DFTRUNCATE_MISSING If you lack ftruncate # system call. # -DV7 On Version 7 Unix (not # tested in a long time). diff -ruN make-3.67/mkinstalldirs make-3.68/mkinstalldirs --- make-3.67/mkinstalldirs Sat May 22 20:14:19 1993 +++ make-3.68/mkinstalldirs Sun May 23 05:47:16 1993 @@ -7,6 +7,8 @@ ' IFS="${IFS-${defaultIFS}}" +errstatus=0 + for file in ${1+"$@"} ; do oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. @@ -13,21 +15,21 @@ IFS='%' set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" - test ".${1}" = "." && shift pathcomp='' - while test $# -ne 0 ; do - pathcomp="${pathcomp}${1}" - shift + for d in ${1+"$@"} ; do + pathcomp="${pathcomp}${d}" if test ! -d "${pathcomp}"; then echo "mkdir $pathcomp" 1>&2 - mkdir "${pathcomp}" + mkdir "${pathcomp}" || errstatus=$? fi pathcomp="${pathcomp}/" done done + +exit $errstatus # eof diff -ruN make-3.67/read.c make-3.68/read.c --- make-3.67/read.c Wed May 19 17:15:51 1993 +++ make-3.68/read.c Wed Jul 14 22:25:00 1993 @@ -122,10 +122,20 @@ default makefiles and don't let the default goal come from there. */ { - char *value = allocated_variable_expand ("$(MAKEFILES)"); + char *value; char *name, *p; unsigned int length; + { + /* Turn off --warn-undefined-variables while we expand MAKEFILES. */ + int save = warn_undefined_variables_flag; + warn_undefined_variables_flag = 0; + + value = allocated_variable_expand ("$(MAKEFILES)"); + + warn_undefined_variables_flag = save; + } + /* Set NAME to the start of next token and LENGTH to its length. MAKEFILES is updated for finding remaining tokens. */ p = value; @@ -133,7 +143,7 @@ { if (*p != '\0') *p++ = '\0'; - read_makefile (name, 1); + read_makefile (name, RM_NO_DEFAULT_GOAL | RM_INCLUDED | RM_DONTCARE); } free (value); @@ -155,7 +165,6 @@ d = d->next; /* Use the storage read_makefile allocates. */ - free (*makefiles); *makefiles = dep_name (d); ++num_makefiles; ++makefiles; @@ -184,10 +193,9 @@ d->name = 0; d->file = enter_file (*p); d->file->dontcare = 1; - /* Setting the `changed' member to 1 will make failure to - update or find this makefile as if it had come from the - MAKEFILES variable: we don't care, so we won't die. */ - d->changed = 1; + /* Tell update_goal_chain to bail out as soon as this file is + made, and main not to die if we can't make this file. */ + d->changed = RM_DONTCARE; if (tail == 0) read_makefiles = d; else @@ -204,18 +212,14 @@ /* Read file FILENAME as a makefile and add its contents to the data base. - TYPE indicates what flavor of makefile this is: 0 => a default or -f - makefile (the basis for comparison); 1 => from the MAKEFILES variable: - cannot determine the default goal, is searched for in the search path, - and it's not an error if it doesn't exist; 2 => an included makefile: - is searched for in the search path. + FLAGS contains bits as above. FILENAME is added to the `read_makefiles' chain. */ static void -read_makefile (filename, type) +read_makefile (filename, flags) char *filename; - int type; + int flags; { static char *collapsed = 0; static unsigned int collapsed_length = 0; @@ -245,7 +249,8 @@ if (filenames != 0) \ record_files (filenames, pattern, pattern_percent, deps, \ commands_started, commands, commands_idx, \ - two_colon, filename, lineno, type != 1); \ + two_colon, filename, lineno, \ + !(flags & RM_NO_DEFAULT_GOAL)); \ filenames = 0; \ commands_idx = 0; \ pattern = 0; \ @@ -257,15 +262,25 @@ /* First, get a stream to read. */ + /* Expand ~ in FILENAME unless it came from `include', + in which case it was already done. */ + if (!(flags & RM_NO_TILDE) && filename[0] == '~') + { + char *expanded = tilde_expand (filename); + /* This is a possible memory leak, but I don't care. */ + if (expanded != 0) + filename = expanded; + } + infile = fopen (filename, "r"); /* Save the error code so we print the right message later. */ makefile_errno = errno; /* If the makefile wasn't found and it's either a makefile from - the `MAKEFILES' variable (type 1) or an included makefile (type 2), + the `MAKEFILES' variable or an included makefile, search the included makefile search path for this makefile. */ - if (infile == 0 && (type == 1 || type == 2) && *filename != '/') + if (infile == 0 && (flags & RM_INCLUDED) && *filename != '/') { register unsigned int i; for (i = 0; include_directories[i] != 0; ++i) @@ -291,12 +306,12 @@ if (deps->file == 0) { deps->file = enter_file (savestring (filename, strlen (filename))); - if (type == 1) + if (flags & RM_DONTCARE) deps->file->dontcare = 1; } filename = deps->file->name; deps->file->precious = 1; - deps->changed = type; + deps->changed = flags; deps = 0; /* If the makefile can't be found at all, @@ -304,7 +319,7 @@ if (infile == 0) { - if (type != 1) + if (! (flags & RM_DONTCARE)) { /* If we did some searching, errno has the error from the last attempt, rather from FILENAME itself. */ @@ -488,17 +503,22 @@ v->export = v_noexport; } } - else if (word1eq ("include", 7)) + else if (word1eq ("include", 7) || word1eq ("-include", 8)) { /* We have found an `include' line specifying a nested makefile to be read at this point. */ struct conditionals *save, new_conditionals; struct nameseq *files; + /* "-include" (vs "include") says no + error if the file does not exist. */ + int noerror = p[0] == '-'; - p = allocated_variable_expand (next_token (p + 8)); + p = allocated_variable_expand (next_token (p + (noerror ? 9 : 8))); if (*p == '\0') { - makefile_error (filename, lineno, "no file name for `include'"); + makefile_error (filename, lineno, + "no file name for `%sinclude'", + noerror ? "-" : ""); continue; } @@ -528,7 +548,8 @@ free (files); files = next; - read_makefile (name, 2); + read_makefile (name, (RM_INCLUDED | RM_NO_TILDE + | (noerror ? RM_DONTCARE : 0))); } /* Restore state. */ @@ -613,9 +634,9 @@ } filenames = multi_glob (parse_file_seq (&p2, ':', - sizeof (struct nameseq)), - sizeof (struct nameseq), - 1); + sizeof (struct nameseq), + 1), + sizeof (struct nameseq)); if (*p2++ == '\0') makefile_fatal (filename, lineno, "missing separator"); /* Is this a one-colon or two-colon entry? */ @@ -659,9 +680,8 @@ /* Parse the dependencies. */ deps = (struct dep *) - multi_glob (parse_file_seq (&p2, '\0', sizeof (struct dep)), - sizeof (struct dep), - 1); + multi_glob (parse_file_seq (&p2, '\0', sizeof (struct dep), 1), + sizeof (struct dep)); commands_idx = 0; if (cmdleft != 0) @@ -1489,6 +1509,95 @@ new = new1; } +#ifndef NO_ARCHIVES + + /* Look for multi-word archive references. + They are indicated by a elt ending with an unmatched `)' and + an elt further down the chain (i.e., previous in the file list) + with an unmatched `(' (e.g., "lib(mem"). */ + + for (new1 = new; new1 != 0; new1 = new1->next) + if (new1->name[0] != '(' /* Don't catch "(%)" and suchlike. */ + && new1->name[strlen (new1->name) - 1] == ')' + && index (new1->name, '(') == 0) + { + /* NEW1 ends with a `)' but does not contain a `('. + Look back for an elt with an opening `(' but no closing `)'. */ + + struct nameseq *n = new1->next, *lastn = new1; + char *paren; + while (n != 0 && (paren = index (n->name, '(')) == 0) + { + lastn = n; + n = n->next; + } + if (n != 0) + { + /* N is the first element in the archive group. + Its name looks like "lib(mem" (with no closing `)'). */ + + char *libname; + + /* Copy "lib(" into LIBNAME. */ + ++paren; + libname = (char *) alloca (paren - n->name + 1); + bcopy (n->name, libname, paren - n->name); + libname[paren - n->name] = '\0'; + + if (*paren == '\0') + { + /* N was just "lib(", part of something like "lib( a b)". + Edit it out of the chain and free its storage. */ + lastn->next = n->next; + free (n->name); + free ((char *) n); + /* LASTN->next is the new stopping elt for the loop below. */ + n = lastn->next; + } + else + { + /* Replace N's name with the full archive reference. */ + name = concat (libname, paren, ")"); + free (n->name); + n->name = name; + } + + if (new1->name[1] == '\0') + { + /* NEW1 is just ")", part of something like "lib(a b )". + Omit it from the chain and free its storage. */ + lastn = new1; + new1 = new1->next; + if (new == lastn) + new = new1; + free (lastn->name); + free ((char *) lastn); + } + else + { + /* Replace also NEW1->name, which already has closing `)'. */ + name = concat (libname, new1->name, ""); + free (new1->name); + new1->name = name; + new1 = new1->next; + } + + /* Trace back from NEW1 (the end of the list) until N + (the beginning of the list), rewriting each name + with the full archive reference. */ + + while (new1 != n) + { + name = concat (libname, new1->name, ")"); + free (new1->name); + new1->name = name; + new1 = new1->next; + } + } + } + +#endif + *stringp = p; return new; } @@ -1610,6 +1719,14 @@ while (*arg_dirs != 0) { char *dir = *arg_dirs++; + + if (dir[0] == '~') + { + char *expanded = tilde_expand (dir); + if (expanded != 0) + dir = expanded; + } + if (stat (dir, &stbuf) == 0 && S_ISDIR (stbuf.st_mode)) { if (idx == max - 1) @@ -1620,6 +1737,8 @@ } dirs[idx++] = dir; } + else if (dir != arg_dirs[-1]) + free (dir); } /* Now add at the end the standard default dirs. */ @@ -1649,6 +1768,76 @@ include_directories = dirs; } +/* Expand ~ or ~USER at the beginning of NAME. + Return a newly malloc'd string or 0. */ + +char * +tilde_expand (name) + char *name; +{ + if (name[1] == '/' || name[1] == '\0') + { + extern char *getenv (); + char *home_dir; + int is_variable; + + { + /* Turn off --warn-undefined-variables while we expand HOME. */ + int save = warn_undefined_variables_flag; + warn_undefined_variables_flag = 0; + + home_dir = allocated_variable_expand ("$(HOME)"); + + warn_undefined_variables_flag = save; + } + + is_variable = home_dir[0] != '\0'; + if (!is_variable) + { + free (home_dir); + home_dir = getenv ("HOME"); + } + if (home_dir == 0 || home_dir[0] == '\0') + { + extern char *getlogin (); + char *name = getlogin (); + home_dir = 0; + if (name != 0) + { + struct passwd *p = getpwnam (name); + if (p != 0) + home_dir = p->pw_dir; + } + } + if (home_dir != 0) + { + char *new = concat (home_dir, "", name + 1); + if (is_variable) + free (home_dir); + return new; + } + } + else + { + struct passwd *pwent; + char *userend = index (name + 1, '/'); + if (userend != 0) + *userend = '\0'; + pwent = getpwnam (name + 1); + if (pwent != 0) + { + if (userend == 0) + return savestring (pwent->pw_dir, strlen (pwent->pw_dir)); + else + return concat (pwent->pw_dir, "/", userend + 1); + } + else if (userend != 0) + *userend = '/'; + } + + return 0; +} + /* Given a chain of struct nameseq's describing a sequence of filenames, in reverse of the intended order, return a new chain describing the result of globbing the filenames. The new chain is in forward order. @@ -1671,69 +1860,39 @@ for (old = chain; old != 0; old = nexto) { glob_t gl; +#ifndef NO_ARCHIVES + char *memname; +#endif nexto = old->next; if (old->name[0] == '~') { - if (old->name[1] == '/' || old->name[1] == '\0') - { - extern char *getenv (); - char *home_dir = allocated_variable_expand ("$(HOME)"); - int is_variable = home_dir[0] != '\0'; - if (!is_variable) - { - free (home_dir); - home_dir = getenv ("HOME"); - } - if (home_dir == 0 || home_dir[0] == '\0') - { - extern char *getlogin (); - char *name = getlogin (); - home_dir = 0; - if (name != 0) - { - struct passwd *p = getpwnam (name); - if (p != 0) - home_dir = p->pw_dir; - } - } - if (home_dir != 0) - { - char *new = concat (home_dir, "", old->name + 1); - if (is_variable) - free (home_dir); - free (old->name); - old->name = new; - } - } - else + char *newname = tilde_expand (old->name); + if (newname != 0) { - struct passwd *pwent; - char *userend = index (old->name + 1, '/'); - if (userend != 0) - *userend = '\0'; - pwent = getpwnam (old->name + 1); - if (pwent != 0) - { - if (userend == 0) - { - free (old->name); - old->name = savestring (pwent->pw_dir, - strlen (pwent->pw_dir)); - } - else - { - char *new = concat (pwent->pw_dir, "/", userend + 1); - free (old->name); - old->name = new; - } - } - else if (userend != 0) - *userend = '/'; + free (old->name); + old->name = newname; } } +#ifndef NO_ARCHIVES + if (ar_name (old->name)) + { + /* OLD->name is an archive member reference. + Replace it with the archive file name, + and save the member name in MEMNAME. + We will glob on the archive name and then + reattach MEMNAME later. */ + char *arname; + ar_parse_name (old->name, &arname, &memname); + free (old->name); + old->name = arname; + } + else + memname = 0; +#endif + switch (glob (old->name, GLOB_NOCHECK, NULL, &gl)) { case 0: /* Success. */ @@ -1741,11 +1900,52 @@ register int i = gl.gl_pathc; while (i-- > 0) { - struct nameseq *elt = (struct nameseq *) xmalloc (size); - elt->name = savestring (gl.gl_pathv[i], - strlen (gl.gl_pathv[i])); - elt->next = new; - new = elt; +#ifndef NO_ARCHIVES + if (memname != 0) + { + /* Try to glob on MEMNAME within the archive. */ + struct nameseq *found + = ar_glob (gl.gl_pathv[i], memname, size); + if (found == 0) + { + /* No matches. Use MEMNAME as-is. */ + struct nameseq *elt + = (struct nameseq *) xmalloc (size); + unsigned int alen = strlen (gl.gl_pathv[i]); + unsigned int mlen = strlen (memname); + elt->name = (char *) xmalloc (alen + 1 + mlen + 2); + bcopy (gl.gl_pathv[i], elt->name, alen); + elt->name[alen] = '('; + bcopy (memname, &elt->name[alen + 1], mlen); + elt->name[alen + 1 + mlen] = ')'; + elt->name[alen + 1 + mlen + 1] = '\0'; + elt->next = new; + new = elt; + } + else + { + /* Find the end of the FOUND chain. */ + struct nameseq *f = found; + while (f->next != 0) + f = f->next; + + /* Attach the chain being built to the end of the FOUND + chain, and make FOUND the new NEW chain. */ + f->next = new; + new = found; + } + + free (memname); + } + else +#endif + { + struct nameseq *elt = (struct nameseq *) xmalloc (size); + elt->name = savestring (gl.gl_pathv[i], + strlen (gl.gl_pathv[i])); + elt->next = new; + new = elt; + } } globfree (&gl); free (old->name); diff -ruN make-3.67/rule.c make-3.68/rule.c --- make-3.67/rule.c Thu Apr 15 18:29:57 1993 +++ make-3.68/rule.c Thu Jul 8 21:22:33 1993 @@ -37,6 +37,10 @@ unsigned int num_pattern_rules; +/* Maximum number of target patterns of any pattern rule. */ + +unsigned int max_pattern_targets; + /* Maximum number of dependencies of any pattern rule. */ unsigned int max_pattern_deps; @@ -66,8 +70,9 @@ unsigned int namelen; register struct rule *rule, *lastrule; - num_pattern_rules = 0; - + num_pattern_rules = max_pattern_targets = max_pattern_deps = 0; + max_pattern_dep_length = 0; + name = 0; namelen = 0; rule = pattern_rules; @@ -77,9 +82,17 @@ unsigned int ndeps = 0; register struct dep *dep; struct rule *next = rule->next; - + unsigned int ntargets; + ++num_pattern_rules; + ntargets = 0; + while (rule->targets[ntargets] != 0) + ++ntargets; + + if (ntargets > max_pattern_targets) + max_pattern_targets = ntargets; + for (dep = rule->deps; dep != 0; dep = dep->next) { unsigned int len = strlen (dep->name); @@ -140,6 +153,57 @@ free (name); } +/* Create a pattern rule from a suffix rule. + TARGET is the target suffix; SOURCE is the source suffix. + CMDS are the commands. + If TARGET is nil, it means the target pattern should be `(%.o)'. + If SOURCE is nil, it means there should be no deps. */ + +static void +convert_suffix_rule (target, source, cmds) + char *target, *source; + struct commands *cmds; +{ + char *targname, *depname; + char **names, **percents; + struct dep *deps; + unsigned int len; + + if (target == 0) + /* Special case: TARGET being nil means we are defining a + `.X.a' suffix rule; the target pattern is always `(%.o)'. */ + targname = savestring ("(%.o)", 5); + else + { + /* Construct the target name. */ + len = strlen (target); + targname = xmalloc (1 + len + 1); + targname[0] = '%'; + bcopy (target, targname + 1, len + 1); + } + + names = (char **) xmalloc (2 * sizeof (char *)); + percents = (char **) alloca (2 * sizeof (char *)); + names[0] = percents[0] = targname; + names[1] = percents[1] = 0; + + if (source == 0) + deps = 0; + else + { + /* Construct the dependency name. */ + len = strlen (source); + depname = xmalloc (1 + len + 1); + depname[0] = '%'; + bcopy (source, depname + 1, len + 1); + deps = (struct dep *) xmalloc (sizeof (struct dep)); + deps->next = 0; + deps->name = depname; + } + + create_pattern_rule (names, percents, 0, deps, cmds, 0); +} + /* Convert old-style suffix rules to pattern rules. All rules for the suffixes on the .SUFFIXES list are converted and added to the chain of pattern rules. */ @@ -147,11 +211,10 @@ void convert_to_pattern () { - register struct dep *d, *d2, *newd; + register struct dep *d, *d2; register struct file *f; register char *rulename; register unsigned int slen, s2len; - register char *name, **names; /* Compute maximum length of all the suffixes. */ @@ -169,35 +232,15 @@ { /* Make a rule that is just the suffix, with no deps or commands. This rule exists solely to disqualify match-anything rules. */ - slen = strlen (dep_name (d)); - name = (char *) xmalloc (1 + slen + 1); - name[0] = '%'; - bcopy (dep_name (d), name + 1, slen + 1); - names = (char **) xmalloc (2 * sizeof (char *)); - names[0] = name; - names[1] = 0; - create_pattern_rule (names, (char **) 0, 0, (struct dep *) 0, - (struct commands *) 0, 0); + convert_suffix_rule (dep_name (d), (char *) 0, (struct commands *) 0); f = d->file; if (f->cmds != 0) - { - /* Record a pattern for this suffix's null-suffix rule. */ - newd = (struct dep *) xmalloc (sizeof (struct dep)); - /* Construct this again rather than using the contents - of NAME (above), since that may have been freed by - create_pattern_rule. */ - newd->name = (char *) xmalloc (1 + slen + 1); - newd->name[0] = '%'; - bcopy (dep_name (d), newd->name + 1, slen + 1); - newd->next = 0; - names = (char **) xmalloc (2 * sizeof (char *)); - names[0] = savestring ("%", 1); - names[1] = 0; - create_pattern_rule (names, (char **) 0, 0, newd, f->cmds, 0); - } + /* Record a pattern for this suffix's null-suffix rule. */ + convert_suffix_rule ("", dep_name (d), f->cmds); /* Record a pattern for each of this suffix's two-suffix rules. */ + slen = strlen (dep_name (d)); bcopy (dep_name (d), rulename, slen); for (d2 = suffix_file->deps; d2 != 0; d2 = d2->next) { @@ -212,27 +255,15 @@ continue; if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a') - /* The suffix rule `.X.a:' is converted - to the pattern rule `(%.o): %.X'. */ - name = savestring ("(%.o)", 5); - else - { - /* The suffix rule `.X.Y:' is converted - to the pattern rule `%.Y: %.X'. */ - name = (char *) xmalloc (1 + s2len + 1); - name[0] = '%'; - bcopy (dep_name (d2), name + 1, s2len + 1); - } - names = (char **) xmalloc (2 * sizeof (char *)); - names[0] = name; - names[1] = 0; - newd = (struct dep *) xmalloc (sizeof (struct dep)); - newd->next = 0; - /* Construct this again (see comment above). */ - newd->name = (char *) xmalloc (1 + slen + 1); - newd->name[0] = '%'; - bcopy (dep_name (d), newd->name + 1, slen + 1); - create_pattern_rule (names, (char **) 0, 0, newd, f->cmds, 0); + /* A suffix rule `.X.a:' generates the pattern rule `(%.o): %.X'. + It also generates a normal `%.a: %.X' rule below. */ + convert_suffix_rule ((char *) 0, /* Indicates `(%.o)'. */ + dep_name (d), + f->cmds); + + /* The suffix rule `.X.Y:' is converted + to the pattern rule `%.Y: %.X'. */ + convert_suffix_rule (dep_name (d2), dep_name (d), f->cmds); } } } @@ -352,9 +383,8 @@ ptr = p->dep; r->deps = (struct dep *) multi_glob (parse_file_seq (&ptr, '\0', - sizeof (struct dep)), - sizeof (struct dep), - 1); + sizeof (struct dep), 1), + sizeof (struct dep)); if (new_pattern_rule (r, 0)) { diff -ruN make-3.67/rule.h make-3.68/rule.h --- make-3.67/rule.h Sun Feb 21 16:56:09 1993 +++ make-3.68/rule.h Wed Jun 30 18:42:37 1993 @@ -41,6 +41,7 @@ extern unsigned int num_pattern_rules; extern unsigned int max_pattern_deps; +extern unsigned int max_pattern_targets; extern unsigned int max_pattern_dep_length; extern struct file *suffix_file; diff -ruN make-3.67/signame.c make-3.68/signame.c --- make-3.67/signame.c Sun Feb 21 14:53:02 1993 +++ make-3.68/signame.c Mon Jul 26 16:20:42 1993 @@ -251,7 +251,7 @@ return -1; } -#ifndef HAVE_SYS_SIGLIST +#ifndef HAVE_PSIGNAL /* Print to standard error the name of SIGNAL, preceded by MESSAGE and a colon, and followed by a newline. */ diff -ruN make-3.67/signame.h make-3.68/signame.h --- make-3.67/signame.h Fri Jan 22 14:46:32 1993 +++ make-3.68/signame.h Mon Jul 26 16:20:46 1993 @@ -31,7 +31,7 @@ /* Avoid conflicts with a system header file that might define these two. */ -#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_PSIGNAL) +#ifndef HAVE_PSIGNAL /* Print to standard error the name of SIGNAL, preceded by MESSAGE and a colon, and followed by a newline. */ void psignal (int signal, const char *message); diff -ruN make-3.67/texinfo.tex make-3.68/texinfo.tex --- make-3.67/texinfo.tex Sun May 9 10:33:22 1993 +++ make-3.68/texinfo.tex Tue Jul 27 12:50:36 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.108} +\def\texinfoversion{2.112} \message{Loading texinfo package [Version \texinfoversion]:} % Print the version number if in a .fmt file. @@ -679,6 +679,11 @@ \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont \let\tensf = \nullfont + % Similarly for index fonts (mostly for their use in + % smallexample) + \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont + \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont + \let\indsf = \nullfont % % Don't complain when characters are missing from the fonts. \tracinglostchars = 0 @@ -1140,7 +1145,7 @@ \def\titlezzz##1{\leftline{\titlefont{##1}} % print a rule at the page bottom also. \finishedtitlepagefalse - \vskip4pt \hrule height 4pt \vskip4pt}% + \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % @@ -1180,7 +1185,7 @@ } \def\finishtitlepage{% - \vskip4pt \hrule height 2pt + \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } @@ -1354,14 +1359,18 @@ % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi} + \def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\par \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz} +\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} \def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\par \parsearg\kitemzzz} +\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% \itemzzz {#1}} @@ -1377,9 +1386,9 @@ \nobreak % This prevents a break before @itemx. % % Be sure we are not still in the middle of a paragraph. - {\parskip = 0in - \par - }% + %{\parskip = 0in + %\par + %}% % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that @@ -1387,7 +1396,15 @@ % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax - \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0 + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. @@ -1397,6 +1414,8 @@ % we can't prevent a possible page break at the following % \baselineskip glue. \nobreak + \endgroup + \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. Since that @@ -1403,9 +1422,10 @@ % text will be indented by \tableindent, we make the item text be in % a zero-width box. \noindent - \rlap{\hskip -\tableindent\box0}% + \rlap{\hskip -\tableindent\box0}\ignorespaces% + \endgroup% + \itemxneedsnegativevskiptrue% \fi - \endgroup } \def\item{\errmessage{@item while not in a table}} @@ -1932,17 +1952,22 @@ % % Insert the text of the index entry. TeX will do line-breaking on it. #1% - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ #2% The page number ends the paragraph. + % If there are no page numbers, don't output a line of dots. + \def\tempa{#2} + \def\tempb{} + \ifx\tempa\tempb\ \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ #2% The page number ends the paragraph. + \fi% \par \endgroup} @@ -3104,7 +3129,7 @@ \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent \exdentamount=\defbodyindent \begingroup % -\catcode 61=\active % +\catcode 61=\active % 61 is `=' \obeylines\activeparens\spacesplit#3} \def\defmethparsebody #1#2#3#4 {\begingroup\inENV % @@ -3147,55 +3172,54 @@ \catcode 61=\active % \obeylines\spacesplit#3} -\def\defvrparsebody #1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#4}}} - -% This seems to work right in all cases. -\let\deftpparsebody=\defvrparsebody -% This fails to work. When given `@deftp {Data Type} foo_t', -% it thinks the type name is just `f'. -%%% This is the same as all the others except for the last line. We need -%%% to parse the arguments differently for @deftp, since the ``attributes'' -%%% there are optional. -%%% -%%\def\deftpparsebody #1#2#3#4 {\begingroup\inENV % -%%\medbreak % -%%% Define the end token that this defining construct specifies -%%% so that it will exit this group. -%%\def#1{\endgraf\endgroup\medbreak}% -%%\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% -%%\parindent=0in -%%\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent -%%\exdentamount=\defbodyindent -%%\begingroup\obeylines\parsetpheaderline{#3{#4}}} - -%%{\obeylines % -%% % Parse the type name and any attributes (field names, etc.). -%% % #1 is the beginning of the macro call that will produce the output, -%% % i.e., \deftpheader{CLASS}; this is passed from \deftpparsebody. -%% % #2 is the type name, e.g., `struct termios'. -%% % #3 is the (possibly empty) attribute list. -%% % -%% \gdef\parsetpheaderline#1#2#3^^M{% -%% \endgroup % Started in \deftpparsebody. -%% % -%% % If the attribute list is in fact empty, there will be no space after -%% % #2; so we can't put a space in our TeX parameter list. But if it -%% % isn't empty, then #3 will begin with an unwanted space. -%% \def\theargs{\ignorespaces #3}% -%% % -%% % Call the macro to produce the output. -%% #1{#2}\theargs % -%% }% -%%} +% This is used for \def{tp,vr}parsebody. It could probably be used for +% some of the others, too, with some judicious conditionals. +% +\def\parsebodycommon#1#2#3{% + \begingroup\inENV % + \medbreak % + % Define the end token that this defining construct specifies + % so that it will exit this group. + \def#1{\endgraf\endgroup\medbreak}% + \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% + \parindent=0in + \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent + \exdentamount=\defbodyindent + \begingroup\obeylines +} + +\def\defvrparsebody#1#2#3#4 {% + \parsebodycommon{#1}{#2}{#3}% + \spacesplit{#3{#4}}% +} + +% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the +% type is just `struct', because we lose the braces in `{struct +% termios}' when \spacesplit reads its undelimited argument. Sigh. +% \let\deftpparsebody=\defvrparsebody +% +% So, to get around this, we put \empty in with the type name. That +% way, TeX won't find exactly `{...}' as an undelimited argument, and +% won't strip off the braces. +% +\def\deftpparsebody #1#2#3#4 {% + \parsebodycommon{#1}{#2}{#3}% + \spacesplit{\parsetpheaderline{#3{#4}}}\empty +} + +% Fine, but then we have to eventually remove the \empty *and* the +% braces (if any). That's what this does, putting the result in \tptemp. +% +\def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}% + +% After \spacesplit has done its work, this is called -- #1 is the final +% thing to call, #2 the type name (which starts with \empty), and #3 +% (which might be empty) the arguments. +% +\def\parsetpheaderline#1#2#3{% + \removeemptybraces#2\relax + #1{\tptemp}{#3}% +}% \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % \medbreak % @@ -3295,7 +3319,10 @@ % #1 is the classification, #2 the data type, #3 the name, #4 the args. \def\deftypefnheaderx #1#2#3 #4\relax{% \doind {fn}{\code{#3}}% Make entry in function index -\begingroup\defname {\code{#2} #3}{#1}% +\begingroup +\normalparens % notably, turn off `&' magic, which prevents +% at least some C++ text from working +\defname {\code{#2} #3}{#1}% \deftypefunargs {#4}\endgroup % \catcode 61=\other % Turn off change made in \defparsebody } diff -ruN make-3.67/variable.c make-3.68/variable.c --- make-3.67/variable.c Mon Apr 12 16:02:24 1993 +++ make-3.68/variable.c Wed Jul 14 21:59:03 1993 @@ -389,6 +389,7 @@ int export_all_variables; /* Create a new environment for FILE's commands. + If FILE is nil, this is for the `shell' function. The child's MAKELEVEL variable is incremented. */ char ** @@ -395,6 +396,7 @@ target_environment (file) struct file *file; { + struct variable_set_list *set_list; register struct variable_set_list *s; struct variable_bucket { @@ -408,14 +410,19 @@ char **result; unsigned int mklev_hash; + if (file == 0) + set_list = current_variable_set_list; + else + set_list = file->variables; + /* Find the lowest number of buckets in any set in the list. */ - s = file->variables; + s = set_list; buckets = s->set->buckets; for (s = s->next; s != 0; s = s->next) if (s->set->buckets < buckets) buckets = s->set->buckets; - /* Find the hash value of `MAKELEVEL' will fall into. */ + /* Find the hash value of the bucket `MAKELEVEL' will fall into. */ { char *p = "MAKELEVEL"; mklev_hash = 0; @@ -431,7 +438,7 @@ /* Run through all the variable sets in the list, accumulating variables in TABLE. */ nvariables = 0; - for (s = file->variables; s != 0; s = s->next) + for (s = set_list; s != 0; s = s->next) { register struct variable_set *set = s->set; for (i = 0; i < set->buckets; ++i) diff -ruN make-3.67/version.c make-3.68/version.c --- make-3.67/version.c Sat May 22 20:59:55 1993 +++ make-3.68/version.c Wed Jul 28 17:41:11 1993 @@ -1,4 +1,4 @@ -char *version_string = "3.67"; +char *version_string = "3.68"; /* Local variables: diff -ruN make-3.67/vpath.c make-3.68/vpath.c --- make-3.67/vpath.c Fri May 14 19:09:34 1993 +++ make-3.68/vpath.c Thu Jul 8 21:30:13 1993 @@ -66,21 +66,33 @@ /* If there is a VPATH variable with a nonnull value, construct the general VPATH list from it. We use variable_expand rather than just calling lookup_variable so that it will be recursively expanded. */ - p = variable_expand ("$(VPATH)"); + + { + /* Turn off --warn-undefined-variables while we expand SHELL and IFS. */ + int save = warn_undefined_variables_flag; + warn_undefined_variables_flag = 0; + + p = variable_expand ("$(strip $(VPATH))"); + + warn_undefined_variables_flag = save; + } + if (*p != '\0') { + /* Save the list of vpaths. */ + struct vpath *save_vpaths = vpaths; + + /* Empty `vpaths' so the new one will have no next, and `vpaths' + will still be nil if P contains no existing directories. */ + vpaths = 0; + + /* Parse P. */ construct_vpath_list ("%", p); - /* VPATHS will be nil if there have been no previous `vpath' - directives and none of the given directories exists. */ - if (vpaths == 0) - general_vpath = 0; - else - { - general_vpath = vpaths; - /* It was just put into the linked list, - but we don't want it there, so we must remove it. */ - vpaths = general_vpath->next; - } + + /* Store the created path as the general path, + and restore the old list of vpaths. */ + general_vpath = vpaths; + vpaths = save_vpaths; } } @@ -241,8 +253,12 @@ path->patlen = strlen (pattern); } else - /* There were no entries, so free whatever space we allocated. */ - free ((char *) vpath); + { + /* There were no entries, so free whatever space we allocated. */ + free ((char *) vpath); + if (pattern != 0) + free (pattern); + } } /* Search the VPATH list whose pattern matches *FILE for a directory