Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language make

(GNU version, no shell commands)

Date:07/30/10
Author:wrtlprnft
URL:n/a
Comments:0
Info:n/a
Score: (3.75 in 4 votes)
#!/usr/bin/make -qf

BOTTLES := 99

define BOTTLE
$(if $(1),$(if $(word 2,$(1)),$(words $(1)) bottles,1 bottle),no more bottles)
endef

define VERSE
$(call BOTTLE,$(1) .) of beer on the wall, $(call BOTTLE,$(1) .) of beer.
Take one down and pass it around, $(call BOTTLE,$(1)) on the wall.
endef

define LASTVERSE
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, $(BOTTLES) bottles of beer on the wall.
endef

define SONG
$(if $(word $(BOTTLES),$(1) .),,$(call SONG,$(1) .))$(call VERSE,$(1))


endef

$(info $(SONG)$(LASTVERSE))

.PHONY: all
all:

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
make syntax,portable,simple,dependenciesrahul03/17/080
2Andrew Dunstan04/20/053

Comments

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: