dupuy@CS.COLUMBIA.EDU (Alexander Dupuy) (01/25/89)
Description: These are pretty much nits, but people should be aware of them. With Gnu Make 3.27, "make -n" will execute all commands in a rule where any of the commands contains "$(MAKE)". This also occurs with the -t option. While a strict reading of the documentation indicates that this is intended, this is not what the Sun/USG make does when passed the -n option, nor is it what is usually desired. Also, "make -t" will touch phony targets, as specified with ".PHONY:". It doesn't say anywhere that it shouldn't, but it seems a little odd. Finally, while the definition of the MAKEFLAGS macro in the manual describes it identically to the Sun/USG MAKEFLAGS, the behavior is nearly that of the MFLAGS macro, except without a leading space. I suspect that this is due to the arrival of the "-j#" option, but if it's impossible to restore MAKEFLAGS to its old behavior, the new behavior and the incompatibility with Sun/USG should be documented. Repeat-By: cs% cat Makefile example: echo $(MAKEFLAGS) should not be echoed $(MAKE) nothing touch example .PHONY: nothing nothing: echo $(MFLAGS) should not be echoed either cs% ls Makefile cs% make -v -n GNU Make version 3.27, by Richard Stallman and Roland McGrath. Copyright (C) 1988 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. echo -j1 -n -S should not be echoed -j1 -n -S should not be echoed make nothing echo -j1 -n -S should not be echoed either touch example cs% ls Makefile example cs% rm example cs% make -t echo -j1 -S -t should not be echoed -j1 -S -t should not be echoed make nothing touch nothing touch example cs% ls Makefile example nothing cs% rm example nothing cs% what /bin/make | grep main main.c 1.47 88/02/08 Copyr 1986 Sun Micro cs% /bin/make -n echo n should not be echoed make nothing echo -n should not be echoed either touch example cs% ls Makefile Fix: Fixing the first misfeature involves messing around with the internal representation of commands in a rule, and their recursiveness - I haven't had time to rewrite all that stuff. Following are patches for the second and third misfeatures: *** /tmp/,RCSt1a14374 Tue Jan 24 16:59:44 1989 --- remake.c Tue Jan 24 16:54:37 1989 *************** *** 501,507 **** fflush (stdout); } ! if (ar_name (file->name)) status = ar_touch (file->name); else { --- 501,509 ---- fflush (stdout); } ! if (file->phony) ! status = 0; ! else if (ar_name (file->name)) status = ar_touch (file->name); else { *** /tmp/,RCSt1a14374 Tue Jan 24 16:59:43 1989 --- make.c Tue Jan 24 16:54:27 1989 *************** *** 900,913 **** if ((cs->type == flag && *(int *) cs->value_ptr) || (cs->type == flag_off && !*(int *) cs->value_ptr)) { ! flags[i++] = '-'; flags[i++] = cs->c; - flags[i++] = ' '; } else if (cs->type == positive_int) { ! char *p = &flags[i]; ! sprintf (p, " -%c%u ", cs->c, cs->c == 'j' ? 1 : *(unsigned int *) cs->value_ptr); i += strlen (p); } --- 900,919 ---- if ((cs->type == flag && *(int *) cs->value_ptr) || (cs->type == flag_off && !*(int *) cs->value_ptr)) { ! if (i == 0) ! flags[i++] = '-'; ! flags[i++] = cs->c; } else if (cs->type == positive_int) { ! char *p; ! ! if (i == 0) ! flags[i++] = '-'; ! ! p = &flags[i]; ! sprintf (p, "%c%u", cs->c, cs->c == 'j' ? 1 : *(unsigned int *) cs->value_ptr); i += strlen (p); } *************** *** 916,922 **** if (i == 0) return ""; ! flags[i - 1] = '\0'; return flags; } --- 922,928 ---- if (i == 0) return ""; ! flags[i] = '\0'; return flags; } -- inet: dupuy@cs.columbia.edu uucp: ...!rutgers!cs.columbia.edu!dupuy