If you like this comic from xkcd.com, you are now able to reproduce the conversation in your shell. You only need this makefile:
me a:
@true
sandwich.:
ifeq ($(shell if touch / 2> /dev/null; then id -u; fi),0)
@echo "Okay."
else
@echo "What? Make it yourself."
endif
.PHONY: me a sandwich.
Download the Makefile from my sandwich branch or copy & paste the text above into your preferred editor (you have to convert the spaces to tabs) and save it as Makefile. Then you can run “make me a sandwich.” in your terminal and see what happens.
Sandwich makefile
25. July 2009 by overbenny
18 Responses

You had to make a branch out of a ten-line makefile?
I needed a place where I could upload the Makefile. So why not using Launchpad? I tweaked the makefile; it lost two lines.
I tried out your project, but much to my surprise, when I tried to get the computer to make me a sandwich, even when using sudo, it didn’t.
Even when it said that it would make one, no sandwich appeared on either STDPLT or STDNPKN. I think the sandwich is incorrectly going to /bin
Please fix or I will go back to Brevel and never use Linux for sandwich making again!
STDPLT? STDNPKN? Brevel?
STDPLT = standard plate
STDNPKN = standard napkin
@doctormo
i think you need a sandwich maker device
Then try /dev/sandwichmaker < ingredients
That should do it!
STDPLT = standard plate
STDNPKN = standard napkin
brevel = sandwich maker machine?
I made a slightly modified version for me to use until I install Linux on the sandwich maker.
It can be found here: http://ewanm89.co.uk/Makefile
Nice.
On another not, was wearing my xkcd t-shirt with this on when I stumbled upon your post
I wore this xkcd t-shirt when I was writing the makefile.
your makefile is insecure.
$ fakeroot make me a sandwich.
Okay.
The security issue is now fixed.
[...] Sandwich makefile If you like this comic from xkcd.com, you are now able to reproduce the conversation in your shell. You only need this [...] [...]
[...] Sandwich makefile « Overbenny’s Blog [...]
[...] Sandwich makefile « Overbenny’s Blog [...]
Interessanter Artikel
[...] Um Alemão fez um makefile onde podemos simular este cartoon na shell. Vejam no Overbenny’s Blog. [...]