tech-toolchain archive

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

Re: make: .PHONY lacks .TARGET



Ok, finished a clean release build (amd64) with the patch below.
Which also fixes 43534 I believe.

Index: suff.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/suff.c,v
retrieving revision 1.68
diff -u -p -r1.68 suff.c
--- suff.c      30 Jun 2011 20:09:42 -0000      1.68
+++ suff.c      29 Sep 2011 17:33:30 -0000
@@ -2406,16 +2406,25 @@ Suff_FindDeps(GNode *gn)
 static void
 SuffFindDeps(GNode *gn, Lst slst)
 {
-    if (gn->type & (OP_DEPS_FOUND|OP_PHONY)) {
+    if (gn->type & OP_DEPS_FOUND) {
        /*
         * If dependencies already found, no need to do it again...
-        * If this is a .PHONY target, we do not apply suffix rules.
         */
        return;
     } else {
        gn->type |= OP_DEPS_FOUND;
     }
-
+    /*
+     * Make sure we have these set, may get revised below.
+     */
+    Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);
+    Var_Set(PREFIX, gn->name, gn, 0);
+    if (gn->type & OP_PHONY) {
+       /*
+        * If this is a .PHONY target, we do not apply suffix rules.
+        */
+       return;
+    }
     if (DEBUG(SUFF)) {
        fprintf(debug_file, "SuffFindDeps (%s)\n", gn->name);
     }
Index: unit-tests/Makefile
===================================================================
RCS file: /cvsroot/src/usr.bin/make/unit-tests/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- unit-tests/Makefile 7 Apr 2011 01:40:02 -0000       1.32
+++ unit-tests/Makefile 29 Sep 2011 17:33:30 -0000
@@ -35,6 +35,7 @@ SUBFILES= \
        modorder \
        modts \
        modword \
+       phony-end \
        posix \
        qequals \
        sysv \
Index: unit-tests/phony-end
===================================================================
RCS file: unit-tests/phony-end
diff -N unit-tests/phony-end
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ unit-tests/phony-end        29 Sep 2011 17:33:30 -0000
@@ -0,0 +1,9 @@
+# $Id$
+
+all ok also.ok bug phony:
+       @echo '${.TARGET .PREFIX .IMPSRC:L:@v@$v="${$v}"@}'
+
+.END:  ok also.ok bug
+
+phony bug:     .PHONY
+all: phony
Index: unit-tests/test.exp
===================================================================
RCS file: /cvsroot/src/usr.bin/make/unit-tests/test.exp,v
retrieving revision 1.38
diff -u -p -r1.38 test.exp
--- unit-tests/test.exp 3 Jun 2011 21:10:42 -0000       1.38
+++ unit-tests/test.exp 29 Sep 2011 17:33:30 -0000
@@ -292,6 +292,11 @@ LIST:tw:C/ /,/g="one two three four five
 LIST:tw:C/ /,/1g="one two three four five six"
 LIST:tw:tW:C/ /,/="one,two three four five six"
 LIST:tW:tw:C/ /,/="one two three four five six"
+.TARGET="phony" .PREFIX="phony" .IMPSRC=""
+.TARGET="all" .PREFIX="all" .IMPSRC=""
+.TARGET="ok" .PREFIX="ok" .IMPSRC=""
+.TARGET="also.ok" .PREFIX="also.ok" .IMPSRC=""
+.TARGET="bug" .PREFIX="bug" .IMPSRC=""
 Posix says we should execute the command as if run by system(3)
 Expect 'Hello,' and 'World!'
 Hello,



Home | Main Index | Thread Index | Old Index