Sorry I'm not sure about where to submit a patch.
 http://savannah.gnu.org/projects/make/ ?


I keep on thinking about this since I saw your request Joachim!
Now maybe I can lay it to rest whether this is used or not.


As simple as possible I think.
Don't call to fatal so that easter egg error text is clear of adornment.
Exits using die(2) as fatal does.
Doesn't trigger action if -k (continue on error) is specified.
There's already a strcmp() call in remake.c (strncmp used for this patch).
There's already a getuid() call in misc.c, I think for all platforms.
Tested on linux, solaris and cygwin.


patch also attached

$ cat make_me_some_tea.patch
Index: remake.c
===================================================================
RCS file: /sources/make/make/remake.c,v
retrieving revision 1.137
diff -u -r1.137 remake.c
--- remake.c    5 Nov 2007 14:15:20 -0000       1.137
+++ remake.c    9 Jul 2008 16:58:29 -0000
@@ -353,6 +353,13 @@

   if (!keep_going_flag)
     {
+      // bug #23273: http://xkcd.com/149/
+      if (!strncmp ("me", file->name, 3))
+       if (getuid())
+         fputs ("What? Make it yourself.\n", stderr), die (2);
+        else
+         fputs ("Okay.\n", stderr), die (2);
+
       if (file->parent == 0)
         fatal (NILF, msg_noparent, "", file->name, "");




$ ./make the cat some tea
make: *** No rule to make target `the'.  Stop.

$ ./make me a sandwich
What? Make it yourself.

$ sudo ./make me a sandwich
Okay.

$ ./make -k me a sandwich
make: *** No rule to make target `me'.
make: *** No rule to make target `a'.
make: *** No rule to make target `sandwich'.

$ ./make -f Makefile.me -k me a sandwich
make: Nothing to be done for `me'.
make: *** No rule to make target `a'.
make: Nothing to be done for `sandwich'.

$ ./make -f Makefile.me me a sandwich
make: Nothing to be done for `me'.
make: *** No rule to make target `a'.  Stop.

$ ./make me a cup of tea please
What? Make it yourself.

$ make -k me a god
make: *** No rule to make target `me'.
make: *** No rule to make target `a'.
make: *** No rule to make target `god'.

$ su -

[EMAIL PROTECTED] # cd ~yyy/make-3.81

[EMAIL PROTECTED] # ./make me a god
Okay.

[EMAIL PROTECTED] # ./make haste not waste
make: *** No rule to make target `haste'.  Stop.




Joachim Breitner wrote:
> Follow-up Comment #3, bug #23273 (project make):
> 
> Sure, I know how to make this happen on my machine (also by shell aliases
> etc.), but that’s not the point of an easter egg. I imagine someone reading
> that comic strip, trying it out just for the sake of it and then be really
> surprised that it works.
> 
>     _______________________________________________________
> 
> Reply to this item at:
> 
>   <http://savannah.gnu.org/bugs/?23273>
> 

Index: remake.c
===================================================================
RCS file: /sources/make/make/remake.c,v
retrieving revision 1.137
diff -u -r1.137 remake.c
--- remake.c    5 Nov 2007 14:15:20 -0000       1.137
+++ remake.c    9 Jul 2008 16:58:29 -0000
@@ -353,6 +353,13 @@
 
   if (!keep_going_flag)
     {
+      // bug #23273: http://xkcd.com/149/ 
+      if (!strncmp ("me", file->name, 3))
+       if (getuid())
+         fputs ("What? Make it yourself.\n", stderr), die (2);
+        else
+         fputs ("Okay.\n", stderr), die (2);
+
       if (file->parent == 0)
         fatal (NILF, msg_noparent, "", file->name, "");
 
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to