These are context diffs between versions 3.58 and 3.59 of GNU Make. Changes in generated files have been omitted. The file `remote-customs.c' has been renamed to `remote-cstms.c', though its contents have not changed. diff -rc make-3.58/CHANGES make-3.59/CHANGES *** make-3.58/CHANGES Sun Dec 17 22:45:14 1989 --- make-3.59/CHANGES Mon Oct 22 16:16:40 1990 *************** *** 1,6 **** --- 1,12 ---- User-visible changes in GNU Make, excluding bug fixes, since version 3.05: ========================================================================== + Version 3.59 + + * The -n, -q, and -t options are not put in the `MAKEFLAGS' and `MFLAG' + variables while remaking makefiles, so recursive makes done while remaking + makefiles will behave properly. + Version 3.58 * Suffix rules may have dependencies (which are ignored). diff -rc make-3.58/ChangeLog make-3.59/ChangeLog *** make-3.58/ChangeLog Thu Feb 8 16:44:18 1990 --- make-3.59/ChangeLog Wed Nov 28 22:53:41 1990 *************** *** 1,3 **** --- 1,520 ---- + Wed Nov 29 22:53:32 1990 Roland McGrath (roland at geech.ai.mit.edu) + + * Version 3.59. + + Tue Nov 28 16:00:04 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * arscan.c (ar_name_equal) [APOLLO]: Don't do `.o' hacking. On Apollos + the full file name is elsewhere, and there is no length restriction (or + so I'm told). + + Thu Nov 23 17:33:11 1990 Roland McGrath (roland at albert.ai.mit.edu) + + * load.c [hp300 && BSD] (LDAV_CVT): Define for this system. + + Tue Nov 21 07:58:40 1990 Roland McGrath (roland at albert.ai.mit.edu) + + * read.c (record_files): Fix trivial bug with deciding to free storage + for a file name. + + Thu Nov 16 06:21:38 1990 Roland McGrath (roland at geech.ai.mit.edu) + + * compatMakefile ($(bindir)/make): Install it setgid kmem. + + Thu Nov 1 16:12:55 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * GNUmakefile (make-*.tar.Z): Use `h' option to tar (dereference + symlinks), to grab texinfo.tex from wherever it lives. + + Tue Oct 30 16:15:20 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * Version 3.58.13. + + Fri Oct 26 14:33:34 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * GNUmakefile: make-*.tar.Z: Include texinfo.tex. + + Tue Oct 23 19:34:33 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * main.c (define_makeflags): When there are no flags to write, make + sure the array has two leading nulls, since `MAKEFLAGS' is defined from + &flags[1]. + + * main.c (default_keep_going_flag): New variable (constant one). + (command_switches: -k, -S): Use above for default value. + (define_makeflags): Only write flag/flag_off switches if they are on, + and either there is no default value, or they are not the default. + + Mon Oct 22 16:14:44 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * main.c (struct command_switch): New member `no_makefile'. + (command_switches: -n, -q, -t): Set no_makefile == 1. + (define_makeflags): Take new arg MAKEFILE: if nonzero, don't use + options whose `no_makefile' flags are set. + (main): Call define_makeflags with MAKEFILE==1 before remaking + makefiles, and again with MAKEFILE==0 before remaking goals. + + Tue Oct 2 17:16:45 1990 Roland McGrath (roland at geech.ai.mit.edu) + + * Version 3.58.12. + + Mon Oct 1 15:43:23 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * arscan.c [HPUX]: Use PORTAR==1 format. + + Sat Sep 29 16:38:05 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * make.h, remake.c, arscan.c: Don't declare `open'. + + Fri Sep 28 04:46:23 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * variable.c (define_variable_in_set): Remove redundant -e check. + + Wed Sep 26 00:28:59 1990 Roland McGrath (roland at geech.ai.mit.edu) + + * job.c (start_job): Set RECURSIVE from the right elt of + CHILD->file->cmds->lines_recurse. + + * commands.c (chop_commands): Don't botch the line count for allocating + CMDS->lines_recurse. + + * Version 3.58.11. + + * job.c (start_job): Don't always increment CHILD->command_line! Only + do it when CHILD->command_ptr has run out! (Dumb bug. Sigh.) + + Thu Sep 20 02:18:51 1990 Roland McGrath (roland at geech.ai.mit.edu) + + * GNUmakefile [ARCH]: Give explicit rule for remote.{c,dep} to use + variable `REMOTE' for more flags. + ($(prog)): Link in $(LOADLIBES). + + Wed Sep 19 02:30:36 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * commands.h (struct commands): New member `ncommand_lines', the number + of elts in `command_lines' et al. + * commands.c (chop_commands): Set `ncommand_lines' elt of CMDS, and + don't put a nil pointer at the end of `command_lines'. + * job.h (struct child): New member `command_lines' to hold + variable-expanded command lines. + * job.c (new_job): Store expanded command lines in `command_lines' + member of new child. Don't clobber FILE->cmds. + (start_job): Use CHILD->command_lines in place of + CHILD->file->cmds->command_lines. + + * variable.h, variable.c, job.c, expand.c: Undo yesterday's change, + which is no longer necessary since we have cleverly avoided the issue. + + * job.c (start_job): Don't variable-expand each command line. + (new_job): Do them all here, storing the expansions in the array. + + Tue Sep 18 01:23:13 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * variable.h (struct variable): Remove `expanding' member. + * variable.c (define_variable_in_set): Don't initialize it. + * expand.c (struct variable_expanding): New type, a linked list + containing `struct variable' pointers. + (variables_expanding): New variable, the chain of variables currently + being expanded. + (recursively_expand): Don't test and set `expanding' member. + Instead, run through the `variables_expanding' chain looking for a link + referring to V to find self-reference. Add a new link to the chain, + describing V, before recursive expansion, and pop it off afterward. + * job.c (child_handler): Save `variables_expanding' and clear it before + calling start_job, and restore it afterward. This avoids major lossage + when the SIGCHLD comes in the middle of variable expansion. + + Mon Sep 17 14:46:26 1990 Roland McGrath (roland at geech.ai.mit.edu) + + * job.c, commands.c: Don't define sigmask. + * make.h: Put it here instead. + + * variable.c (target_environment): If `.NOEXPORT' was specified as a + target, only export command-line and environment variables, and + file-origin variables that were in the original environment. + + * make.man: Add missing ?roff control for `-I' option description. + + Thu Sep 13 14:10:02 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * load.c [UMAX]: Move #include to [not UMAX_43]. + + Wed Sep 12 15:10:15 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * expand.c (recursively_expand): Don't use `reading_filename' and + `reading_lineno_ptr' if they're nil. + + Thu Aug 30 17:32:50 1990 Roland McGrath (roland at geech) + + * Version 3.58.10. + + Tue Aug 28 04:06:29 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * job.c [USG] (unknown_children_possible): New variable, set nonzero + when it's possible for children not in the `children' chain to die. + (block_signals) [USG]: Set it. + (unblock_signals) [USG]: Clear it. + (child_handler) [USG]: Don't complain about unknown children if + `unknown_children_possible' is set. + + * read.c (do_define): Make sure there's enough space for the newline, + so we don't write off the end of allocated space. + + * arscan.c (ar_name_equal): Fixed to work when MEM is AR_NAMELEN-1 but + NAME is not the same length. + + Sat Aug 25 16:17:14 1990 Roland McGrath (roland at geech) + + * job.c (construct_command_argv_internal): Use a static char array for + a constant, since old C has no auto aggregate initializers. + + Thu Aug 23 16:11:03 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * job.c (search_path): If PATH is nil or "" use a default path. + + Wed Aug 22 01:05:32 1990 Roland McGrath (roland at churchy.ai.mit.edu) + + * Version 3.58.9. + + * job.c (exec_command): Don't take PATH and SHELL args. Get them from + ENVP. + (child_execute_job): Don't take FILE arg, and don't pass path and shell + to exec_command. + (start_job): Don't pass FILE arg to child_execute_job. + * function.c (expand_function: `shell'): Ditto. + * main.c (main): Don't pass path and shell to exec_command. + + Fri Aug 17 23:17:27 1990 Roland McGrath (roland at geech) + + * job.c (construct_command_argv_internal): New fn broken out of + construct_command_argv. Takes strings SHELL and IFS instead of doing + variable expansion for them. Recurse to make an argv for SHELL, + passing SHELL==0. When SHELL==0, don't recurse for shell argv; make a + simple one using /bin/sh. + (construct_command_argv): Do the variable expansions and call above. + + Thu Aug 16 19:03:14 1990 Roland McGrath (roland at geech) + + * read.c (multi_glob): For ~USER/FILE, if USER isn't found, don't + change the file name at all. + + Tue Aug 7 18:33:28 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * function.c (expand_function: `suffix'/`notdir'): Don't kill the last + space if we never wrote one. + + * function.c (expand_function: `suffix'): Retain the dot, like the + documentation says. + + Mon Aug 6 14:35:06 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * Version 3.58.8. + + * main.c (decode_switches): For positive_int and floating cases, move + SW past the arg (and don't set it to ""), so another switch can follow. + + Fri Aug 3 00:43:15 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * job.c (child_execute_job): Use unblock_signals instead of + push_signals_blocked_p (0). + + * main.c (fatal_signal_mask): New variable, mask of signals caught with + fatal_error_signal. + (main): Set it. + * job.c ({block,unblock}_children): Renamed to {block,unblock}_signals. + Block/unblock both child signal and signals in fatal_signal_mask. + (children_blocked_p_{stack,max,depth}, {push,pop}_children_blocked_p): + Renamed from children to signals. Use {block,unblock}_signals instead + of {block,unblock}_children. + * commands.c (fatal_error_signal), job.c (wait_for_children, new_job, + child_execute_job, main, log_working_directory), function.c + (expand_function: `shell'), job.h: Rename {push,pop}_children_blocked_p + to {push,pop}_signals_blocked_p. + * job.c (child_handler): Call {block,unblock}_signals instead of just + {block,unblock}_remote_children. We need to block the fatal signals. + + Thu Aug 2 22:41:06 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * main.c, function.c: Fixed typos in comments. + + * file.c (print_file_data_base): Fix computation of avg files/bucket. + + Tue Jul 31 22:11:14 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * Version 3.58.7. + + Wed Jul 25 16:32:38 1990 Roland McGrath (mcgrath at tully.Berkeley.EDU) + + * arscan.c (ar_name_equal): Fixed to really do it right. + (ar_member_pos): Fixed order of args. + * ar.c (ar_member_date_1): Ditto. + + Fri Jul 20 15:30:26 1990 Roland McGrath (mcgrath at tully.Berkeley.EDU) + + * arscan.c (ar_name_equal): Rewritten. Accounts for a possible + trailing slash in MEM. + + * remake.c (f_mtime): Keep track of whether ARNAME is used and free it + if not. Also free MEMNAME. + * ar.c (ar_member_date, ar_touch): Ditto. + + * arscan.c (arscan) [HPUX or hpux]: Treat same as USGr3 PORTAR==1. + + * make.h: If NSIG is not defined, but _NSIG is, #define NSIG _NSIG. + + * compatMakefile: Don't use $* in explicit rules. + + * default.c (default_variables: "PREPROCESS.S"): Include $(CPPFLAGS). + + * remake.c (f_mtime): If FILE is an ar ref, get the member modtime. + + * function.c (string_glob): Terminate the string properly when it's + empty. + + Wed Jul 18 11:26:56 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * Version 3.58.6. + + * commands.c (set_file_variables): Fixed computation for ^F/?F elt len. + + Sat Jul 14 13:41:24 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * job.c (construct_command_argv): Always use + allocated_variable_expand_for_file instead of variable_expand_for_file + because we might be called from inside a variable expansion (for the + `shell' function). + + * function.c (expand_function: `shell'): Free the arglist's storage + correctly. construct_command_argv only allocates ARGV and ARGV[0]. + + * job.c (children_blocked_p_idx): Renamed to children_blocked_p_depth. + (push_children_blocked_p, pop_children_blocked_p): Use ..._depth + instead of ..._idx, and do it right! + + Wed Jul 11 15:35:43 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * make.h (SIGNAL): New macro to replace `signal' calls. Does arg and + ret value casts to (void *) #ifdef __STDC__ to avoid conflicts btwn + ANSI and BSD `signal' and handler types. + * main.c (main), job.c (child_handler): Use it. + + Fri Jul 6 00:00:38 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * ar.c (ar_member_date, ar_touch): Pass 2nd arg to f_mtime. + + * read.c (read_makefile): Search the include path for MAKEFILES + variable makefiles (TYPE == 1), like it says in the manual. + + * file.h (struct file), main.c (struct command_switch): Remove trailing + commas from enums. + + * commands.c (execute_file_commands): Remove unused variables. + * commands.h: Declare chop_commands. + * make.h: Declare uniquize_deps. + * main.c (main): Remove unused variable. + (decode_switches): Remove unused label. + * remake.c: Include "ar.h" for ar_parse_name decl. + * implicit.c (try_implicit_rule): Remove unused variable. + * function.c (expand_function: `shell'): Declare fork, pipe. + * ar.c: Declare ar_name_equal. + + * GNUmakefile: If using gcc, add warning flags to CFLAGS. + + * remake.c: Remove decl of ar_member_date, since it's done in make.h. + + * remake.c (f_mtime): For ar refs, allow the archive to be found via + VPATH search if we're searching, and change the ar ref accordingly. + + * ar.c (ar_parse_name): New global fn to parse archive-member + references into the archive and member names. + (ar_member_date, ar_touch): Use it. + * make.h: Declare it. + + * remake.c (f_mtime): After doing rename_file, do check_renamed instead + of assuming rename_file will always set FILE->renamed (which it won't). + + * vpath.c (selective_vpath_search): Only accept prospective files that + don't actually exist yet are mentioned in a makefile if the file we are + searching for isn't a target. + + Wed Jul 4 04:11:55 1990 Roland McGrath (mcgrath at helen.Berkeley.EDU) + + * remake.c (update_goal_chain): Do check_renamed after calling + file_mtime. + (check_dep): Ditto after update_file. + + * file.c (rename_file): Prettied up long message for merging cmds. + + * remake.c (update_file_1): Get each dep file's modtime, and allow for + it being renamed, before checking for a circular dep, since a renaming + may have introduced one. + + Tue Jul 3 18:15:01 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * ar.c (ar_touch): Don't free ARNAME since enter_file holds onto the + storage. + + * function.c (string_glob): Don't leave a trailing space. + + * read.c (do_define): Allow leading whitespace before `endef'. + + Mon Jul 2 14:10:16 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * implicit.c (pattern_search): No longer take NAME arg. Instead take + ARCHIVE flag. If ARCHIVE is nonzero, FILE->name is of the form + "LIB(MEMBER)"; rule for "(MEMBER)" is searched for, and LASTSLASH is + set to nil. Since NAME was only non-nil when it was the archive member + name passed by try_implicit_rule, this change easily allows turning off + LASTSLASH checking for archive members without excessive kludgery. + (try_implicit_rule): Pass ARCHIVE flag instead of file name. + + * Version 3.58.5. + + * commands./c (set_file_variables): Don't kill last char of $(^D) elts. + + Sat Jun 30 00:53:38 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * ar.c (ar_member_date): Don't free ARNAME since enter_file holds onto + the storage. + + * arscan.c (ar_scan) [sun386 && PORTAR == 1]: Treat like USGr3. + + Wed Jun 27 14:38:49 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * main.c (main): Put a newline on the debugging message when deciding + not to remake a makefile to avoid a possible loop. + Only decide not to remake makefiles that have commands (as well as + being targets and having no deps). + + Fri Jun 22 12:35:37 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * default.c (default_variables): Define `LINK.s' and `LINK.S'. + (default_suffix_rules): Define .S.o rule. + + * job.c (construct_command_argv): If we decide to go the slow route, + free all storage for the chopped args. + (start_job): Free the argument list's storage correctly. + construct_command_argv only allocates ARGV and ARGV[0]. + + Tue Jun 19 18:27:43 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * Version 3.58.4. + + Fri Jun 15 21:12:10 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * glob.c: New version from ai-lab which doesn't do [^abc]. + + Thu Jun 7 00:30:46 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * dir.c: Copied dirent vs direct et al mess from glob.c. + + * glob.c: Replaced with updated version from djm. + * glob.c: Check macro DIRENT instead of _POSIX_SOURCE for . + __GNU_LIBRARY__ implies DIRENT and STDC_HEADERS. + + Thu May 31 22:19:49 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * vpath.c (vpath_search): Don't stop the loop if a pattern matches but + the search fails. All matching patterns have their paths searched + (like it says in the manual). + + * make.texinfo (Rules: Directory Search: Selective Search): Say that + multiple `vpath' directives with the same pattern DO accumulate, not + supersede earlier ones. + + * vpath.c (print_vpath_data_base): Increment the count of vpaths on + each loop iteration, rather than letting it stay zero. + + * Version 3.58.3. + + * job.c (block_children, unblock_children): Made static. + (push_children_blocked_p, pop_children_blocked_p): New functions to + push and pop whether children are blocked or not. + * job.h: Declare push_children_blocked_p, pop_children_blocked_p and + not block_children, unblock_children. + * commands.c (fatal_error_signal), job.c (wait_for_children, new_job, + child_execute_job), main.c (main, log_working_directory): Use sequences + of push_children_blocked_p (1) and pop_children_blocked_p () instead of + explicitly blocking and unblocking children. + * function.c (expand_function: `shell'): Don't unblock children. The + push-pop sequence in wait_for_children makes it unnecessary. + + Tue May 29 21:30:00 1990 Roland McGrath (mcgrath at helen.Berkeley.EDU) + + * read.c (do_define): Don't include the last newline in the definition. + + * function.c (expand_function: `shell'): Call construct_command_argv + before forking and don't fork if it returns nil. Free the argument + list's storage before finishing. + + * job.c (start_job): Free the storage for the child's argument list + in the parent side of the fork after the child has been spawned. + + * job.c (start_job): If construct_command_argv returns nil, go to the + next command line. + + * job.c (construct_command_argv): Use the shell if the command contains + an unterminated quote. + + Wed May 23 19:54:10 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * Version 3.58.2. + + * read.c (read_makefile): Parse "override define" correctly. + + Thu May 17 15:25:58 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * arscan.c [USG]: Don't declare memcpy and memcmp. should + do this anyway (and lack of declarations is harmless). + + * remote-customs.c: Renamed to remote-cstms.c for System V. + * remote.c [CUSTOMS]: Changed accordingly. + + Sun May 13 14:38:39 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * GNUmakefile: Use same cmds for doc tar.Z as for dist tar.Z (so the + contents go in make-N.NN). + + Thu Apr 26 19:33:25 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * Version 3.58.1. + + Wed Apr 25 20:27:52 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * job.c (init_siglist): Don't do SIGUSR1 and SIGUSR2 if they are the + same as SIGIO and SIGURG (true on Cray). + + Tue Apr 24 20:26:41 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * arscan.c (ar_scan): Do behavior for PORTAR == 1 and USGr3 also + #ifdef APOLLO. + + Wed Apr 11 10:00:39 1990 Roland McGrath (mcgrath at paris.Berkeley.EDU) + + * job.c (exec_command): Set the effective GID to the real GID. Somehow + this code got lost. + + * implicit.c (pattern_search): Use the right index variable when + seeing if we need to expand FILE->also_make. + + Sun Mar 4 09:18:58 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * Version 3.58.0. + + * remake.c (remake_file): Treat non-targets without commands under -t + the same as anything else without commands. + + Sat Feb 24 17:46:04 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * default.c (default_variables: PREPROCESS.S): Removed $< from defn. + + * main.c (main): Ignore arguments that are the empty string, rather + than feeding them to enter_file and barfing therein. + + Wed Feb 14 16:28:37 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) + + * main.c (main): Call construct_include_path after doing chdirs. + Thu Feb 8 13:43:44 1990 Roland McGrath (mcgrath at homer.Berkeley.EDU) * Version 3.58. *************** *** 3836,3839 **** --- 4353,4357 ---- mode: indented-text left-margin: 8 version-control: never + make-backup-files: nil End: diff -rc make-3.58/Makefile make-3.59/Makefile *** make-3.58/Makefile Sun Feb 4 01:18:43 1990 --- make-3.59/Makefile Wed Nov 28 22:55:08 1990 *************** *** 110,118 **** mv -f make.new make load.o: load.c ! $(CC) $(CFLAGS) $(LOAD_AVG) -c $*.c remote.o: remote.c ! $(CC) $(CFLAGS) $(REMOTE) -c $*.c TAGS: $(srcs) etags -tw $(srcs) --- 110,118 ---- mv -f make.new make load.o: load.c ! $(CC) $(CFLAGS) $(LOAD_AVG) -c load.c remote.o: remote.c ! $(CC) $(CFLAGS) $(REMOTE) -c remote.c TAGS: $(srcs) etags -tw $(srcs) *************** *** 124,129 **** --- 124,132 ---- $(bindir)/make: make cp make $@.new + # These are necessary for load-average checking to work on most Unix machines. + chgrp kmem $@.new + chmod g+s $@.new mv $@.new $@ $(mandir)/make.$(manext): make.man *************** *** 145,151 **** misc.o : misc.c make.h dep.h main.o : main.c make.h commands.h dep.h file.h variable.h job.h read.o : read.c make.h commands.h dep.h file.h variable.h ! remake.o : remake.c make.h commands.h job.h dep.h file.h remote.o : remote.c remote-stub.c make.h commands.h rule.o : rule.c make.h commands.h dep.h file.h variable.h rule.h implicit.o : implicit.c make.h rule.h dep.h file.h --- 148,154 ---- misc.o : misc.c make.h dep.h main.o : main.c make.h commands.h dep.h file.h variable.h job.h read.o : read.c make.h commands.h dep.h file.h variable.h ! remake.o : remake.c make.h /usr/include/ar.h commands.h job.h dep.h file.h remote.o : remote.c remote-stub.c make.h commands.h rule.o : rule.c make.h commands.h dep.h file.h variable.h rule.h implicit.o : implicit.c make.h rule.h dep.h file.h diff -rc make-3.58/README make-3.59/README *** make-3.58/README Thu Feb 8 16:45:19 1990 --- make-3.59/README Wed Nov 28 22:54:53 1990 *************** *** 1,4 **** ! This directory contains the 3.58 test release of GNU Make. All bugs reported for previous test releases have been fixed. Some bugs probably remain. --- 1,4 ---- ! This directory contains the 3.59 test release of GNU Make. All bugs reported for previous test releases have been fixed. Some bugs probably remain. diff -rc make-3.58/ar.c make-3.59/ar.c *** make-3.58/ar.c Sat Oct 14 18:18:37 1989 --- make-3.59/ar.c Thu Sep 20 02:57:31 1990 *************** *** 1,4 **** ! /* Copyright (C) 1988, 1989 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify --- 1,4 ---- ! /* Copyright (C) 1988, 1989, 1990 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify *************** *** 22,27 **** --- 22,28 ---- /* Defined in arscan.c. */ extern long int ar_scan (); extern int ar_member_touch (); + extern int ar_name_equal (); /* Return nonzero if NAME is an archive-member reference, zero if not. *************** *** 43,48 **** --- 44,67 ---- return 1; } + + + /* Parse the archive-member reference NAME into the archive and member names. + Put the malloc'd archive name in *ARNAME_P if ARNAME_P is non-nil; + put the malloc'd member name in *MEMNAME_P if MEMNAME_P is non-nil. */ + + void + ar_parse_name (name, arname_p, memname_p) + char *name, **arname_p, **memname_p; + { + char *p = index (name, '('), *end = name + strlen (name) - 1; + + if (arname_p != 0) + *arname_p = savestring (name, p - name); + + if (memname_p != 0) + *memname_p = savestring (p + 1, end - (p + 1)); + } static long int ar_member_date_1 (); *************** *** 53,82 **** char *name; { char *arname; char *memname; - char *p; long int val; ! /* This "file" is an archive member. */ ! p = index (name, '('); ! arname = savestring (name, p - name); ! val = strlen (p) - 2; ! if (val > 15) ! val = 15; ! memname = savestring (p + 1, val); ! p = rindex (memname, ')'); ! if (p != 0) ! *p = '\0'; /* Make sure we know the modtime of the archive itself because we are likely to be called just before commands to remake a member are run, and they will change the archive itself. */ ! (void) f_mtime (enter_file (arname)); val = ar_scan (arname, ar_member_date_1, (long int) memname); ! free (arname); free (memname); return (val <= 0 ? (time_t) -1 : (time_t) val); } --- 72,104 ---- char *name; { char *arname; + int arname_used = 0; char *memname; long int val; ! ar_parse_name (name, &arname, &memname); /* Make sure we know the modtime of the archive itself because we are likely to be called just before commands to remake a member are run, and they will change the archive itself. */ ! { ! struct file *arfile; ! arfile = lookup_file (arname); ! if (arfile == 0) ! { ! arfile = enter_file (arname); ! arname_used = 1; ! } ! ! (void) f_mtime (arfile, 0); ! } val = ar_scan (arname, ar_member_date_1, (long int) memname); ! if (!arname_used) ! free (arname); free (memname); + return (val <= 0 ? (time_t) -1 : (time_t) val); } *************** *** 84,95 **** /* ARGSUSED */ static long int ! ar_member_date_1 (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem) int desc; ! char *name; long int hdrpos, datapos, size, date; int uid, gid, mode; ! char *mem; { return ar_name_equal (name, mem) ? date : 0; } --- 106,117 ---- /* ARGSUSED */ static long int ! ar_member_date_1 (desc, mem, hdrpos, datapos, size, date, uid, gid, mode, name) int desc; ! char *mem; long int hdrpos, datapos, size, date; int uid, gid, mode; ! char *name; { return ar_name_equal (name, mem) ? date : 0; } *************** *** 100,121 **** ar_touch (name) char *name; { ! register char *p, *arname, *memname; register int val; ! p = index (name, '('); ! arname = savestring (name, p - name); ! val = strlen (p) - 2; ! if (val > 15) ! val = 15; ! memname = savestring (p + 1, val); ! p = rindex (memname, ')'); ! if (p != 0) ! *p = '\0'; /* Make sure we know the modtime of the archive itself before we touch the member, since this will change the archive itself. */ ! (void) f_mtime (enter_file (arname)); val = 1; switch (ar_member_touch (arname, memname)) --- 122,146 ---- ar_touch (name) char *name; { ! char *arname, *memname; ! int arname_used = 0; register int val; ! ar_parse_name (name, &arname, &memname); /* Make sure we know the modtime of the archive itself before we touch the member, since this will change the archive itself. */ ! { ! struct file *arfile; ! arfile = lookup_file (arname); ! if (arfile == 0) ! { ! arfile = enter_file (arname); ! arname_used = 1; ! } ! ! (void) f_mtime (arfile, 0); ! } val = 1; switch (ar_member_touch (arname, memname)) *************** *** 138,144 **** error ("touch: Bad return code from ar_member_touch on `%s'", name); } ! free (arname); free (memname); return val; --- 163,170 ---- error ("touch: Bad return code from ar_member_touch on `%s'", name); } ! if (!arname_used) ! free (arname); free (memname); return val; diff -rc make-3.58/arscan.c make-3.59/arscan.c *** make-3.58/arscan.c Fri Oct 20 01:46:34 1989 --- make-3.59/arscan.c Tue Nov 27 17:02:39 1990 *************** *** 20,26 **** (System V Release 1). There is no default, one or the other must be defined to have a nonzero value. */ ! #if defined(sun386) || defined(USGr3) && !defined(PORTAR) && !defined(PORT5AR) #define PORTAR 1 #endif --- 20,27 ---- (System V Release 1). There is no default, one or the other must be defined to have a nonzero value. */ ! #if (defined(sun386) || defined(USGr3) || defined(HPUX) \ ! && !defined(PORTAR) && !defined(PORT5AR)) #define PORTAR 1 #endif *************** *** 30,51 **** #include #ifdef USG #include #include #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) #define bcopy(s, d, n) ((void) memcpy ((d), (s), (n))) ! extern int memcmp (); ! extern char *memcpy (); #else /* not USG */ #include extern int bcmp (); extern void bcopy (); #endif /* not USG */ ! extern int open (), read (), close (), write (), fstat (); extern long int lseek (), atol (); extern int atoi (), strcmp (); --- 31,67 ---- #include #ifdef USG + #include + #include #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) #define bcopy(s, d, n) ((void) memcpy ((d), (s), (n))) ! #include ! #define rindex(s, c) strrchr((s), (c)) ! #else /* not USG */ + #include extern int bcmp (); extern void bcopy (); + + #include + #endif /* not USG */ ! #if (defined(APOLLO) || defined(HPUX) || defined(hpux) || \ ! (PORTAR == 1 && (defined(USGr3) || defined(u3b2) || defined(sun386)))) ! #define AR_NAMELEN 14 ! #define AR_TRAILING_SLASH /* Member names have a trailing slash. */ ! #else ! #define AR_NAMELEN 15 ! #endif ! ! extern int read (), close (), write (), fstat (); extern long int lseek (), atol (); extern int atoi (), strcmp (); *************** *** 157,164 **** register char *p = name + sizeof member_header.ar_name; while (p > name && *--p == ' ') *p = '\0'; ! #if PORTAR == 1 && (defined(USGr3) || defined(u3b2)) ! /* SysVr3 ar format for PORTAR == 1 adds a slash. */ if (*p == '/') *p = '\0'; #endif --- 173,179 ---- register char *p = name + sizeof member_header.ar_name; while (p > name && *--p == ' ') *p = '\0'; ! #ifdef AR_TRAILING_SLASH if (*p == '/') *p = '\0'; #endif *************** *** 208,242 **** ar_name_equal (name, mem) char *name, *mem; { ! if (!strncmp (name, mem, 13)) { unsigned int namelen, memlen; namelen = strlen (name); - if (namelen <= 13) - return 1; - memlen = strlen (mem); ! if (memlen <= 13) return 1; ! if (name[namelen - 2] == '.' && name[namelen - 1] == 'o' ! && memlen == 15 && mem[13] == '.' && mem[14] == 'o') return 1; ! return !strncmp (mem + 13, name + 13, ! (namelen > memlen ? namelen : memlen) - 13); } return 0; } /* ARGSUSED */ static long int ! ar_member_pos (desc, name, hdrpos, datapos, size, date, uid, gid, mode, mem) int desc; ! char *name; long int hdrpos, datapos, size, date; int uid, gid, mode; ! char *mem; { if (!ar_name_equal (name, mem)) return 0; --- 223,268 ---- ar_name_equal (name, mem) char *name, *mem; { ! char *p; ! ! p = rindex (name, '/'); ! if (p != 0) ! name = p + 1; ! ! #ifndef APOLLO ! ! if (!strncmp (name, mem, AR_NAMELEN - 2)) { unsigned int namelen, memlen; namelen = strlen (name); memlen = strlen (mem); ! ! if (namelen == memlen && memlen <= AR_NAMELEN - 2) return 1; ! if (memlen == AR_NAMELEN && namelen >= AR_NAMELEN + 2 ! && mem[AR_NAMELEN - 2] == '.' && mem[AR_NAMELEN - 1] == 'o' ! && name[namelen - 2] == '.' && name[namelen - 1] == 'o') return 1; ! ! return !strncmp(&mem[AR_NAMELEN - 2], &name[AR_NAMELEN - 2], 2); } return 0; + + #else /* APOLLO. */ + return !strcmp (name, mem); + #endif } /* ARGSUSED */ static long int ! ar_member_pos (desc, mem, hdrpos, datapos, size, date, uid, gid, mode, name) int desc; ! char *mem; long int hdrpos, datapos, size, date; int uid, gid, mode; ! char *name; { if (!ar_name_equal (name, mem)) return 0; diff -rc make-3.58/commands.c make-3.59/commands.c *** make-3.58/commands.c Thu Nov 9 18:08:20 1989 --- make-3.59/commands.c Wed Sep 26 05:20:48 1990 *************** *** 23,32 **** #include "variable.h" #include "job.h" - #ifndef sigmask - #define sigmask(sig) (1 << ((sig) - 1)) - #endif - extern int remote_kill (); extern int getpid (); --- 23,28 ---- *************** *** 169,177 **** else { cF = p + 1; ! Flen = len - (p - c); cD = c; ! Dlen = (p - c) - 1; } bcopy (cD, cDp, Dlen); cDp += Dlen; --- 165,173 ---- else { cF = p + 1; ! Flen = len - (p + 1 - c); cD = c; ! Dlen = p - c; } bcopy (cD, cDp, Dlen); cDp += Dlen; *************** *** 257,263 **** } } ! if (idx == nlines - 1) { nlines += 2; lines = (char **) xrealloc ((char *) lines, --- 253,259 ---- } } ! if (idx == nlines) { nlines += 2; lines = (char **) xrealloc ((char *) lines, *************** *** 268,274 **** if (*p != '\0') ++p; } - lines[idx++] = 0; if (idx != nlines) { --- 264,269 ---- *************** *** 277,286 **** nlines * sizeof (char *)); } cmds->command_lines = lines; cmds->any_recurse = 0; - --nlines; cmds->lines_recurse = (char *) xmalloc (nlines); for (idx = 0; idx < nlines; ++idx) { --- 272,281 ---- nlines * sizeof (char *)); } + cmds->ncommand_lines = nlines; cmds->command_lines = lines; cmds->any_recurse = 0; cmds->lines_recurse = (char *) xmalloc (nlines); for (idx = 0; idx < nlines; ++idx) { *************** *** 305,312 **** struct file *file; { register char *p; - struct child *c; - int status; /* Don't go through all the preparations if the commands are nothing but whitespace. */ --- 300,305 ---- *************** *** 352,362 **** if (sig == SIGTERM) { register struct child *c; ! block_children (); for (c = children; c != 0; c = c->next) if (!c->remote) (void) kill (c->pid, SIGTERM); ! unblock_children (); } /* If we got a signal that means the user --- 345,355 ---- if (sig == SIGTERM) { register struct child *c; ! push_signals_blocked_p (1); for (c = children; c != 0; c = c->next) if (!c->remote) (void) kill (c->pid, SIGTERM); ! pop_signals_blocked_p (); } /* If we got a signal that means the user *************** *** 365,371 **** if (PROPAGATED_SIGNAL_MASK & sigmask (sig)) { register struct child *c; ! block_children (); /* Remote children won't automatically get signals sent to the process group, so we must send them. */ --- 358,364 ---- if (PROPAGATED_SIGNAL_MASK & sigmask (sig)) { register struct child *c; ! push_signals_blocked_p (1); /* Remote children won't automatically get signals sent to the process group, so we must send them. */ *************** *** 376,382 **** for (c = children; c != 0; c = c->next) delete_child_targets (c); ! unblock_children (); /* Clean up the children. We don't just use the call below because we don't want to print the "Waiting for children" message. */ --- 369,375 ---- for (c = children; c != 0; c = c->next) delete_child_targets (c); ! pop_signals_blocked_p (); /* Clean up the children. We don't just use the call below because we don't want to print the "Waiting for children" message. */ diff -rc make-3.58/commands.h make-3.59/commands.h *** make-3.58/commands.h Sat Oct 14 15:15:19 1989 --- make-3.59/commands.h Wed Sep 19 03:03:18 1990 *************** *** 23,28 **** --- 23,29 ---- char *filename; /* File that contains commands. */ unsigned int lineno; /* Line number in file. */ char *commands; /* Commands text. */ + unsigned int ncommand_lines;/* Number of command lines. */ char **command_lines; /* Commands chopped up into lines. */ char *lines_recurse; /* One flag for each line. */ char any_recurse; /* Nonzero if any `lines_recurse' elt is. */ *************** *** 32,34 **** --- 33,36 ---- extern void execute_file_commands (); extern void print_commands (); extern void delete_child_targets (); + extern void chop_commands (); diff -rc make-3.58/default.c make-3.59/default.c *** make-3.58/default.c Fri Dec 22 19:42:47 1989 --- make-3.59/default.c Fri Jul 20 19:21:20 1990 *************** *** 1,5 **** /* Data base of default implicit rules for GNU Make. ! Copyright (C) 1988, 1989 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify --- 1,5 ---- /* Data base of default implicit rules for GNU Make. ! Copyright (C) 1988, 1989, 1990 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify *************** *** 98,103 **** --- 98,109 ---- #else /* Xenix. */ "$(COMPILE.s) -o$@ $<", #endif /* Not Xenix. */ + ".S.o", + #ifndef M_XENIX + "$(COMPILE.S) -o $@ $<", + #else /* Xenix. */ + "$(COMPILE.S) -o$@ $<", + #endif /* Not Xenix. */ ".c.o", "$(COMPILE.c) $< $(OUTPUT_OPTION)", ".cc.o", *************** *** 225,240 **** "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)", "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)", "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c", - "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", #ifndef M_XENIX ! "PREPROCESS.S", "$(CC) -E $<", #else /* Xenix. */ ! "PREPROCESS.S", "$(CC) -EP $<", #endif /* Not Xenix. */ "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F", "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F", #ifndef NO_MINUS_C_MINUS_O #ifndef M_XENIX --- 231,248 ---- "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)", "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", + "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)", "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)", + "LINK.s", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)", "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c", #ifndef M_XENIX ! "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)", #else /* Xenix. */ ! "PREPROCESS.S", "$(CC) -EP $(CPPFLAGS)", #endif /* Not Xenix. */ "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F", "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F", + "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", #ifndef NO_MINUS_C_MINUS_O #ifndef M_XENIX diff -rc make-3.58/dir.c make-3.59/dir.c *** make-3.58/dir.c Wed Oct 4 01:12:47 1989 --- make-3.59/dir.c Thu Jun 7 04:36:59 1990 *************** *** 18,39 **** #include "make.h" ! #if defined(USGr3) || defined(DIRENT) ! #include #define direct dirent ! #define D_NAMLEN(d) strlen((d)->d_name) ! ! #else /* Not USGr3 and not DIRENT. */ ! #define D_NAMLEN(d) ((d)->d_namlen) ! # ifdef USG ! #include "ndir.h" /* Get ndir.h from the Emacs distribution. */ ! # else /* Not USG. */ #include ! # endif /* USG. */ ! ! #endif /* USGr3 or DIRENT. */ /* Hash table of directories. */ --- 18,39 ---- #include "make.h" ! #if defined(USGr3) || defined(DIRENT) || defined(__GNU_LIBRARY__) #include #define direct dirent ! #define D_NAMLEN(d) strlen((d)->d_name) ! #else /* not USGr3 or DIRENT or __GNU_LIBRARY__ */ #define D_NAMLEN(d) ((d)->d_namlen) ! #ifdef USG ! #ifdef SYSNDIR ! #include ! #else ! #include "ndir.h" /* Get ndir.h from the Emacs distribution. */ ! #endif /* not SYSNDIR */ ! #else /* not USG */ #include ! #endif /* USG */ ! #endif /* USGr3 */ /* Hash table of directories. */ diff -rc make-3.58/expand.c make-3.59/expand.c *** make-3.58/expand.c Wed Aug 9 16:09:00 1989 --- make-3.59/expand.c Wed Sep 19 02:38:29 1990 *************** *** 31,38 **** char *value; if (v->expanding) ! fatal ("%s:%u: Recursive variable `%s' references itself (eventually)", ! reading_filename, *reading_lineno_ptr, v->name); v->expanding = 1; value = allocated_variable_expand (v->value); --- 31,45 ---- char *value; if (v->expanding) ! { ! /* Expanding V causes infinite recursion. Lose. */ ! if (reading_filename == 0) ! fatal ("Recursive variable `%s' references itself (eventually)", ! v->name); ! else ! fatal ("%s:%u: Recursive variable `%s' references itself (eventually)", ! reading_filename, *reading_lineno_ptr, v->name); ! } v->expanding = 1; value = allocated_variable_expand (v->value); diff -rc make-3.58/file.c make-3.59/file.c *** make-3.58/file.c Sat Jan 20 18:26:36 1990 --- make-3.59/file.c Fri Aug 3 02:11:56 1990 *************** *** 188,206 **** { if (oldfile->cmds == 0) oldfile->cmds = file->cmds; ! else { /* We have two sets of commands. We will go with the one given in the rule explicitly mentioning this name, but give a message to let the user know what's going on. */ ! error ("%s:%u: commands were specified for file `%s' at %s:%u", file->cmds->filename, file->cmds->lineno, oldname, oldfile->cmds->filename, oldfile->cmds->lineno); ! error ("%s:%u: but `%s' is now considered the same file as `%s'", file->cmds->filename, file->cmds->lineno, oldname, name); ! error ("%s:%u: commands for `%s' will be ignored \ ! in favor of those for `%s", file->cmds->filename, file->cmds->lineno, name, oldname); } --- 188,207 ---- { if (oldfile->cmds == 0) oldfile->cmds = file->cmds; ! else if (file->cmds != oldfile->cmds) { /* We have two sets of commands. We will go with the one given in the rule explicitly mentioning this name, but give a message to let the user know what's going on. */ ! error ("%s:%u: Commands were specified for file `%s' at %s:%u,", file->cmds->filename, file->cmds->lineno, oldname, oldfile->cmds->filename, oldfile->cmds->lineno); ! error ("%s:%u: but `%s' is now considered the same file \ ! as `%s'.", file->cmds->filename, file->cmds->lineno, oldname, name); ! error ("%s:%u: Commands for `%s' will be ignored \ ! in favor of those for `%s'.", file->cmds->filename, file->cmds->lineno, name, oldname); } *************** *** 459,465 **** printf ("\n# %u files in %u hash buckets.\n", nfiles, FILE_BUCKETS); #ifndef NO_FLOAT printf ("# average %.1f files per bucket, max %u files in one bucket.\n", ! ((double) nfiles) * 100.0 / (double) FILE_BUCKETS, per_bucket); #endif } } --- 460,466 ---- printf ("\n# %u files in %u hash buckets.\n", nfiles, FILE_BUCKETS); #ifndef NO_FLOAT printf ("# average %.1f files per bucket, max %u files in one bucket.\n", ! ((double) FILE_BUCKETS) / ((double) nfiles) * 100.0, per_bucket); #endif } } diff -rc make-3.58/file.h make-3.59/file.h *** make-3.58/file.h Wed Jan 3 23:51:08 1990 --- make-3.59/file.h Fri Jul 6 05:18:36 1990 *************** *** 54,60 **** cs_deps_running, /* Dep commands running. */ cs_running, /* Commands running. */ cs_finished, /* Commands finished. */ ! cs_invalid, } command_state ENUM_BITFIELD (2); unsigned int double_colon:1;/* Nonzero for double-colon entry */ --- 54,60 ---- cs_deps_running, /* Dep commands running. */ cs_running, /* Commands running. */ cs_finished, /* Commands finished. */ ! cs_invalid } command_state ENUM_BITFIELD (2); unsigned int double_colon:1;/* Nonzero for double-colon entry */ diff -rc make-3.58/function.c make-3.59/function.c *** make-3.58/function.c Tue Jan 30 17:04:07 1990 --- make-3.59/function.c Thu Sep 13 17:53:57 1990 *************** *** 47,53 **** if (slen == 0 && !by_word && !suffix_only) { ! /* The first occurence of "" in any string is its end. */ o = variable_buffer_output (o, t, strlen (t)); if (rlen > 0) o = variable_buffer_output (o, replace, rlen); --- 47,53 ---- if (slen == 0 && !by_word && !suffix_only) { ! /* The first occurrence of "" in any string is its end. */ o = variable_buffer_output (o, t, strlen (t)); if (rlen > 0) o = variable_buffer_output (o, replace, rlen); *************** *** 56,62 **** while ((p = sindex (t, 0, subst, slen)) != 0) { ! /* Output everything before this occurence of the string to replace. */ if (p > t) o = variable_buffer_output (o, t, p - t); --- 56,62 ---- while ((p = sindex (t, 0, subst, slen)) != 0) { ! /* Output everything before this occurrence of the string to replace. */ if (p > t) o = variable_buffer_output (o, t, p - t); *************** *** 324,329 **** --- 324,332 ---- case function_shell: { + extern int fork (); + extern int pipe (); + char **argv; char buf[100]; int pipedes[2]; int pid; *************** *** 331,336 **** --- 334,344 ---- /* Expand the command line. */ text = expand_argument (text, end); + /* Construct the argument list. */ + argv = construct_command_argv (text, (struct file *) 0); + if (argv == 0) + break; + /* For error messages. */ if (reading_filename != 0) sprintf (buf, "%s:%u: ", reading_filename, *reading_lineno_ptr); *************** *** 343,357 **** break; } ! block_children (); pid = fork (); if (pid < 0) perror_with_name (buf, "fork"); else if (pid == 0) ! child_execute_job (0, pipedes[1], (struct file *) 0, ! construct_command_argv (text, (struct file *) 0), ! environ); else { /* We are the parent. Set up and read from the pipe. */ --- 351,363 ---- break; } ! push_signals_blocked_p (1); pid = fork (); if (pid < 0) perror_with_name (buf, "fork"); else if (pid == 0) ! child_execute_job (0, pipedes[1], argv, environ); else { /* We are the parent. Set up and read from the pipe. */ *************** *** 363,370 **** shell_function_pid = pid; shell_function_completed = 0; - unblock_children (); - /* Close the write side of the pipe. */ (void) close (pipedes[1]); --- 369,374 ---- *************** *** 427,435 **** --- 431,443 ---- } } + free (argv[0]); + free ((char *) argv); free (buffer); } + pop_signals_blocked_p (); + free (text); break; } *************** *** 934,940 **** p = expand_argument (p + 1, end); ! /* Find the first occurence of the first string in the second. */ i = strlen (text); if (sindex (p, 0, text, i) != 0) o = variable_buffer_output (o, text, i); --- 942,948 ---- p = expand_argument (p + 1, end); ! /* Find the first occurrence of the first string in the second. */ i = strlen (text); if (sindex (p, 0, text, i) != 0) o = variable_buffer_output (o, text, i); *************** *** 1028,1034 **** --p; if (p >= p2) { ! ++p; o = variable_buffer_output (o, p, len - (p - p2)); } else if (function == function_notdir) --- 1036,1043 ---- --p; if (p >= p2) { ! if (function == function_notdir) ! ++p; o = variable_buffer_output (o, p, len - (p - p2)); } else if (function == function_notdir) *************** *** 1035,1042 **** o = variable_buffer_output (o, p2, len); if (function == function_notdir || p >= p2) ! o = variable_buffer_output (o, " ", 1); ! doneany = 1; } if (doneany) /* Kill last space. */ --- 1044,1053 ---- o = variable_buffer_output (o, p2, len); if (function == function_notdir || p >= p2) ! { ! o = variable_buffer_output (o, " ", 1); ! doneany = 1; ! } } if (doneany) /* Kill last space. */ *************** *** 1161,1166 **** free (name); } ! result[idx] = '\0'; return result; } --- 1172,1182 ---- free (name); } ! /* Kill the last space and terminate the string. */ ! if (idx == 0) ! result[0] = '\0'; ! else ! result[idx - 1] = '\0'; ! return result; } diff -rc make-3.58/glob.c make-3.59/glob.c *** make-3.58/glob.c Wed Oct 4 01:12:49 1989 --- make-3.59/glob.c Sat Jun 16 00:08:49 1990 *************** *** 1,5 **** /* File-name wildcard pattern matching for GNU. ! Copyright (C) 1985, 1988, 1989 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,5 ---- /* File-name wildcard pattern matching for GNU. ! Copyright (C) 1985, 1988, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** *** 21,80 **** #include ! #if defined(USGr3) || defined(DIRENT) ! #include #define direct dirent ! #define D_NAMLEN(d) strlen((d)->d_name) ! ! #else /* Not USGr3 and not DIRENT. */ ! #define D_NAMLEN(d) ((d)->d_namlen) ! # ifdef USG ! #include "ndir.h" /* Get ndir.h from the Emacs distribution. */ ! # else /* Not USG. */ #include ! # endif /* USG. */ ! #endif /* USGr3 or DIRENT. */ #ifdef USG - #include #include ! #define bcopy(s, d, n) ((void) memcpy ((d), (s), (n))) ! #define rindex strrchr ! #else /* not USG */ #include - extern void bcopy (); #endif /* not USG */ ! #ifdef __GNUC__ ! #define alloca(n) __builtin_alloca (n) ! #else /* Not GCC. */ ! #ifdef sparc ! #include ! #else /* Not sparc. */ ! extern char *alloca (); ! #endif /* sparc. */ ! #endif /* GCC. */ ! ! extern char *malloc (), *realloc (); extern void free (); #ifndef NULL #define NULL 0 #endif ! /* Global variable which controls whether or not * matches .*. ! Non-zero means don't match .*. */ ! int noglob_dot_filenames = 1; static int glob_match_after_star (); /* Return nonzero if PATTERN has any special globbing chars in it. */ int glob_pattern_p (pattern) char *pattern; --- 21,88 ---- #include ! #if defined(USGr3) || defined(DIRENT) || defined(__GNU_LIBRARY__) #include #define direct dirent ! #define D_NAMLEN(d) strlen((d)->d_name) ! #else /* not USGr3 or DIRENT or __GNU_LIBRARY__ */ #define D_NAMLEN(d) ((d)->d_namlen) ! #ifdef USG ! #ifdef SYSNDIR ! #include ! #else ! #include "ndir.h" /* Get ndir.h from the Emacs distribution. */ ! #endif /* not SYSNDIR */ ! #else /* not USG */ #include ! #endif /* USG */ ! #endif /* USGr3 */ ! #if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__) ! #include ! #include ! #define bcopy(s, d, n) memcpy ((d), (s), (n)) ! #define index strchr ! #define rindex strrchr ! #else #ifdef USG #include ! #include ! #define bcopy(s, d, n) memcpy ((d), (s), (n)) ! #define index strchr ! #define rindex strrchr #else /* not USG */ #include extern void bcopy (); #endif /* not USG */ ! extern char *malloc (); ! extern char *realloc (); extern void free (); #ifndef NULL #define NULL 0 #endif + #endif /* Not STDC_HEADERS or __GNU_LIBRARY__. */ ! #ifdef __GNUC__ ! #define alloca __builtin_alloca ! #else /* Not GCC. */ ! #ifdef sparc ! #include ! #else /* Not sparc. */ ! extern char *alloca (); ! #endif /* sparc. */ ! #endif /* GCC. */ + /* Nonzero if '*' and '?' do not match an initial '.' for glob_filename. */ + int noglob_dot_filenames = 1; static int glob_match_after_star (); /* Return nonzero if PATTERN has any special globbing chars in it. */ + int glob_pattern_p (pattern) char *pattern; *************** *** 98,103 **** --- 106,112 ---- return 0; } + /* Match the pattern PATTERN against the string TEXT; return 1 if it matches, 0 otherwise. *************** *** 151,157 **** register char c1 = *t++; int invert; ! invert = *p == '!'; if (invert) p++; --- 160,170 ---- register char c1 = *t++; int invert; ! if (c1 == '\0') ! return 0; ! ! invert = (*p == '!'); ! if (invert) p++; *************** *** 166,175 **** cend = cstart; } ! if (c == '\0') ! return 0; c = *p++; if (c == '-') { cend = *p++; --- 179,189 ---- cend = cstart; } ! if (cstart == '\0') ! return 0; /* Missing ']'. */ c = *p++; + if (c == '-') { cend = *p++; *************** *** 191,204 **** match: /* Skip the rest of the [...] construct that already matched. */ while (c != ']') ! { if (c == '\0') return 0; c = *p++; if (c == '\0') return 0; ! else if (c == '\\') ! ++p; } if (invert) return 0; --- 205,218 ---- match: /* Skip the rest of the [...] construct that already matched. */ while (c != ']') ! { if (c == '\0') return 0; c = *p++; if (c == '\0') return 0; ! if (c == '\\') ! p++; } if (invert) return 0; *************** *** 234,242 **** else c1 = c; while (1) { ! if ((c == '[' || *t == c1) && glob_match (p - 1, t, 0)) return 1; if (*t++ == '\0') return 0; --- 248,257 ---- else c1 = c; + --p; while (1) { ! if ((c == '[' || *t == c1) && glob_match (p, t, 0)) return 1; if (*t++ == '\0') return 0; *************** *** 246,252 **** /* Return a vector of names of files in directory DIR whose names match glob pattern PAT. The names are not in any particular order. ! Wildcards at the beginning of PAT do not match an initial period. The vector is terminated by an element that is a null pointer. --- 261,268 ---- /* Return a vector of names of files in directory DIR whose names match glob pattern PAT. The names are not in any particular order. ! Wildcards at the beginning of PAT do not match an initial period ! if noglob_dot_filenames is nonzero. The vector is terminated by an element that is a null pointer. *************** *** 253,259 **** To free the space allocated, first free the vector's elements, then free the vector. ! Return 0 if cannot get enough memory to hold the pointer and the names. Return -1 if cannot access directory DIR. --- 269,275 ---- To free the space allocated, first free the vector's elements, then free the vector. ! Return NULL if cannot get enough memory to hold the pointer and the names. Return -1 if cannot access directory DIR. *************** *** 265,274 **** char *dir; { struct globval ! { ! struct globval *next; ! char *name; ! }; DIR *d; register struct direct *dp; --- 281,290 ---- char *dir; { struct globval ! { ! struct globval *next; ! char *name; ! }; DIR *d; register struct direct *dp; *************** *** 284,290 **** if (d == NULL) return (char **) -1; ! lastlink = 0; count = 0; lose = 0; --- 300,306 ---- if (d == NULL) return (char **) -1; ! lastlink = NULL; count = 0; lose = 0; *************** *** 302,308 **** { nextlink = (struct globval *) alloca (sizeof (struct globval)); nextlink->next = lastlink; ! nextname = (char *) malloc (D_NAMLEN(dp) + 1); if (nextname == NULL) { lose = 1; --- 318,325 ---- { nextlink = (struct globval *) alloca (sizeof (struct globval)); nextlink->next = lastlink; ! i = D_NAMLEN (dp) + 1; ! nextname = (char *) malloc (i); if (nextname == NULL) { lose = 1; *************** *** 310,320 **** } lastlink = nextlink; nextlink->name = nextname; ! bcopy (dp->d_name, nextname, D_NAMLEN(dp) + 1); ! ++count; } } ! (void) closedir (d); if (!lose) { --- 327,337 ---- } lastlink = nextlink; nextlink->name = nextname; ! bcopy (dp->d_name, nextname, i); ! count++; } } ! closedir (d); if (!lose) { *************** *** 345,352 **** return name_vector; } ! /* Return a new array which is the concatenation ! of each string in ARRAY to DIR. */ static char ** glob_dir_to_array (dir, array) --- 362,370 ---- return name_vector; } ! /* Return a new array, replacing ARRAY, which is the concatenation ! of each string in ARRAY to DIR. ! Return NULL if out of memory. */ static char ** glob_dir_to_array (dir, array) *************** *** 353,359 **** char *dir, **array; { register unsigned int i, l; ! int add_slash; char **result; l = strlen (dir); --- 371,377 ---- char *dir, **array; { register unsigned int i, l; ! int add_slash = 0; char **result; l = strlen (dir); *************** *** 360,370 **** if (l == 0) return array; ! add_slash = dir[l - 1] != '/'; ! i = 0; ! while (array[i] != NULL) ! ++i; result = (char **) malloc ((i + 1) * sizeof (char *)); if (result == NULL) --- 378,388 ---- if (l == 0) return array; ! if (dir[l - 1] != '/') ! add_slash++; ! for (i = 0; array[i] != NULL; i++) ! ; result = (char **) malloc ((i + 1) * sizeof (char *)); if (result == NULL) *************** *** 372,382 **** for (i = 0; array[i] != NULL; i++) { ! result[i] = (char *) malloc (l + (add_slash ? 1 : 0) ! + strlen (array[i]) + 1); if (result[i] == NULL) return NULL; ! sprintf (result[i], "%s%s%s", dir, add_slash ? "/" : "", array[i]); } result[i] = NULL; --- 390,402 ---- for (i = 0; array[i] != NULL; i++) { ! result[i] = (char *) malloc (1 + l + add_slash + strlen (array[i])); if (result[i] == NULL) return NULL; ! strcpy (result[i], dir); ! if (add_slash) ! result[i][l] = '/'; ! strcpy (result[i] + l + add_slash, array[i]); } result[i] = NULL; *************** *** 384,390 **** for (i = 0; array[i] != NULL; i++) free (array[i]); free ((char *) array); - return result; } --- 404,409 ---- *************** *** 392,398 **** marking the end of the array with a null-pointer as an element. If no pathnames match, then the array is empty (first element is null). If there isn't enough memory, then return NULL. ! If a file system error occurs, return -1; `errno' has the error code. */ char ** glob_filename (pathname) --- 411,420 ---- marking the end of the array with a null-pointer as an element. If no pathnames match, then the array is empty (first element is null). If there isn't enough memory, then return NULL. ! If a file system error occurs, return -1; `errno' has the error code. ! ! Wildcards at the beginning of PAT, or following a slash, ! do not match an initial period if noglob_dot_filenames is nonzero. */ char ** glob_filename (pathname) *************** *** 420,426 **** } else { ! directory_len = filename - pathname; directory_name = (char *) alloca (directory_len + 1); bcopy (pathname, directory_name, directory_len); directory_name[directory_len] = '\0'; --- 442,448 ---- } else { ! directory_len = (filename - pathname) + 1; directory_name = (char *) alloca (directory_len + 1); bcopy (pathname, directory_name, directory_len); directory_name[directory_len] = '\0'; *************** *** 427,436 **** ++filename; } if (glob_pattern_p (directory_name)) { - /* If directory_name contains globbing characters, then we - have to expand the previous levels. Just recurse. */ char **directories; register unsigned int i; --- 449,458 ---- ++filename; } + /* If directory_name contains globbing characters, then we + have to expand the previous levels. Just recurse. */ if (glob_pattern_p (directory_name)) { char **directories; register unsigned int i; *************** *** 440,446 **** directories = glob_filename (directory_name); if (directories == NULL) goto memory_error; ! else if ((int) directories == -1) return (char **) -1; else if (*directories == NULL) { --- 462,468 ---- directories = glob_filename (directory_name); if (directories == NULL) goto memory_error; ! else if (directories == (char **) -1) return (char **) -1; else if (*directories == NULL) { *************** *** 451,462 **** /* We have successfully globbed the preceding directory name. For each name in DIRECTORIES, call glob_vector on it and FILENAME. Concatenate the results together. */ ! for (i = 0; directories[i] != NULL; ++i) { char **temp_results = glob_vector (filename, directories[i]); if (temp_results == NULL) goto memory_error; ! else if ((int) temp_results == -1) /* This filename is probably not a directory. Ignore it. */ ; else --- 473,484 ---- /* We have successfully globbed the preceding directory name. For each name in DIRECTORIES, call glob_vector on it and FILENAME. Concatenate the results together. */ ! for (i = 0; directories[i] != NULL; i++) { char **temp_results = glob_vector (filename, directories[i]); if (temp_results == NULL) goto memory_error; ! else if (temp_results == (char **) -1) /* This filename is probably not a directory. Ignore it. */ ; else *************** *** 476,487 **** for (l = 0; array[l] != NULL; ++l) result[result_size++ - 1] = array[l]; result[result_size - 1] = NULL; - /* Note that the elements of ARRAY are not freed. */ free ((char *) array); } } /* Free the directories. */ ! for (i = 0; directories[i]; i++) free (directories[i]); free ((char *) directories); --- 498,508 ---- for (l = 0; array[l] != NULL; ++l) result[result_size++ - 1] = array[l]; result[result_size - 1] = NULL; free ((char *) array); } } /* Free the directories. */ ! for (i = 0; directories[i] != NULL; i++) free (directories[i]); free ((char *) directories); *************** *** 488,496 **** return result; } if (*filename == '\0') { - /* If there is only a directory name, return it. */ result = (char **) realloc ((char *) result, 2 * sizeof (char *)); if (result == NULL) return NULL; --- 509,517 ---- return result; } + /* If there is only a directory name, return it. */ if (*filename == '\0') { result = (char **) realloc ((char *) result, 2 * sizeof (char *)); if (result == NULL) return NULL; *************** *** 509,521 **** (directory_len == 0 ? "." : directory_name)); ! if (temp_results == NULL || (int) temp_results == -1) return temp_results; return glob_dir_to_array (directory_name, temp_results); } ! memory_error:; if (result != NULL) { register unsigned int i; --- 530,542 ---- (directory_len == 0 ? "." : directory_name)); ! if (temp_results == NULL || temp_results == (char **) -1) return temp_results; return glob_dir_to_array (directory_name, temp_results); } ! memory_error:; if (result != NULL) { register unsigned int i; *************** *** 532,551 **** int argc; char **argv; { ! unsigned int i; ! for (i = 1; i < argc; ++i) { ! char **value = glob_filename (argv[i]); if (value == NULL) ! puts ("Out of memory.") ! else if ((int) value == -1) ! perror (argv[i]); else for (i = 0; value[i] != NULL; i++) puts (value[i]); } - exit (0); } ! #endif /* TEST. */ --- 553,573 ---- int argc; char **argv; { ! char **value; ! int i, optind; ! for (optind = 1; optind < argc; optind++) { ! value = glob_filename (argv[optind]); if (value == NULL) ! puts ("virtual memory exhausted"); ! else if (value == (char **) -1) ! perror (argv[optind]); else for (i = 0; value[i] != NULL; i++) puts (value[i]); } exit (0); } ! ! #endif /* TEST */ diff -rc make-3.58/implicit.c make-3.59/implicit.c *** make-3.58/implicit.c Wed Jan 3 23:53:26 1990 --- make-3.59/implicit.c Fri Jul 6 04:35:51 1990 *************** *** 34,41 **** struct file *file; unsigned int depth; { - register char *filename; - DEBUGPR ("Looking for an implicit rule for `%s'.\n"); #ifndef NO_ARCHIVES --- 34,39 ---- *************** *** 43,56 **** archive member name to search for implicit rules. */ if (ar_name (file->name)) { - filename = index (file->name, '('); DEBUGPR ("Looking for archive-member implicit rule for `%s'.\n"); ! if (pattern_search (file, filename, depth, 0)) return 1; } #endif ! return pattern_search (file, (char *) 0, depth, 0); } #define DEBUGP2(msg, a1, a2) \ --- 41,53 ---- archive member name to search for implicit rules. */ if (ar_name (file->name)) { DEBUGPR ("Looking for archive-member implicit rule for `%s'.\n"); ! if (pattern_search (file, 1, depth, 0)) return 1; } #endif ! return pattern_search (file, 0, depth, 0); } #define DEBUGP2(msg, a1, a2) \ *************** *** 58,66 **** { print_spaces (depth); printf (msg, a1, a2); fflush (stdout); } else /* Search the pattern rules for a rule with an existing dependency to make ! NAME. If NAME is nil, FILE->name is used. If a rule is found, the ! appropriate commands and deps are put in FILE and 1 is returned. If not, ! 0 is returned. If an intermediate file is found by pattern search, the intermediate file is set up as a target by the recursive call and is also made a dependency --- 55,66 ---- { print_spaces (depth); printf (msg, a1, a2); fflush (stdout); } else /* Search the pattern rules for a rule with an existing dependency to make ! FILE. If a rule is found, the appropriate commands and deps are put in FILE ! and 1 is returned. If not, 0 is returned. ! ! If ARCHIVE is nonzero, FILE->name is of the form "LIB(MEMBER)". A rule for ! "(MEMBER)" will be searched for, and "(MEMBER)" will not be chopped up into ! directory and filename parts. If an intermediate file is found by pattern search, the intermediate file is set up as a target by the recursive call and is also made a dependency *************** *** 69,82 **** DEPTH is used for debugging messages. */ static int ! pattern_search (file, name, depth, recursions) struct file *file; ! char *name; unsigned int depth; unsigned int recursions; { /* Filename we are searching for a rule for. */ ! char *filename = name != 0 ? name : file->name; /* Length of FILENAME. */ unsigned int namelen = strlen (filename); --- 69,82 ---- DEPTH is used for debugging messages. */ static int ! pattern_search (file, archive, depth, recursions) struct file *file; ! int archive; unsigned int depth; unsigned int recursions; { /* Filename we are searching for a rule for. */ ! char *filename = archive ? index (file->name, '(') : file->name; /* Length of FILENAME. */ unsigned int namelen = strlen (filename); *************** *** 143,149 **** char *p; #ifndef NO_ARCHIVES ! if (ar_name (filename)) lastslash = 0; else #endif --- 143,149 ---- char *p; #ifndef NO_ARCHIVES ! if (archive || ar_name (filename)) lastslash = 0; else #endif *************** *** 391,398 **** bzero ((char *) intermediate_file, sizeof (struct file)); intermediate_file->name = p; ! if (pattern_search (intermediate_file, (char *) 0, ! depth + 1, recursions + 1)) { p = savestring (p, strlen (p)); intermediate_patterns[deps_found] --- 391,398 ---- bzero ((char *) intermediate_file, sizeof (struct file)); intermediate_file->name = p; ! if (pattern_search (intermediate_file, 0, depth + 1, ! recursions + 1)) { p = savestring (p, strlen (p)); intermediate_patterns[deps_found] *************** *** 554,564 **** idx = 0; for (i = 0; rule->targets[i] != 0; ++i) ! if (i == matches[foundrule]) ! continue; ! else { ! if (i == max_targets - 1) { max_targets += 5; file->also_make --- 554,562 ---- idx = 0; for (i = 0; rule->targets[i] != 0; ++i) ! if (i != matches[foundrule]) { ! if (idx == max_targets - 1) { max_targets += 5; file->also_make diff -rc make-3.58/job.c make-3.59/job.c *** make-3.58/job.c Sat Jan 20 15:21:05 1990 --- make-3.59/job.c Wed Sep 26 05:28:07 1990 *************** *** 23,28 **** --- 23,34 ---- #include "variable.h" #include + /* Default path to search for executables. */ + static char default_path[] = ":/bin:/usr/bin"; + + /* Default shell to use. */ + char default_shell[] = "/bin/sh"; + extern int errno; #if defined(USG) && !defined(HAVE_VFORK) *************** *** 77,86 **** extern int fork (), wait (), execve (); extern void _exit (); extern int geteuid (), getegid (); ! ! #if !defined(USG) && !defined(sigmask) ! #define sigmask(sig) (1 << ((sig) - 1)) ! #endif #ifndef USG extern int getdtablesize (); --- 83,89 ---- extern int fork (), wait (), execve (); extern void _exit (); extern int geteuid (), getegid (); ! extern int setgid (), getgid (); #ifndef USG extern int getdtablesize (); *************** *** 143,176 **** extern void block_remote_children (), unblock_remote_children (); ! /* Block the child termination signal. */ ! void ! block_children () { #ifdef USG /* Ignoring SIGCLD makes wait always return -1. Using the default action does the right thing. */ (void) signal (SIGCLD, SIG_DFL); ! #else ! (void) sigblock (sigmask (SIGCHLD)); #endif block_remote_children (); } ! /* Unblock the child termination signal. */ ! void ! unblock_children () { #ifdef USG (void) signal (SIGCLD, child_handler); ! #else ! (void) sigsetmask (sigblock (0) & ~sigmask (SIGCHLD)); #endif unblock_remote_children (); } extern int shell_function_pid, shell_function_completed; --- 146,270 ---- extern void block_remote_children (), unblock_remote_children (); ! extern int fatal_signal_mask; ! #ifdef USG ! /* Set nonzero in the interval when it's possible that we may see a dead ! child that's not in the `children' chain. */ ! static int unknown_children_possible = 0; ! #endif ! ! ! /* Block the child termination signal and fatal signals. */ ! ! static void ! block_signals () { #ifdef USG + + /* Tell child_handler that it might see children that aren't yet + in the `children' chain. */ + unknown_children_possible = 1; + /* Ignoring SIGCLD makes wait always return -1. Using the default action does the right thing. */ (void) signal (SIGCLD, SIG_DFL); ! ! #else /* Not USG. */ ! ! /* Block the signals. */ ! (void) sigblock (fatal_signal_mask | sigmask (SIGCHLD)); ! #endif block_remote_children (); } ! /* Unblock the child termination signal and fatal signals. */ ! static void ! unblock_signals () { #ifdef USG + (void) signal (SIGCLD, child_handler); ! ! /* It should no longer be possible for children not in the chain to die. */ ! unknown_children_possible = 0; ! ! #else /* Not USG. */ ! ! /* Unblock the signals. */ ! (void) sigsetmask (sigblock (0) & ~(fatal_signal_mask | sigmask (SIGCHLD))); ! #endif unblock_remote_children (); } + + static char *signals_blocked_p_stack = 0; + static unsigned int signals_blocked_p_max; + static unsigned int signals_blocked_p_depth; + + /* Make signals blocked in FLAG is nonzero, unblocked if FLAG is zero. + Push this setting on the signals_blocked_p_stack, so it can be + popped off by pop_signals_blocked_p. */ + + void + push_signals_blocked_p (flag) + int flag; + { + int blocked; + + if (signals_blocked_p_stack == 0) + { + signals_blocked_p_max = 8; + signals_blocked_p_stack = (char *) xmalloc (8); + signals_blocked_p_depth = 1; + signals_blocked_p_stack[0] = flag; + + blocked = 0; + } + else + { + if (signals_blocked_p_depth == signals_blocked_p_max) + { + signals_blocked_p_max += 8; + signals_blocked_p_stack + = (char *) xrealloc(signals_blocked_p_stack, + signals_blocked_p_max); + } + + blocked = (signals_blocked_p_depth > 0 + && signals_blocked_p_stack[signals_blocked_p_depth - 1]); + + signals_blocked_p_stack[++signals_blocked_p_depth - 1] = flag; + } + + if (blocked && !flag) + unblock_signals (); + else if (flag && !blocked) + block_signals (); + } + + /* Pop the signals_blocked_p setting from the stack + and block or unblock signals as appropriate. */ + + void + pop_signals_blocked_p () + { + int blocked, block; + + blocked = (signals_blocked_p_depth > 0 + && signals_blocked_p_stack[signals_blocked_p_depth-- - 1]); + + block = (signals_blocked_p_depth > 0 + && signals_blocked_p_stack[signals_blocked_p_depth - 1]); + + if (block && !blocked) + block_signals (); + else if (blocked && !block) + unblock_signals (); + } extern int shell_function_pid, shell_function_completed; *************** *** 193,199 **** unsigned int dead_children = 0; if (sig > 0) ! block_remote_children (); while (1) { --- 287,293 ---- unsigned int dead_children = 0; if (sig > 0) ! block_signals (); while (1) { *************** *** 270,282 **** if (c == 0) { /* An unknown child died. */ ! char buf[100]; ! sprintf (buf, "Unknown%s job %d", remote ? " remote" : "", pid); ! if (child_failed) ! child_error (buf, exit_code, exit_sig, coredump, ! ignore_errors_flag); ! else ! error ("%s finished.", buf); } else { --- 364,383 ---- if (c == 0) { /* An unknown child died. */ ! #ifdef USG ! if (!unknown_children_possible) ! { ! #endif ! char buf[100]; ! sprintf (buf, "Unknown%s job %d", remote ? " remote" : "", pid); ! if (child_failed) ! child_error (buf, exit_code, exit_sig, coredump, ! ignore_errors_flag); ! else ! error ("%s finished.", buf); ! #ifdef USG ! } ! #endif } else { *************** *** 305,310 **** --- 406,412 ---- /* If there are more commands to run, try to start them. */ start_job (c); + switch (c->file->command_state) { case cs_running: *************** *** 358,368 **** #ifdef USG if (sig > 0) ! (void) signal (sig, child_handler); #endif if (sig > 0) ! unblock_remote_children (); return 0; } --- 460,470 ---- #ifdef USG if (sig > 0) ! (void) SIGNAL (sig, child_handler); #endif if (sig > 0) ! unblock_signals (); return 0; } *************** *** 378,384 **** unsigned int n; int err; { ! block_children (); if (err && (children != 0 || shell_function_pid != 0)) { --- 480,486 ---- unsigned int n; int err; { ! push_signals_blocked_p (1); if (err && (children != 0 || shell_function_pid != 0)) { *************** *** 389,395 **** /* Call child_handler to do the work. */ (void) child_handler (- (int) n); ! unblock_children (); } /* Free the storage allocated for CHILD. */ --- 491,497 ---- /* Call child_handler to do the work. */ (void) child_handler (- (int) n); ! pop_signals_blocked_p (); } /* Free the storage allocated for CHILD. */ *************** *** 417,443 **** char noprint = 0, recursive; char **argv; if (child->command_ptr == 0 || *child->command_ptr == '\0') ! /* There are no more lines in the expansion of this line. */ ! if (child->file->cmds->command_lines[child->command_line] == 0) ! { ! /* There are no more lines to be expanded. */ ! child->command_ptr = 0; ! child->file->command_state = cs_finished; ! child->file->update_status = 0; ! return; ! } ! else ! { ! /* Expand and run the next line. */ child->command_ptr = child->commands ! = allocated_variable_expand_for_file ! (child->file->cmds->command_lines[child->command_line++], ! child->file); ! } ! ! /* Set RECURSIVE if the unexpanded line contains $(MAKE). */ ! recursive = child->file->cmds->lines_recurse[child->command_line - 1]; /* Find the end of this line. Backslash-newlines don't mean the end. */ --- 519,543 ---- char noprint = 0, recursive; char **argv; + /* Set RECURSIVE if the unexpanded line contains $(MAKE). */ + recursive = child->file->cmds->lines_recurse[child->command_line]; + if (child->command_ptr == 0 || *child->command_ptr == '\0') ! { ! /* There are no more lines in the expansion of this line. */ ! if (child->command_line == child->file->cmds->ncommand_lines) ! { ! /* There are no more lines to be expanded. */ ! child->command_ptr = 0; ! child->file->command_state = cs_finished; ! child->file->update_status = 0; ! return; ! } ! else ! /* Get the next line to run. */ child->command_ptr = child->commands ! = child->command_lines[child->command_line++]; ! } /* Find the end of this line. Backslash-newlines don't mean the end. */ *************** *** 502,509 **** p = next_token (p); if (*p == '\0') - /* There were no commands on this line. Go to the next. */ { start_job (child); return; } --- 602,609 ---- p = next_token (p); if (*p == '\0') { + /* There were no commands on this line. Go to the next. */ start_job (child); return; } *************** *** 529,534 **** --- 629,641 ---- argv = construct_command_argv (p, child->file); + if (argv == 0) + { + /* This line has no commands. Go to the next. */ + start_job (child); + return; + } + /* Flush the output streams so they won't have things written twice. */ fflush (stdout); *************** *** 595,601 **** if (child->pid == 0) /* We are the child side. */ child_execute_job (child->good_stdin ? 0 : bad_stdin, 1, ! child->file, argv, child->environment); else if (child->pid < 0) { /* Fork failed! */ --- 702,708 ---- if (child->pid == 0) /* We are the child side. */ child_execute_job (child->good_stdin ? 0 : bad_stdin, 1, ! argv, child->environment); else if (child->pid < 0) { /* Fork failed! */ *************** *** 608,613 **** --- 715,726 ---- say the commands are running and return. */ child->file->command_state = cs_running; + + /* Free the storage used by the child's argument list. */ + + free (argv[0]); + free ((char *) argv); + return; error:; *************** *** 625,630 **** --- 738,745 ---- extern unsigned int files_remade; register struct commands *cmds = file->cmds; register struct child *c; + char **lines; + register unsigned int i; /* Chop the commands up into lines if they aren't already. */ chop_commands (cmds); *************** *** 634,646 **** while (job_slots_used == job_slots) wait_for_children (1, 0); /* Start the command sequence, record it in a new `struct child', and add that to the chain. */ ! block_children (); c = (struct child *) xmalloc (sizeof (struct child)); c->file = file; c->command_line = 0; c->command_ptr = c->commands = 0; c->environment = 0; --- 749,768 ---- while (job_slots_used == job_slots) wait_for_children (1, 0); + /* Expand the command lines and store the results in LINES. */ + lines = (char **) xmalloc (cmds->ncommand_lines * sizeof (char *)); + for (i = 0; i < cmds->ncommand_lines; ++i) + lines[i] = allocated_variable_expand_for_file (cmds->command_lines[i], + file); + /* Start the command sequence, record it in a new `struct child', and add that to the chain. */ ! push_signals_blocked_p (1); c = (struct child *) xmalloc (sizeof (struct child)); c->file = file; + c->command_lines = lines; c->command_line = 0; c->command_ptr = c->commands = 0; c->environment = 0; *************** *** 666,672 **** break; } ! unblock_children (); ++files_remade; --- 788,794 ---- break; } ! pop_signals_blocked_p (); ++files_remade; *************** *** 680,693 **** } /* Replace the current process with one executing the command in ARGV. ! STDIN_FD and STDOUT_FD are used as the process's stdin and stdout; ! FILE, if not nil, is used as the variable-set to expand `PATH' and `SHELL'; ! ENVP is the environment of the new program. This function won't return. */ void ! child_execute_job (stdin_fd, stdout_fd, file, argv, envp) int stdin_fd, stdout_fd; - struct file *file; char **argv, **envp; { if (stdin_fd != 0) --- 802,813 ---- } /* Replace the current process with one executing the command in ARGV. ! STDIN_FD and STDOUT_FD are used as the process's stdin and stdout; ENVP is ! the environment of the new program. This function does not return. */ void ! child_execute_job (stdin_fd, stdout_fd, argv, envp) int stdin_fd, stdout_fd; char **argv, **envp; { if (stdin_fd != 0) *************** *** 703,715 **** (void) close (d); } ! /* Don't block children for our child. */ ! unblock_children (); /* Run the command. */ ! exec_command (argv, envp, ! allocated_variable_expand_for_file ("$(PATH)", file), ! allocated_variable_expand_for_file ("$(SHELL)", file)); } /* Search PATH for FILE, returning a full pathname or nil. --- 823,833 ---- (void) close (d); } ! /* Don't block signals for the new process. */ ! unblock_signals (); /* Run the command. */ ! exec_command (argv, envp); } /* Search PATH for FILE, returning a full pathname or nil. *************** *** 719,725 **** search_path (file, path) char *file, *path; { ! if (*path == '\0' || index (file, '/') != 0) return file; else { --- 837,846 ---- search_path (file, path) char *file, *path; { ! if (path == 0 || path[0] == '\0') ! path = default_path; ! ! if (index (file, '/') != 0) return file; else { *************** *** 788,804 **** } /* Replace the current process with one running the command in ARGV, ! with environment ENVP. The program named in ARGV[0] is searched ! for in PATH. SHELL is the shell program to run for shell scripts. ! This function does not return. */ void ! exec_command (argv, envp, path, shell) char **argv, **envp; - char *path, *shell; { char *program; program = search_path (argv[0], path); if (program == 0) error ("%s: Command not found", argv[0]); --- 909,939 ---- } /* Replace the current process with one running the command in ARGV, ! with environment ENVP. This function does not return. */ void ! exec_command (argv, envp) char **argv, **envp; { + char *shell, *path; char *program; + register char **ep; + shell = path = 0; + for (ep = envp; *ep != 0; ++ep) + { + if (shell == 0 && !strncmp(*ep, "SHELL=", 6)) + shell = &(*ep)[6]; + else if (path == 0 && !strncmp(*ep, "PATH=", 5)) + path = &(*ep)[5]; + else if (path != 0 && shell != 0) + break; + } + + /* Make might be installed set-gid kmem so the load-average code + works, so we want to make sure we use the real gid. */ + (void) setgid (getgid ()); + program = search_path (argv[0], path); if (program == 0) error ("%s: Command not found", argv[0]); *************** *** 809,815 **** if (errno == ENOEXEC) { ! char *shell_path = search_path (shell, path); if (shell_path == 0) error ("%s: Shell program not found", shell); else --- 944,951 ---- if (errno == ENOEXEC) { ! char *shell_path = (shell != 0 ? search_path (shell, path) : ! default_shell); if (shell_path == 0) error ("%s: Shell program not found", shell); else *************** *** 847,859 **** characters in sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[] is the first word of a line, the shell is used. ! FILE is the target whose commands these are. It is used for ! variable expansion for $(SHELL) and $(IFS). */ ! char ** ! construct_command_argv (line, file) char *line; ! struct file *file; { static char sh_chars[] = "#;\"*?[]&|<>(){}=$`"; static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login", --- 983,995 ---- characters in sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[] is the first word of a line, the shell is used. ! SHELL is the shell to use, or nil to use the default shell. ! IFS is the value of $IFS, or nil (meaning the default). */ ! static char ** ! construct_command_argv_internal (line, shell, ifs) char *line; ! char *shell, *ifs; { static char sh_chars[] = "#;\"*?[]&|<>(){}=$`"; static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login", *************** *** 869,881 **** char **new_argv = 0; /* See if it is safe to parse commands internally. */ ! p = variable_expand_for_file ("$(SHELL)", file); ! if (strcmp (p, "/bin/sh")) goto slow; ! p = variable_expand_for_file ("$(IFS)", file); ! for (ap = p; *ap != '\0'; ++ap) ! if (*ap != ' ' && *ap != '\t' && *ap != '\n') ! goto slow; i = strlen (line) + 1; --- 1005,1017 ---- char **new_argv = 0; /* See if it is safe to parse commands internally. */ ! if (shell != 0 && strcmp (shell, default_shell)) goto slow; ! ! if (ifs != 0) ! for (ap = ifs; *ap != '\0'; ++ap) ! if (*ap != ' ' && *ap != '\t' && *ap != '\n') ! goto slow; i = strlen (line) + 1; *************** *** 949,954 **** --- 1085,1094 ---- } } + if (instring) + /* Let the shell deal with an unterminated quote. */ + goto slow; + /* Terminate the last argument and the argument list. */ *ap = '\0'; *************** *** 963,978 **** return new_argv; slow:; if (new_argv != 0) ! free (new_argv); ! new_argv = (char **) xmalloc (4 * sizeof (char *)); ! new_argv[0] = allocated_variable_expand_for_file ("$(SHELL)", file); ! new_argv[1] = "-c"; ! new_argv[2] = line; ! new_argv[3] = 0; return new_argv; } #if defined(USG) && !defined(HAVE_SIGLIST) /* Initialize sys_siglist. */ --- 1103,1189 ---- return new_argv; slow:; + /* We must use the shell. */ + if (new_argv != 0) ! { ! /* Free the old argument list we were working on. */ ! free (new_argv[0]); ! free (new_argv); ! } ! ! if (shell == 0 || !strcmp (shell, default_shell)) ! { ! /* The shell is the default, or we're in a recursive call to construct ! the argument list for the real shell. Construct a simple argument ! list using the default shell. */ ! new_argv = (char **) xmalloc (4 * sizeof (char *)); ! new_argv[0] = savestring (default_shell, sizeof (default_shell) - 1); ! new_argv[1] = "-c"; ! new_argv[2] = savestring (line, strlen (line)); ! new_argv[3] = 0; ! } ! else ! { ! /* SHELL may be a multi-word command. Construct a command line ! "SHELL -c LINE", with all special chars in LINE escaped. ! Then recurse, expanding this command line to get the final ! argument list. */ ! ! unsigned int shell_len = strlen (shell); ! static char minus_c[] = " -c "; ! unsigned int line_len = strlen (line); ! ! char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1) ! + (line_len * 2) + 1); ! ! ap = new_line; ! bcopy (shell, ap, shell_len); ! ap += shell_len; ! bcopy (minus_c, ap, sizeof (minus_c) - 1); ! ap += sizeof (minus_c) - 1; ! for (p = line; *p != '\0'; ++p) ! { ! if (*p == '\'' ! || *p == ' ' || *p == '\t' || *p == '\n' ! || index (sh_chars, *p) != 0) ! *ap++ = '\\'; ! *ap++ = *p; ! } ! *ap = '\0'; + new_argv = construct_command_argv_internal (new_line, + (char *) 0, (char *) 0); + } + return new_argv; } + + /* Figure out the argument list necessary to run LINE as a command. + Try to avoid using a shell. This routine handles only ' quoting. + Starting quotes may be escaped with a backslash. If any of the + characters in sh_chars[] is seen, or any of the builtin commands + listed in sh_cmds[] is the first word of a line, the shell is used. + + FILE is the target whose commands these are. It is used for + variable expansion for $(SHELL) and $(IFS). */ + + char ** + construct_command_argv (line, file) + char *line; + struct file *file; + { + char *shell = allocated_variable_expand_for_file ("$(SHELL)", file); + char *ifs = allocated_variable_expand_for_file ("$(IFS)", file); + char **argv; + + argv = construct_command_argv_internal (line, shell, ifs); + + free (shell); + free (ifs); + + return argv; + } #if defined(USG) && !defined(HAVE_SIGLIST) /* Initialize sys_siglist. */ *************** *** 1042,1053 **** --- 1253,1268 ---- case SIGTERM: sys_siglist[i] = "Terminated"; break; + #if !defined (SIGIO) || SIGUSR1 != SIGIO case SIGUSR1: sys_siglist[i] = "User-defined signal 1"; break; + #endif + #if !defined (SIGURG) || SIGUSR2 != SIGURG case SIGUSR2: sys_siglist[i] = "User-defined signal 2"; break; + #endif #ifdef SIGCLD case SIGCLD: #endif diff -rc make-3.58/job.h make-3.59/job.h *** make-3.58/job.h Sat Oct 14 15:15:23 1989 --- make-3.59/job.h Wed Sep 19 03:03:18 1990 *************** *** 10,16 **** char *commands; /* Commands being executed. */ char *command_ptr; /* Pointer into above. */ ! unsigned int command_line; /* Index into file->cmds->command_lines. */ int pid; /* Child process's ID number. */ unsigned int remote:1; /* Nonzero if executing remotely. */ --- 10,17 ---- char *commands; /* Commands being executed. */ char *command_ptr; /* Pointer into above. */ ! char **command_lines; /* Array of variable-expanded cmd lines. */ ! unsigned int command_line; /* Index into above. */ int pid; /* Child process's ID number. */ unsigned int remote:1; /* Nonzero if executing remotely. */ *************** *** 25,31 **** extern void new_job (); extern void wait_for_children (); ! extern void block_children (), unblock_children (); extern char **construct_command_argv (); extern void child_execute_job (); --- 26,32 ---- extern void new_job (); extern void wait_for_children (); ! extern void push_signals_blocked_p (), pop_signals_blocked_p (); extern char **construct_command_argv (); extern void child_execute_job (); diff -rc make-3.58/load.c make-3.59/load.c *** make-3.58/load.c Sat Jan 20 14:54:09 1990 --- make-3.59/load.c Thu Nov 22 17:46:04 1990 *************** *** 32,38 **** #include #include #include - #include #include #ifdef UMAX_43 --- 32,37 ---- *************** *** 42,47 **** --- 41,47 ---- #include #include #else /* Not UMAX_43. */ + #include #include #include #include *************** *** 120,125 **** --- 120,129 ---- #ifndef NO_LDAV #define LDAV_BASED + + #if defined(hp300) && defined(BSD) + #define LDAV_CVT (((double) load) / 2048.0) + #endif #ifndef KERNEL_FILE_NAME #define KERNEL_FILE_NAME "/vmunix" diff -rc make-3.58/main.c make-3.59/main.c *** make-3.58/main.c Thu Feb 1 20:29:23 1990 --- make-3.59/main.c Tue Oct 23 19:38:03 1990 *************** *** 54,60 **** flags () {} #endif /* Flags: ! * -b ignored for compatability with System V Make * -C change directory * -d debug * -e env_overrides --- 54,60 ---- flags () {} #endif /* Flags: ! * -b ignored for compatibility with System V Make * -C change directory * -d debug * -e env_overrides *************** *** 89,101 **** string, /* One string per switch, may be in the same word. */ positive_int, /* A positive integer. */ floating, /* A floating-point number (double). */ ! ignore, /* Ignored. */ } type; char *value_ptr; /* Pointer to the value-holding variable. */ - char env; /* Can come from MAKEFLAGS. */ - char toenv; /* Should be put in MAKEFLAGS. */ char *noarg_value; /* Pointer to value used if no argument is given. */ char *default_value;/* Pointer to default value. */ }; --- 89,103 ---- string, /* One string per switch, may be in the same word. */ positive_int, /* A positive integer. */ floating, /* A floating-point number (double). */ ! ignore /* Ignored. */ } type; char *value_ptr; /* Pointer to the value-holding variable. */ + unsigned int env:1; /* Can come from MAKEFLAGS. */ + unsigned int toenv:1; /* Should be put in MAKEFLAGS. */ + unsigned int no_makefile:1; /* Don't propagate when remaking makefiles. */ + char *noarg_value; /* Pointer to value used if no argument is given. */ char *default_value;/* Pointer to default value. */ }; *************** *** 157,163 **** /* Nonzero means keep going even if remaking some file fails (-k). */ ! int keep_going_flag = 0; /* Nonzero means print working directory before starting and after finishing make. */ --- 159,166 ---- /* Nonzero means keep going even if remaking some file fails (-k). */ ! int keep_going_flag; ! int default_keep_going_flag = 0; /* Nonzero means print working directory before starting and after finishing make. */ *************** *** 210,240 **** static struct command_switch switches[] = { ! { 'b', ignore, 0, 0, 0, 0, 0 }, ! { 'C', string, (char *) &directories, 0, 0, 0, 0 }, ! { 'd', flag, (char *) &debug_flag, 1, 1, 0, 0 }, ! { 'e', flag, (char *) &env_overrides, 1, 1, 0, 0 }, ! { 'f', string, (char *) &makefiles, 0, 0, 0, 0 }, ! { 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0 }, ! { 'I', string, (char *) &include_directories, 0, 0, 0, 0 }, ! { 'j', positive_int, (char *) &job_slots, 1, 1, (char *) &inf_jobs, (char *) &default_job_slots }, ! { 'k', flag, (char *) &keep_going_flag, 1, 1, 0, 0 }, ! { 'l', floating, (char *) &max_load_average, 1, 1, (char *) &default_load_average, (char *) &default_load_average }, ! { 'm', ignore, 0, 0, 0, 0, 0 }, ! { 'n', flag, (char *) &just_print_flag, 1, 1, 0, 0 }, ! { 'o', string, (char *) &old_files, 0, 0, 0, 0 }, ! { 'p', flag, (char *) &print_data_base_flag, 1, 1, 0, 0 }, ! { 'q', flag, (char *) &question_flag, 1, 1, 0, 0 }, ! { 'r', flag, (char *) &no_builtin_rules_flag, 1, 1, 0, 0 }, ! { 's', flag, (char *) &silent_flag, 1, 1, 0, 0 }, ! { 'S', flag_off, (char *) &keep_going_flag, 1, 1, 0, 0 }, ! { 't', flag, (char *) &touch_flag, 1, 1, 0, 0 }, ! { 'v', flag, (char *) &print_version_flag, 0, 0, 0, 0 }, ! { 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0 }, ! { 'W', string, (char *) &new_files, 0, 0, 0, 0 }, ! { '\0', ignore, 0, 0, 0, 0 } }; /* List of non-switch arguments. */ --- 213,245 ---- static struct command_switch switches[] = { ! { 'b', ignore, 0, 0, 0, 0, 0, 0 }, ! { 'C', string, (char *) &directories, 0, 0, 0, 0, 0 }, ! { 'd', flag, (char *) &debug_flag, 1, 1, 0, 0, 0 }, ! { 'e', flag, (char *) &env_overrides, 1, 1, 0, 0, 0 }, ! { 'f', string, (char *) &makefiles, 0, 0, 0, 0, 0 }, ! { 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0, 0 }, ! { 'I', string, (char *) &include_directories, 0, 0, 0, 0, 0 }, ! { 'j', positive_int, (char *) &job_slots, 1, 1, 0, (char *) &inf_jobs, (char *) &default_job_slots }, ! { 'k', flag, (char *) &keep_going_flag, 1, 1, 0, ! 0, (char *) &default_keep_going_flag }, ! { 'l', floating, (char *) &max_load_average, 1, 1, 0, (char *) &default_load_average, (char *) &default_load_average }, ! { 'm', ignore, 0, 0, 0, 0, 0, 0 }, ! { 'n', flag, (char *) &just_print_flag, 1, 1, 1, 0, 0 }, ! { 'o', string, (char *) &old_files, 0, 0, 0, 0, 0 }, ! { 'p', flag, (char *) &print_data_base_flag, 1, 1, 0, 0, 0 }, ! { 'q', flag, (char *) &question_flag, 1, 1, 1, 0, 0 }, ! { 'r', flag, (char *) &no_builtin_rules_flag, 1, 1, 0, 0, 0 }, ! { 's', flag, (char *) &silent_flag, 1, 1, 0, 0, 0 }, ! { 'S', flag_off, (char *) &keep_going_flag, 1, 1, 0, ! 0, (char *) &default_keep_going_flag }, ! { 't', flag, (char *) &touch_flag, 1, 1, 1, 0, 0 }, ! { 'v', flag, (char *) &print_version_flag, 0, 0, 0, 0, 0 }, ! { 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0 }, ! { 'W', string, (char *) &new_files, 0, 0, 0, 0, 0 }, ! { '\0', ignore, 0, 0, 0, 0, 0 } }; /* List of non-switch arguments. */ *************** *** 262,267 **** --- 267,275 ---- struct file *default_file; + /* Mask of signals that are being caught with fatal_error_signal. */ + int fatal_signal_mask; + int main (argc, argv, envp) int argc; *************** *** 274,280 **** extern int child_handler (); register struct file *f; register unsigned int i; - int status; register char *cmd_defs; register unsigned int cmd_defs_len, cmd_defs_idx; char **p; --- 282,287 ---- *************** *** 292,336 **** init_siglist (); #endif ! if (signal (SIGHUP, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGHUP, SIG_IGN); ! if (signal (SIGQUIT, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGQUIT, SIG_IGN); ! if (signal (SIGINT, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGINT, SIG_IGN); ! if (signal (SIGILL, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGILL, SIG_IGN); ! if (signal (SIGTRAP, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGTRAP, SIG_IGN); ! if (signal (SIGIOT, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGIOT, SIG_IGN); #ifdef SIGEMT ! if (signal (SIGEMT, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGEMT, SIG_IGN); #endif #ifdef SIGDANGER ! if (signal (SIGDANGER, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGDANGER, SIG_IGN); #endif ! if (signal (SIGFPE, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGFPE, SIG_IGN); ! if (signal (SIGBUS, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGBUS, SIG_IGN); ! if (signal (SIGSEGV, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGSEGV, SIG_IGN); ! if (signal (SIGSYS, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGSYS, SIG_IGN); ! if (signal (SIGTERM, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGTERM, SIG_IGN); #ifdef SIGXCPU ! if (signal (SIGXCPU, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGXCPU, SIG_IGN); #endif #ifdef SIGXFSZ ! if (signal (SIGXFSZ, fatal_error_signal) == SIG_IGN) ! (void) signal (SIGXFSZ, SIG_IGN); #endif /* Make sure stdout is line-buffered. */ #if defined(USGr3) || defined(HPUX) || defined(hpux) --- 299,338 ---- init_siglist (); #endif ! fatal_signal_mask = 0; ! ! #define FATAL_SIG(sig) \ ! if (SIGNAL ((sig), fatal_error_signal) == SIG_IGN) \ ! (void) SIGNAL ((sig), SIG_IGN); \ ! else \ ! fatal_signal_mask |= sigmask (sig); ! ! FATAL_SIG (SIGHUP); ! FATAL_SIG (SIGQUIT); ! FATAL_SIG (SIGINT); ! FATAL_SIG (SIGILL); ! FATAL_SIG (SIGTRAP); ! FATAL_SIG (SIGIOT); #ifdef SIGEMT ! FATAL_SIG (SIGEMT); #endif #ifdef SIGDANGER ! FATAL_SIG (SIGDANGER); #endif ! FATAL_SIG (SIGFPE); ! FATAL_SIG (SIGBUS); ! FATAL_SIG (SIGSEGV); ! FATAL_SIG (SIGSYS); ! FATAL_SIG (SIGTERM); #ifdef SIGXCPU ! FATAL_SIG (SIGXCPU); #endif #ifdef SIGXFSZ ! FATAL_SIG (SIGXFSZ); #endif + #undef FATAL_SIG + /* Make sure stdout is line-buffered. */ #if defined(USGr3) || defined(HPUX) || defined(hpux) *************** *** 362,368 **** #ifdef USG /* In some System V's, `getcwd' spawns a child running /bin/pwd. */ ! block_children (); #endif if (getwd (current_directory) == 0) { --- 364,370 ---- #ifdef USG /* In some System V's, `getcwd' spawns a child running /bin/pwd. */ ! push_signals_blocked_p (1); #endif if (getwd (current_directory) == 0) { *************** *** 370,376 **** current_directory[0] = '\0'; } #ifdef USG ! unblock_children (); #endif /* Read in variables from the environment. It is important that this be --- 372,378 ---- current_directory[0] = '\0'; } #ifdef USG ! pop_signals_blocked_p (); #endif /* Read in variables from the environment. It is important that this be *************** *** 394,404 **** if (print_version_flag || print_data_base_flag || debug_flag) print_version (); - /* Construct the list of include directories to search. */ - - construct_include_path (include_directories == 0 ? (char **) 0 - : include_directories->list); - /* Search for command line arguments that define variables, and do the definitions. Also save up the text of these arguments in CMD_DEFS so we can put them into the values --- 396,401 ---- *************** *** 409,458 **** cmd_defs_idx = 0; for (i = 1; other_args->list[i] != 0; ++i) - /* Try a variable definition. */ - if (try_variable_definition (other_args->list[i], o_command)) - { - /* It succeeded. The variable is already defined. - Backslash-quotify it and append it to CMD_DEFS, then clobber it - to 0 in the list so that it won't be taken for a goal target. */ - register char *p = other_args->list[i]; - unsigned int l = strlen (p); - if (cmd_defs_idx + (l * 2) + 1 > cmd_defs_len) - { - if (l * 2 > cmd_defs_len) - cmd_defs_len += l * 2; - else - cmd_defs_len *= 2; - cmd_defs = (char *) xrealloc (cmd_defs, cmd_defs_len); - } - - while (*p != '\0') - { - if (index ("'\"*?[]$<>(){}|&~`\\ \t\r\n\f\v", *p) != 0) - cmd_defs[cmd_defs_idx++] = '\\'; - cmd_defs[cmd_defs_idx++] = *p++; - } - cmd_defs[cmd_defs_idx++] = ' '; - } - else { ! /* 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->cmd_target = 1; ! if (goals == 0) { ! goals = (struct dep *) xmalloc (sizeof (struct dep)); ! lastgoal = goals; } else { ! lastgoal->next = (struct dep *) xmalloc (sizeof (struct dep)); ! lastgoal = lastgoal->next; } - lastgoal->name = 0; - lastgoal->file = f; } if (cmd_defs_idx > 0) --- 406,461 ---- cmd_defs_idx = 0; for (i = 1; other_args->list[i] != 0; ++i) { ! if (other_args->list[i][0] == '\0') ! /* Ignore empty arguments, so they can't kill enter_file. */ ! continue; ! /* Try a variable definition. */ ! if (try_variable_definition (other_args->list[i], o_command)) { ! /* It succeeded. The variable is already defined. ! Backslash-quotify it and append it to CMD_DEFS, then clobber it ! to 0 in the list so that it won't be taken for a goal target. */ ! register char *p = other_args->list[i]; ! unsigned int l = strlen (p); ! if (cmd_defs_idx + (l * 2) + 1 > cmd_defs_len) ! { ! if (l * 2 > cmd_defs_len) ! cmd_defs_len += l * 2; ! else ! cmd_defs_len *= 2; ! cmd_defs = (char *) xrealloc (cmd_defs, cmd_defs_len); ! } ! ! while (*p != '\0') ! { ! if (index ("'\"*?[]$<>(){}|&~`\\ \t\r\n\f\v", *p) != 0) ! cmd_defs[cmd_defs_idx++] = '\\'; ! cmd_defs[cmd_defs_idx++] = *p++; ! } ! cmd_defs[cmd_defs_idx++] = ' '; } else { ! /* 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->cmd_target = 1; ! ! if (goals == 0) ! { ! goals = (struct dep *) xmalloc (sizeof (struct dep)); ! lastgoal = goals; ! } ! else ! { ! lastgoal->next = (struct dep *) xmalloc (sizeof (struct dep)); ! lastgoal = lastgoal->next; ! } ! lastgoal->name = 0; ! lastgoal->file = f; } } if (cmd_defs_idx > 0) *************** *** 504,509 **** --- 507,517 ---- makelevel = 0; } + /* Construct the list of include directories to search. */ + + construct_include_path (include_directories == 0 ? (char **) 0 + : include_directories->list); + /* Tell the user where he is. */ if (print_directory_flag) *************** *** 544,550 **** fprintf (outfile, "%s:;\n", name); (void) fclose (outfile); ! /* Replace the name that read_all_makefiles with see with the name of the temporary file. */ makefiles->list[i] = savestring (name, sizeof name - 1); --- 552,558 ---- fprintf (outfile, "%s:;\n", name); (void) fclose (outfile); ! /* Replace the name that read_all_makefiles will see with the name of the temporary file. */ makefiles->list[i] = savestring (name, sizeof name - 1); *************** *** 563,571 **** reading in the makefiles so that `shell' function calls will work. */ #ifdef SIGCHLD ! (void) signal (SIGCHLD, child_handler); #else ! (void) signal (SIGCLD, child_handler); #endif /* Install the default implicit rules. */ --- 571,579 ---- reading in the makefiles so that `shell' function calls will work. */ #ifdef SIGCHLD ! (void) SIGNAL (SIGCHLD, child_handler); #else ! (void) SIGNAL (SIGCLD, child_handler); #endif /* Install the default implicit rules. */ *************** *** 583,589 **** /* Set up the MAKEFLAGS and MFLAGS variables so makefiles can look at them. */ ! define_makeflags (0); /* Read all the makefiles. */ --- 591,597 ---- /* Set up the MAKEFLAGS and MFLAGS variables so makefiles can look at them. */ ! define_makeflags (0, 0); /* Read all the makefiles. */ *************** *** 597,603 **** /* Set up MAKEFLAGS and MFLAGS again, so they will be right. */ ! define_makeflags (1); ignore_errors_flag |= lookup_file (".IGNORE") != 0; --- 605,611 ---- /* Set up MAKEFLAGS and MFLAGS again, so they will be right. */ ! define_makeflags (1, 0); ignore_errors_flag |= lookup_file (".IGNORE") != 0; *************** *** 662,678 **** while (d != 0) { register struct file *f = d->file; ! if (f->is_target && f->deps == 0) { ! /* This makefile is a target, but has no dependencies. ! So, it will always be remade. This might well cause ! an infinite loop, so don't try to remake it. ! (This will only happen if your makefiles are written ! exceptionally stupidly; but if you work for Athena, ! that is how you write makefiles.) */ if (debug_flag) ! printf ("Makefile `%s' might loop; not remaking it.", f->name); if (last == 0) --- 670,686 ---- while (d != 0) { register struct file *f = d->file; ! if (f->is_target && f->deps == 0 && f->cmds != 0) { ! /* This makefile is a target with commands, but has no ! dependencies. So, it will always be remade. ! This might well cause an infinite loop, so don't try to ! remake it. (This will only happen if your makefiles are ! written exceptionally stupidly; but if you work for Athena, ! that's how you write your makefiles.) */ if (debug_flag) ! printf ("Makefile `%s' might loop; not remaking it.\n", f->name); if (last == 0) *************** *** 700,705 **** --- 708,716 ---- } } + /* Set up `MAKEFLAGS' specially while remaking makefiles. */ + define_makeflags (1, 1); + switch (update_goal_chain (read_makefiles, 1)) { default: *************** *** 824,836 **** sprintf (*p, "MAKELEVEL=%u", makelevel); break; } ! exec_command (argv, environ, ! allocated_variable_expand ("$(PATH)"), ! allocated_variable_expand ("$(SHELL)")); /* NOTREACHED */ } } { int status; --- 835,848 ---- sprintf (*p, "MAKELEVEL=%u", makelevel); break; } ! exec_command (argv, environ); /* NOTREACHED */ } } + /* Set up `MAKEFLAGS' again for the normal targets. */ + define_makeflags (1, 0); + { int status; *************** *** 936,942 **** arg = cs->noarg_value; if (arg == 0) { - missing_arg:; error ("argument required for `-%c' option", cs->c); bad = 1; --- 948,953 ---- *************** *** 977,988 **** if (arg != 0 && isdigit (*arg)) { int i = atoi (arg); ! while (isdigit (*arg)) ! ++arg; if (i < 1) ! error ("the `-%c' option requires a \ positive integral argument", ! cs->c); else *(unsigned int *) cs->value_ptr = i; } --- 988,1003 ---- if (arg != 0 && isdigit (*arg)) { int i = atoi (arg); ! if (arg == sw) ! while (isdigit (*sw)) ! ++sw; if (i < 1) ! { ! error ("the `-%c' option requires a \ positive integral argument", ! cs->c); ! bad = 1; ! } else *(unsigned int *) cs->value_ptr = i; } *************** *** 1002,1008 **** /* We moved to the next arg, so move back. */ --i; } - sw = ""; break; case floating: --- 1017,1022 ---- *************** *** 1013,1020 **** if (arg != 0 && (*arg == '.' || isdigit (*arg))) { *(double *) cs->value_ptr = atof (arg); ! while (*arg == '.' || isdigit (*arg)) ! ++arg; } else { --- 1027,1035 ---- if (arg != 0 && (*arg == '.' || isdigit (*arg))) { *(double *) cs->value_ptr = atof (arg); ! if (arg == sw) ! while (*sw == '.' || isdigit (*sw)) ! ++sw; } else { *************** *** 1032,1038 **** /* We moved to the next arg, so move back. */ --i; } - sw = ""; break; } --- 1047,1052 ---- *************** *** 1124,1134 **** } /* Define the MAKEFLAGS and MFLAGS variables to reflect the settings of the ! command switches. Include positive_int and floating options if PF. */ static void ! define_makeflags (pf) ! int pf; { register struct command_switch *cs; char flags[200]; --- 1138,1149 ---- } /* Define the MAKEFLAGS and MFLAGS variables to reflect the settings of the ! command switches. Include positive_int and floating options if PF. ! Don't include options with the `no_makefile' flag is if MAKEFILE. */ static void ! define_makeflags (pf, makefile) ! int pf, makefile; { register struct command_switch *cs; char flags[200]; *************** *** 1136,1142 **** i = 0; for (cs = switches; cs->c != '\0'; ++cs) ! if (cs->toenv) { if (i == 0 || flags[i - 1] == ' ') flags[i++] = '-'; --- 1151,1157 ---- i = 0; for (cs = switches; cs->c != '\0'; ++cs) ! if (cs->toenv && (!makefile || !cs->no_makefile)) { if (i == 0 || flags[i - 1] == ' ') flags[i++] = '-'; *************** *** 1150,1158 **** case flag: case flag_off: ! if ((cs->default_value != 0 ! && *(int *) cs->value_ptr != *(int *) cs->default_value) ! || !*(int *) cs->value_ptr == (cs->type == flag_off)) flags[i++] = cs->c; break; --- 1165,1173 ---- case flag: case flag_off: ! if (!*(int *) cs->value_ptr == (cs->type == flag_off) ! && (cs->default_value == 0 ! || *(int *) cs->value_ptr != *(int *) cs->default_value)) flags[i++] = cs->c; break; *************** *** 1206,1213 **** flags[0] = flags[1] = '\0'; else if (flags[i - 1] == ' ' || flags[i - 1] == '-') flags[i - 1] = '\0'; ! else ! flags[i] = '\0'; /* On Sun, the value of MFLAGS starts with a `-' but the value of MAKEFLAGS lacks the `-'. Be compatible. */ --- 1221,1227 ---- flags[0] = flags[1] = '\0'; else if (flags[i - 1] == ' ' || flags[i - 1] == '-') flags[i - 1] = '\0'; ! flags[i] = '\0'; /* On Sun, the value of MFLAGS starts with a `-' but the value of MAKEFLAGS lacks the `-'. Be compatible. */ *************** *** 1320,1326 **** #ifdef USG /* In some System V's, `getcwd' spawns a child running /bin/pwd. */ ! block_children (); #endif if (getwd (pwdbuf) == 0) printf ("an unknown directory (getwd: %s)\n", pwdbuf); --- 1334,1340 ---- #ifdef USG /* In some System V's, `getcwd' spawns a child running /bin/pwd. */ ! push_signals_blocked_p (1); #endif if (getwd (pwdbuf) == 0) printf ("an unknown directory (getwd: %s)\n", pwdbuf); *************** *** 1327,1332 **** else printf ("directory `%s'\n", pwdbuf); #ifdef USG ! unblock_children (); #endif } --- 1341,1346 ---- else printf ("directory `%s'\n", pwdbuf); #ifdef USG ! pop_signals_blocked_p (); #endif } diff -rc make-3.58/make.h make-3.59/make.h *** make-3.58/make.h Sun Sep 17 19:35:57 1989 --- make-3.59/make.h Sat Sep 29 16:34:46 1990 *************** *** 16,21 **** --- 16,36 ---- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include + + #if !defined(NSIG) && defined(_NSIG) + #define NSIG _NSIG + #endif + + #ifdef __STDC__ + #define SIGNAL(sig, handler) ((void *) signal((sig), (void *) (handler))) + #else + #define SIGNAL(sig, handler) signal((sig), (handler)) + #endif + + #ifndef sigmask + #define sigmask(sig) (1 << ((sig) - 1)) + #endif + #include #ifndef sun *************** *** 91,96 **** --- 106,112 ---- #ifndef NO_ARCHIVES extern int ar_name (); + extern void ar_name_parse (); extern int ar_touch (); extern time_t ar_member_date (); #endif *************** *** 108,113 **** --- 124,130 ---- extern int vpath_search (); extern void construct_include_path (); + extern void uniquize_deps (); extern int update_goal_chain (); extern void notice_finished_file (); *************** *** 125,131 **** extern int unlink (), stat (); extern void qsort (); extern int atoi (); ! extern int pipe (), close (), open (), lseek (), read (); extern char *ctime (); extern char **environ; --- 142,148 ---- extern int unlink (), stat (); extern void qsort (); extern int atoi (); ! extern int pipe (), close (), lseek (), read (); extern char *ctime (); extern char **environ; diff -rc make-3.58/make.man make-3.59/make.man *** make-3.58/make.man Thu Jan 25 00:31:33 1990 --- make-3.59/make.man Mon Sep 17 16:01:40 1990 *************** *** 155,161 **** Unlike the arguments to other flags of .IR make , directories given with ! . \-I flags may come directly after the flag: .BI \-I dir is allowed, as well as --- 155,161 ---- Unlike the arguments to other flags of .IR make , directories given with ! .B \-I flags may come directly after the flag: .BI \-I dir is allowed, as well as diff -rc make-3.58/make.texinfo make-3.59/make.texinfo *** make-3.58/make.texinfo Sun Feb 4 01:08:46 1990 --- make-3.59/make.texinfo Fri Jun 1 02:14:37 1990 *************** *** 50,68 **** @sp 2 @center by Richard M. Stallman and Roland McGrath @sp 3 ! @center Edition 0.26 Beta, @sp 1 ! @center last updated 20 January 1990, @sp 1 ! @center for @code{make}, Version 3.58 Beta. @page @vskip 0pt plus 1filll Copyright @copyright{} 1988, 1989, 1990 Free Software Foundation, Inc. @sp 2 ! This is Edition 0.26 Beta of the @cite{GNU Make Manual}, @* ! last updated 20 January 1990, @* ! for @code{make} Version 3.58 Beta. @sp 2 Published by the Free Software Foundation @* --- 50,68 ---- @sp 2 @center by Richard M. Stallman and Roland McGrath @sp 3 ! @center Edition 0.27 Beta, @sp 1 ! @center last updated 31 May 1990, @sp 1 ! @center for @code{make}, Version 3.59 Beta. @page @vskip 0pt plus 1filll Copyright @copyright{} 1988, 1989, 1990 Free Software Foundation, Inc. @sp 2 ! This is Edition 0.27 Beta of the @cite{GNU Make Manual}, @* ! last updated 31 May 1990, @* ! for @code{make} Version 3.59 Beta. @sp 2 Published by the Free Software Foundation @* *************** *** 1372,1379 **** @item vpath @var{pattern} @var{directories} Specify the search path @var{directories} for filenames that match @code{pattern}. If another path was previously specified for the same ! pattern, the new path replaces it. Note that it does @emph{not} add ! to the old path for this pattern.@refill The search path, @var{directories}, is a colon-separated list of directories to be searched, just like the search path used in the --- 1372,1378 ---- @item vpath @var{pattern} @var{directories} Specify the search path @var{directories} for filenames that match @code{pattern}. If another path was previously specified for the same ! pattern, the new path is effectively appended to the old path.@refill The search path, @var{directories}, is a colon-separated list of directories to be searched, just like the search path used in the diff -rc make-3.58/misc.c make-3.59/misc.c *** make-3.58/misc.c Tue Jul 11 07:45:53 1989 --- make-3.59/misc.c Sun Aug 19 17:22:11 1990 *************** *** 226,232 **** fprintf (stderr, "%s: ", program); else fprintf (stderr, "%s[%u]: ", program, makelevel); ! fprintf (stderr, s1, s2, s3, s4, s5); putc ('\n', stderr); fflush (stderr); } --- 226,232 ---- fprintf (stderr, "%s: ", program); else fprintf (stderr, "%s[%u]: ", program, makelevel); ! fprintf (stderr, s1, s2, s3, s4, s5, s6); putc ('\n', stderr); fflush (stderr); } *************** *** 265,270 **** --- 265,273 ---- /* Like malloc but get fatal error if memory is exhausted. */ extern char *malloc (), *realloc (); + + #undef xmalloc + #undef xrealloc char * xmalloc (size) diff -rc make-3.58/read.c make-3.59/read.c *** make-3.58/read.c Wed Jan 3 23:59:35 1990 --- make-3.59/read.c Tue Nov 20 02:59:17 1990 *************** *** 186,195 **** } /* 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, and it's not an error if it doesn't ! exist; 2 => an included makefile: is searched for in the search path. FILENAME is added to the `read_makefiles' chain. */ static void --- 186,198 ---- } /* 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. ! FILENAME is added to the `read_makefiles' chain. */ static void *************** *** 235,244 **** infile = fopen (filename, "r"); ! /* If the makefile wasn't found and it's an included makefile (type 2), search the included makefile search path for this makefile. */ ! if (infile == 0 && type == 2 && *filename != '/') { register unsigned int i; for (i = 0; include_directories[i] != 0; ++i) --- 238,248 ---- infile = fopen (filename, "r"); ! /* If the makefile wasn't found and it's either a makefile from ! the `MAKEFILES' variable (type 1) or an included makefile (type 2), search the included makefile search path for this makefile. */ ! if (infile == 0 && (type == 1 || type == 2) && *filename != '/') { register unsigned int i; for (i = 0; include_directories[i] != 0; ++i) *************** *** 369,374 **** --- 373,379 ---- if (!strncmp (p2, "define", 6)) { unsigned int len; + p2 = end_of_token (p2); p = find_next_token (&p2, &len); lineno = do_define (p, len, o_override, lineno, infile, filename); *************** *** 589,595 **** { lineno += nlines; nlines = readline (&lb, infile, filename); ! p = lb.buffer; if ((p[5] == '\0' || p[5] == ' ' || p[5] == '\t') && !strncmp (p, "endef", 5)) --- 594,600 ---- { lineno += nlines; nlines = readline (&lb, infile, filename); ! p = next_token (lb.buffer); if ((p[5] == '\0' || p[5] == ' ' || p[5] == '\t') && !strncmp (p, "endef", 5)) *************** *** 600,606 **** error ("%s:%u: Extraneous text after `endef' directive", filename, lineno); /* Define the variable. */ ! definition[idx] = '\0'; (void) define_variable (name, namelen, definition, origin, 1); return lineno; } --- 605,611 ---- error ("%s:%u: Extraneous text after `endef' directive", filename, lineno); /* Define the variable. */ ! definition[idx - 1] = '\0'; (void) define_variable (name, namelen, definition, origin, 1); return lineno; } *************** *** 609,615 **** unsigned int len = strlen (p); /* Increase the buffer size if necessary. */ ! if (idx + len > length) { length = (idx + len) * 2; definition = (char *) xrealloc (definition, length + 1); --- 614,620 ---- unsigned int len = strlen (p); /* Increase the buffer size if necessary. */ ! if (idx + len + 1 > length) { length = (idx + len) * 2; definition = (char *) xrealloc (definition, length + 1); *************** *** 850,856 **** } } } ! /* Record a description line for files FILENAMES, with dependencies DEPS, commands to execute described by COMMANDS and COMMANDS_IDX, coming from FILENAME:COMMANDS_STARTED. --- 855,861 ---- } } } ! /* Record a description line for files FILENAMES, with dependencies DEPS, commands to execute described by COMMANDS and COMMANDS_IDX, coming from FILENAME:COMMANDS_STARTED. *************** *** 1051,1057 **** /* Free name if not needed further. */ if (f != 0 && name != f->name ! && !(f->name == name - 2 && name[0] == '.' && name[1] == '/')) { free (name); name = f->name; --- 1056,1062 ---- /* Free name if not needed further. */ if (f != 0 && name != f->name ! && !(f->name == name + 2 && name[0] == '.' && name[1] == '/')) { free (name); name = f->name; *************** *** 1461,1488 **** if (userend != 0) *userend = '\0'; pwent = getpwnam (old->name + 1); ! if (userend == 0) { ! free (old->name); ! if (pwent == 0) ! old->name = savestring ((char *) 0, 0); else ! old->name = savestring (pwent->pw_dir, ! strlen (pwent->pw_dir)); ! } ! else if (pwent == 0) ! { ! unsigned int len; ! ++userend; ! len = strlen (userend); ! bcopy (userend, old->name, len); ! old->name[len] = '\0'; ! } ! else ! { ! char *new = concat (pwent->pw_dir, "/", userend + 1); ! free (old->name); ! old->name = new; } } } --- 1466,1485 ---- 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; ! } } } } diff -rc make-3.58/remake.c make-3.59/remake.c *** make-3.58/remake.c Wed Jan 3 23:56:12 1990 --- make-3.59/remake.c Sat Sep 29 16:34:45 1990 *************** *** 16,21 **** --- 16,22 ---- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "make.h" + #include "ar.h" #include "commands.h" #include "job.h" #include "dep.h" *************** *** 28,38 **** #endif ! extern int open (), fstat (), read (), lseek (), write (), close (); extern time_t time (); extern int try_implicit_rule (); - extern time_t ar_member_date (); /* Incremented when a file has been remade. */ --- 29,38 ---- #endif ! extern int fstat (); extern time_t time (); extern int try_implicit_rule (); /* Incremented when a file has been remade. */ *************** *** 86,91 **** --- 86,92 ---- { int x; time_t mtime = MTIME (g->file); + check_renamed (g->file); if (makefiles) { *************** *** 300,305 **** --- 301,309 ---- { time_t mtime; + mtime = file_mtime (d->file); + check_renamed (d->file); + if (d->file->updating) { error ("Circular %s <- %s dependency dropped.", *************** *** 319,326 **** continue; } - mtime = file_mtime (d->file); - check_renamed (d->file); d->file->parent = file; dep_status |= check_dep (d->file, depth, this_mtime, &must_make); check_renamed (d->file); --- 323,328 ---- *************** *** 549,554 **** --- 551,557 ---- { time_t mtime; dep_status = update_file (file, depth); + check_renamed (file); mtime = file_mtime (file); check_renamed (file); if (mtime == (time_t) -1 || mtime > this_mtime) *************** *** 661,667 **** remake_file (file) struct file *file; { ! if (file->cmds == 0 && !(touch_flag && !file->is_target)) { if (file->phony) /* Phony target. Pretend it succeeded. */ --- 664,670 ---- remake_file (file) struct file *file; { ! if (file->cmds == 0) { if (file->phony) /* Phony target. Pretend it succeeded. */ *************** *** 688,694 **** { chop_commands (file->cmds); ! if (touch_flag && file->cmds != 0 && !file->cmds->any_recurse) { if (file->phony) file->update_status = 0; --- 691,697 ---- { chop_commands (file->cmds); ! if (touch_flag && !file->cmds->any_recurse) { if (file->phony) file->update_status = 0; *************** *** 722,743 **** /* File's mtime is not known; must get it from the system. */ ! mtime = name_mtime (file->name); ! if (mtime == (time_t) -1 && search) { ! /* If name_mtime failed, search VPATH. */ ! char *name = file->name; ! if (vpath_search (&name)) { ! rename_file (file, name); ! file = file->renamed; ! mtime = name_mtime (name); } - else - /* Last resort, is it a library (-lxxx)? */ - if (name[0] == '-' && name[1] == 'l') - mtime = library_file_mtime (&name[2]); } /* Store the mtime into all the entries for this file. */ --- 725,809 ---- /* File's mtime is not known; must get it from the system. */ ! #ifndef NO_ARCHIVES ! if (ar_name (file->name)) ! { ! /* This file is an archive-member reference. */ ! ! char *arname, *memname; ! struct file *arfile; ! int arname_used = 0; ! ! /* Find the archive's name. */ ! ar_parse_name (file->name, &arname, &memname); ! ! /* Find the modification time of the archive itself. ! Also allow for its name to be changed via VPATH search. */ ! arfile = lookup_file (arname); ! if (arfile == 0) ! { ! arfile = enter_file (arname); ! arname_used = 1; ! } ! mtime = f_mtime (arfile, search); ! check_renamed (arfile); ! if (search && strcmp (arfile->name, arname)) ! { ! /* The archive's name has changed. ! Change the archive-member reference accordingly. */ ! ! unsigned int arlen, memlen; ! ! if (!arname_used) ! { ! free (arname); ! arname_used = 1; ! } ! ! arname = arfile->name; ! arlen = strlen (arname); ! memlen = strlen (memname); ! ! free (file->name); ! ! file->name = (char *) xmalloc (arlen + 1 + memlen + 2); ! bcopy (arname, file->name, arlen); ! file->name[arlen] = '('; ! bcopy (memname, file->name + arlen + 1, memlen); ! file->name[arlen + 1 + memlen] = ')'; ! file->name[arlen + 1 + memlen + 1] = '\0'; ! } ! ! if (!arname_used) ! free (arname); ! free (memname); ! ! if (mtime == (time_t) -1) ! /* The archive doesn't exist, so it's members don't exist either. */ ! return (time_t) -1; ! mtime = ar_member_date (file->name); ! } ! else ! #endif { ! mtime = name_mtime (file->name); ! ! if (mtime == (time_t) -1 && search) { ! /* If name_mtime failed, search VPATH. */ ! char *name = file->name; ! if (vpath_search (&name)) ! { ! rename_file (file, name); ! check_renamed (file); ! mtime = name_mtime (name); ! } ! else ! /* Last resort, is it a library (-lxxx)? */ ! if (name[0] == '-' && name[1] == 'l') ! mtime = library_file_mtime (&name[2]); } } /* Store the mtime into all the entries for this file. */ *************** *** 760,772 **** { struct stat st; - #ifndef NO_ARCHIVES - if (ar_name (name)) - return ar_member_date (name); - #endif - if (stat (name, &st) < 0) return (time_t) -1; return (time_t) st.st_mtime; } --- 826,834 ---- { struct stat st; if (stat (name, &st) < 0) return (time_t) -1; + return (time_t) st.st_mtime; } diff -rc make-3.58/remote.c make-3.59/remote.c *** make-3.58/remote.c Sat Jun 10 13:39:22 1989 --- make-3.59/remote.c Thu May 17 18:28:11 1990 *************** *** 1,5 **** #ifdef CUSTOMS ! #include "remote-customs.c" #else /* Not CUSTOMS. */ #include "remote-stub.c" #endif /* CUSTOMS. */ --- 1,5 ---- #ifdef CUSTOMS ! #include "remote-cstms.c" #else /* Not CUSTOMS. */ #include "remote-stub.c" #endif /* CUSTOMS. */ diff -rc make-3.58/tags make-3.59/tags *** make-3.58/tags Thu Feb 8 16:45:44 1990 --- make-3.59/tags Wed Nov 28 22:55:05 1990 *************** *** 1,12 **** BADARGS function.c /^#define BADARGS(func) \\$/ DEBUGP2 implicit.c /^#define DEBUGP2(msg, a1, a2) \\$/ DEBUGPR make.h /^#define DEBUGPR(msg) \\$/ ! D_NAMLEN glob.c /^#define D_NAMLEN(d) strlen((d)->d_name)$/ ENUM_BITFIELD make.h /^#define ENUM_BITFIELD(bits) :bits$/ HASH make.h /^#define HASH(var, c) \\$/ Marscan arscan.c /^main (argc, argv)$/ Mglob glob.c /^main (argc, argv)$/ Mmain main.c /^main (argc, argv, envp)$/ TOUCH_ERROR remake.c /^#define TOUCH_ERROR(call) return (perror_with_name/ WCOREDUMP job.c /^#define WCOREDUMP(x) ((x) & 0x80)$/ WEXITSTATUS job.c /^#define WEXITSTATUS(x) (((x) >> 8) & 0xff)$/ --- 1,13 ---- BADARGS function.c /^#define BADARGS(func) \\$/ DEBUGP2 implicit.c /^#define DEBUGP2(msg, a1, a2) \\$/ DEBUGPR make.h /^#define DEBUGPR(msg) \\$/ ! D_NAMLEN glob.c /^#define D_NAMLEN(d) strlen((d)->d_name)$/ ENUM_BITFIELD make.h /^#define ENUM_BITFIELD(bits) :bits$/ HASH make.h /^#define HASH(var, c) \\$/ Marscan arscan.c /^main (argc, argv)$/ Mglob glob.c /^main (argc, argv)$/ Mmain main.c /^main (argc, argv, envp)$/ + SIGNAL make.h /^#define SIGNAL(sig, handler) ((void *) signal((sig/ TOUCH_ERROR remake.c /^#define TOUCH_ERROR(call) return (perror_with_name/ WCOREDUMP job.c /^#define WCOREDUMP(x) ((x) & 0x80)$/ WEXITSTATUS job.c /^#define WEXITSTATUS(x) (((x) >> 8) & 0xff)$/ *************** *** 13,39 **** WIFEXITED job.c /^#define WIFEXITED(x) (WTERMSIG (x) == 0)$/ WIFSIGNALED job.c /^#define WIFSIGNALED(x) (WTERMSIG (x) != 0)$/ WTERMSIG job.c /^#define WTERMSIG(x) ((x) & 0x7f)$/ ! alloca glob.c /^#define alloca(n) __builtin_alloca (n)$/ allocated_variable_expand expand.c /^allocated_variable_expand (line)$/ allocated_variable_expand_for_file expand.c /^allocated_variable_expand_for_file (line, file)$/ alpha_compare misc.c /^alpha_compare (s1, s2)$/ ar_member_date ar.c /^ar_member_date (name)$/ ! ar_member_date_1 ar.c /^ar_member_date_1 (desc, name, hdrpos, datapos, siz/ ! ar_member_pos arscan.c /^ar_member_pos (desc, name, hdrpos, datapos, size, / ar_member_touch arscan.c /^ar_member_touch (arname, memname)$/ ar_name ar.c /^ar_name (name)$/ ar_name_equal arscan.c /^ar_name_equal (name, mem)$/ ar_scan arscan.c /^ar_scan (archive, function, arg)$/ ar_touch ar.c /^ar_touch (name)$/ bcmp arscan.c /^#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))$/ ! bcopy glob.c /^#define bcopy(s, d, n) ((void) memcpy ((d), (s), (/ ! block_children job.c /^block_children ()$/ build_vpath_lists vpath.c /^build_vpath_lists ()$/ bzero make.h /^#define bzero(s, n) memset ((s), 0, (n))$/ check_dep remake.c /^check_dep (file, depth, this_mtime, must_make_ptr)/ check_renamed file.h /^#define check_renamed(file) \\$/ child_error job.c /^child_error (target_name, exit_code, exit_sig, cor/ ! child_execute_job job.c /^child_execute_job (stdin_fd, stdout_fd, file, argv/ child_handler job.c /^child_handler (sig)$/ chop_commands commands.c /^chop_commands (cmds)$/ collapse_continuations misc.c /^collapse_continuations (line)$/ --- 14,41 ---- WIFEXITED job.c /^#define WIFEXITED(x) (WTERMSIG (x) == 0)$/ WIFSIGNALED job.c /^#define WIFSIGNALED(x) (WTERMSIG (x) != 0)$/ WTERMSIG job.c /^#define WTERMSIG(x) ((x) & 0x7f)$/ ! alloca make.h /^#define alloca(n) __builtin_alloca (n)$/ allocated_variable_expand expand.c /^allocated_variable_expand (line)$/ allocated_variable_expand_for_file expand.c /^allocated_variable_expand_for_file (line, file)$/ alpha_compare misc.c /^alpha_compare (s1, s2)$/ ar_member_date ar.c /^ar_member_date (name)$/ ! ar_member_date_1 ar.c /^ar_member_date_1 (desc, mem, hdrpos, datapos, size/ ! ar_member_pos arscan.c /^ar_member_pos (desc, mem, hdrpos, datapos, size, d/ ar_member_touch arscan.c /^ar_member_touch (arname, memname)$/ ar_name ar.c /^ar_name (name)$/ ar_name_equal arscan.c /^ar_name_equal (name, mem)$/ + ar_parse_name ar.c /^ar_parse_name (name, arname_p, memname_p)$/ ar_scan arscan.c /^ar_scan (archive, function, arg)$/ ar_touch ar.c /^ar_touch (name)$/ bcmp arscan.c /^#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))$/ ! bcopy glob.c /^#define bcopy(s, d, n) memcpy ((d), (s), (n))$/ ! block_signals job.c /^block_signals ()$/ build_vpath_lists vpath.c /^build_vpath_lists ()$/ bzero make.h /^#define bzero(s, n) memset ((s), 0, (n))$/ check_dep remake.c /^check_dep (file, depth, this_mtime, must_make_ptr)/ check_renamed file.h /^#define check_renamed(file) \\$/ child_error job.c /^child_error (target_name, exit_code, exit_sig, cor/ ! child_execute_job job.c /^child_execute_job (stdin_fd, stdout_fd, argv, envp/ child_handler job.c /^child_handler (sig)$/ chop_commands commands.c /^chop_commands (cmds)$/ collapse_continuations misc.c /^collapse_continuations (line)$/ *************** *** 41,46 **** --- 43,49 ---- concat misc.c /^concat (s1, s2, s3)$/ conditional_line read.c /^conditional_line (line, filename, lineno)$/ construct_command_argv job.c /^construct_command_argv (line, file)$/ + construct_command_argv_internal job.c /^construct_command_argv_internal (line, shell, ifs)/ construct_include_path read.c /^construct_include_path (arg_dirs)$/ construct_vpath_list vpath.c /^construct_vpath_list (pattern, dirpath)$/ convert_to_pattern rule.c /^convert_to_pattern ()$/ *************** *** 50,56 **** decode_env_switches main.c /^decode_env_switches (envar, len)$/ decode_switches main.c /^decode_switches (argc, argv)$/ define_automatic_variables variable.c /^define_automatic_variables ()$/ ! define_makeflags main.c /^define_makeflags (pf)$/ define_variable variable.c /^define_variable (name, length, value, origin, recu/ define_variable_for_file variable.c /^define_variable_for_file (name, length, value, ori/ define_variable_in_set variable.c /^define_variable_in_set (name, length, value, origi/ --- 53,59 ---- decode_env_switches main.c /^decode_env_switches (envar, len)$/ decode_switches main.c /^decode_switches (argc, argv)$/ define_automatic_variables variable.c /^define_automatic_variables ()$/ ! define_makeflags main.c /^define_makeflags (pf, makefile)$/ define_variable variable.c /^define_variable (name, length, value, origin, recu/ define_variable_for_file variable.c /^define_variable_for_file (name, length, value, ori/ define_variable_in_set variable.c /^define_variable_in_set (name, length, value, origi/ *************** *** 65,71 **** end_of_token misc.c /^end_of_token (s)$/ enter_file file.c /^enter_file (name)$/ error misc.c /^error (s1, s2, s3, s4, s5, s6)$/ ! exec_command job.c /^exec_command (argv, envp, path, shell)$/ execute_file_commands commands.c /^execute_file_commands (file)$/ expand_argument expand.c /^expand_argument (str, end)$/ expand_function function.c /^expand_function (o, function, text, end)$/ --- 68,74 ---- end_of_token misc.c /^end_of_token (s)$/ enter_file file.c /^enter_file (name)$/ error misc.c /^error (s1, s2, s3, s4, s5, s6)$/ ! exec_command job.c /^exec_command (argv, envp)$/ execute_file_commands commands.c /^execute_file_commands (file)$/ expand_argument expand.c /^expand_argument (str, end)$/ expand_function function.c /^expand_function (o, function, text, end)$/ *************** *** 95,104 **** glob_pattern_p glob.c /^glob_pattern_p (pattern)$/ glob_vector glob.c /^glob_vector (pat, dir)$/ handle_function function.c /^handle_function (op, stringp)$/ - if implicit.c /^ if (debug_flag) \\$/ index make.h /^#define index(s, c) strchr((s), (c))$/ init_siglist job.c /^init_siglist ()$/ ! initbuffer read.c /^#define initbuffer(lb) (lb)->buffer = (char \*) xma/ initialize_file_variables variable.c /^initialize_file_variables (file)$/ initialize_variable_output variable.c /^initialize_variable_output ()$/ install_default_implicit_rules default.c /^install_default_implicit_rules ()$/ --- 98,106 ---- glob_pattern_p glob.c /^glob_pattern_p (pattern)$/ glob_vector glob.c /^glob_vector (pat, dir)$/ handle_function function.c /^handle_function (op, stringp)$/ index make.h /^#define index(s, c) strchr((s), (c))$/ init_siglist job.c /^init_siglist ()$/ ! initbuffer read.c /^#define initbuffer(lb) (lb)->buffer = (char *) xma/ initialize_file_variables variable.c /^initialize_file_variables (file)$/ initialize_variable_output variable.c /^initialize_variable_output ()$/ install_default_implicit_rules default.c /^install_default_implicit_rules ()$/ *************** *** 121,129 **** parse_file_seq read.c /^parse_file_seq (stringp, stopchar, size)$/ patsubst_expand function.c /^patsubst_expand (o, text, pattern, replace, patter/ pattern_matches function.c /^pattern_matches (pattern, percent, word)$/ ! pattern_search implicit.c /^pattern_search (file, name, depth, recursions)$/ perror_with_name misc.c /^perror_with_name (str, name)$/ pfatal_with_name misc.c /^pfatal_with_name (name)$/ pop_variable_scope variable.c /^pop_variable_scope ()$/ print_commands commands.c /^print_commands (cmds)$/ print_data_base main.c /^print_data_base ()$/ --- 123,132 ---- parse_file_seq read.c /^parse_file_seq (stringp, stopchar, size)$/ patsubst_expand function.c /^patsubst_expand (o, text, pattern, replace, patter/ pattern_matches function.c /^pattern_matches (pattern, percent, word)$/ ! pattern_search implicit.c /^pattern_search (file, archive, depth, recursions)$/ perror_with_name misc.c /^perror_with_name (str, name)$/ pfatal_with_name misc.c /^pfatal_with_name (name)$/ + pop_signals_blocked_p job.c /^pop_signals_blocked_p ()$/ pop_variable_scope variable.c /^pop_variable_scope ()$/ print_commands commands.c /^print_commands (cmds)$/ print_data_base main.c /^print_data_base ()$/ *************** *** 138,143 **** --- 141,147 ---- print_version main.c /^print_version ()$/ print_vpath_data_base vpath.c /^print_vpath_data_base ()$/ push_new_variable_scope variable.c /^push_new_variable_scope ()$/ + push_signals_blocked_p job.c /^push_signals_blocked_p (flag)$/ read_all_makefiles read.c /^read_all_makefiles (makefiles)$/ read_makefile read.c /^read_makefile (filename, type)$/ readline read.c /^readline (linebuffer, stream, filename)$/ *************** *** 147,153 **** remove_intermediates file.c /^remove_intermediates (sig)$/ rename_file file.c /^rename_file (file, name)$/ restore_variable_output variable.c /^restore_variable_output (save)$/ ! rindex make.h /^#define rindex(s, c) strrchr((s), (c))$/ save_variable_output variable.c /^save_variable_output ()$/ savestring misc.c /^savestring (str, length)$/ search_path job.c /^search_path (file, path)$/ --- 151,157 ---- remove_intermediates file.c /^remove_intermediates (sig)$/ rename_file file.c /^rename_file (file, name)$/ restore_variable_output variable.c /^restore_variable_output (save)$/ ! rindex arscan.c /^#define rindex(s, c) strrchr((s), (c))$/ save_variable_output variable.c /^save_variable_output ()$/ savestring misc.c /^savestring (str, length)$/ search_path job.c /^search_path (file, path)$/ *************** *** 154,160 **** selective_vpath_search vpath.c /^selective_vpath_search (path, file)$/ set_default_suffixes default.c /^set_default_suffixes ()$/ set_file_variables commands.c /^set_file_variables (file)$/ ! sigmask commands.c /^#define sigmask(sig) (1 << ((sig) - 1))$/ sindex misc.c /^sindex (big, blen, small, slen)$/ snap_deps file.c /^snap_deps ()$/ start_job job.c /^start_job (child)$/ --- 158,164 ---- selective_vpath_search vpath.c /^selective_vpath_search (path, file)$/ set_default_suffixes default.c /^set_default_suffixes ()$/ set_file_variables commands.c /^set_file_variables (file)$/ ! sigmask make.h /^#define sigmask(sig) (1 << ((sig) - 1))$/ sindex misc.c /^sindex (big, blen, small, slen)$/ snap_deps file.c /^snap_deps ()$/ start_job job.c /^start_job (child)$/ *************** *** 165,171 **** touch_file remake.c /^touch_file (file)$/ try_implicit_rule implicit.c /^try_implicit_rule (file, depth)$/ try_variable_definition variable.c /^try_variable_definition (line, origin)$/ ! unblock_children job.c /^unblock_children ()$/ uniquize_deps read.c /^uniquize_deps (chain)$/ update_file remake.c /^update_file (file, depth)$/ update_file_1 remake.c /^update_file_1 (file, depth)$/ --- 169,175 ---- touch_file remake.c /^touch_file (file)$/ try_implicit_rule implicit.c /^try_implicit_rule (file, depth)$/ try_variable_definition variable.c /^try_variable_definition (line, origin)$/ ! unblock_signals job.c /^unblock_signals ()$/ uniquize_deps read.c /^uniquize_deps (chain)$/ update_file remake.c /^update_file (file, depth)$/ update_file_1 remake.c /^update_file_1 (file, depth)$/ Only in make-3.59: texinfo.tex diff -rc make-3.58/variable.c make-3.59/variable.c *** make-3.58/variable.c Wed Jan 3 23:56:10 1990 --- make-3.59/variable.c Fri Sep 28 04:43:25 1990 *************** *** 95,102 **** if (v != 0) { - if (env_overrides && v->origin == o_env) - v->origin = o_env_override; /* A variable of this name is already defined. If the old definition is from a stronger source than this one, don't redefine it. */ --- 95,100 ---- *************** *** 356,361 **** --- 354,360 ---- void define_automatic_variables () { + extern char default_shell[]; register struct variable *v; char buf[100]; *************** *** 364,370 **** /* This won't override any definition, but it will provide one if there isn't one there. */ ! v = define_variable ("SHELL", 5, "/bin/sh", o_default, 0); /* Don't let SHELL come from the environment if MAKELEVEL is 0. Also, SHELL must not be empty. */ --- 363,369 ---- /* This won't override any definition, but it will provide one if there isn't one there. */ ! v = define_variable ("SHELL", 5, default_shell, o_default, 0); /* Don't let SHELL come from the environment if MAKELEVEL is 0. Also, SHELL must not be empty. */ *************** *** 437,442 **** --- 436,443 ---- register unsigned nvariables; char **result; + int noexport = enter_file (".NOEXPORT")->is_target; + /* Find the lowest number of buckets in any set in the list. */ s = file->variables; buckets = s->set->buckets; *************** *** 463,468 **** --- 464,478 ---- unsigned int j = i % buckets; register struct variable_bucket *ov; register char *p = v->name; + + /* If `.NOEXPORT' was specified, only export command-line and + environment variables. This is a temporary (very ugly) hack + until I fix this problem the right way in version 4. Ick. */ + if (noexport + && (v->origin != o_command + && v->origin != o_env && v->origin != o_env_override + && !(v->origin == o_file && getenv (p) != 0))) + continue; if (v->origin == o_default || streq (p, "MAKELEVEL")) diff -rc make-3.58/variable.h make-3.59/variable.h *** make-3.58/variable.h Wed Jan 3 23:51:06 1990 --- make-3.59/variable.h Wed Sep 19 02:38:33 1990 *************** *** 41,47 **** enum variable_origin origin ENUM_BITFIELD (3); /* Variable origin. */ unsigned int recursive:1; /* Gets recursively re-evaluated. */ ! unsigned int expanding:1; /* Is currently expanding. */ }; /* Structure that represents a variable set. */ --- 41,47 ---- enum variable_origin origin ENUM_BITFIELD (3); /* Variable origin. */ unsigned int recursive:1; /* Gets recursively re-evaluated. */ ! unsigned int expanding:1; /* Nonzero if currently being expanded. */ }; /* Structure that represents a variable set. */ diff -rc make-3.58/version.c make-3.59/version.c *** make-3.58/version.c Thu Feb 8 16:44:08 1990 --- make-3.59/version.c Wed Nov 28 22:53:32 1990 *************** *** 1,4 **** ! char *version_string = "3.58"; /* Local variables: --- 1,4 ---- ! char *version_string = "3.59"; /* Local variables: diff -rc make-3.58/vpath.c make-3.59/vpath.c *** make-3.58/vpath.c Tue Aug 15 00:03:43 1989 --- make-3.59/vpath.c Fri Jul 6 03:06:57 1990 *************** *** 252,267 **** for (v = vpaths; v != 0; v = v->next) if (pattern_matches (v->pattern, v->percent, *file)) ! { ! if (selective_vpath_search (v, file)) ! return 1; ! break; ! } ! if (general_vpath != 0) ! return selective_vpath_search (general_vpath, file); ! else ! return 0; } --- 252,265 ---- for (v = vpaths; v != 0; v = v->next) if (pattern_matches (v->pattern, v->percent, *file)) ! if (selective_vpath_search (v, file)) ! return 1; ! ! if (general_vpath != 0 ! && selective_vpath_search (general_vpath, file)) ! return 1; ! return 0; } *************** *** 275,280 **** --- 273,279 ---- struct vpath *path; char **file; { + int not_target; char *name, *n; char *filename; register char **vpath = path->searchpath; *************** *** 283,288 **** --- 282,295 ---- unsigned int flen, vlen, name_dplen; int exists; + /* Find out if *FILE is a target. + If and only if it is NOT a target, we will accept prospective + files that don't exist but are mentioned in a makefile. */ + { + struct file *f = lookup_file (*file); + not_target = f == 0 || !f->is_target; + } + flen = strlen (*file); /* Split *FILE into a directory prefix and a name-within-directory. *************** *** 340,349 **** *n++ = '/'; bcopy (filename, n, flen + 1); ! /* Is the file mentioned in the makefile? ! That counts as almost existing. */ ! ! if (!exists) exists = lookup_file (name) != 0; if (exists) --- 347,355 ---- *n++ = '/'; bcopy (filename, n, flen + 1); ! if (not_target && !exists) ! /* The file doesn't actually exist. But since *FILE is not a target, ! if the file is mentioned in a makefile, we consider it existent. */ exists = lookup_file (name) != 0; if (exists) *************** *** 374,379 **** --- 380,387 ---- for (v = vpaths; v != 0; v = v->next) { register unsigned int i; + + ++nvpaths; printf ("vpath %s ", v->pattern);