tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bmake: variable modifiers in SysV include



Simon J. Gerraty <sjg%juniper.net@localhost> wrote:
> > It doesn't require historical memory. The test is there is so rules
> > like
> > 
> >    include lib bin sbin etc:
> >            mkdir $@ && cd $@ && $(MAKE) -f $(SRC)/$@/Makefile
> > 
> > are not mishandled as inclusions. Use the bmake include syntax; it was
> > put there for a reason.
> > 
> > If you're trying to write a portable makefile, you should limit
> > yourself to reliable constructions; I very much doubt your own example
> > will work reliably in vintage make dialects.
> 
> FWIW the existing test could ignore ':' if followed by non-white-space.

Something like?

Index: parse.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/parse.c,v
retrieving revision 1.227
diff -u -p -r1.227 parse.c
--- parse.c	22 Feb 2018 01:59:28 -0000	1.227
+++ parse.c	3 Apr 2018 19:09:09 -0000
@@ -3073,7 +3073,8 @@ Parse_File(const char *name, int fd)
 			((line[0] == 's' || line[0] == '-') &&
 			    strncmp(&line[1], "include", 7) == 0 &&
 			    isspace((unsigned char) line[8]))) &&
-		    strchr(line, ':') == NULL) {
+		((cp = strchr(line, ':')) == NULL ||
+		 (cp[1] != '\0' && !isspace((int)cp[1])))) {
 		/*
 		 * It's an S3/S5-style "include".
 		 */


Home | Main Index | Thread Index | Old Index