Featured Whitepapers
- Peer Code Review: An Agile Process
- Learn Ways to Keep Schedules and Costs in Line With Requirements Change Management
- Java Deployments in an Enterprise Environment
- Challenges & Characteristics of Enterprise Continuous Integration
- Build Release Plans That Deliver Customer Value!
- Improving Traceability and Auditability Across the Development Lifecycle
Upcoming & Recent Webcasts
|
The colors of the US flag could be built using set_create from the complete list of colors appearing on the flag. In this example the colors appear once for the stars, once for each stripe and once for the background of the star-spangled rectangle. set_create converts a list of elements (perhaps with duplicates) into a set.
usa := $(call set_create,blue white red white red white red white red white red white red white red)
The new GMSL functions include ways of testing the relationship between sets and determining whether an individual element is in a set. The set_is_subset, set_equal and set_is_member functions use the GMSL $(true) and $(false) variables to return values. These special variables are in fact the string T (for $(true)) and an empty string (for $(false)) so that the result of a GMSL truth function can be used with built in GNU Make functions like $(if). (A full introduction to the GMSL can be found here.) all:
@echo Colors are $(if $(call set_equal,$(france),$(usa)),the same,different)
japan := $(call set_create,white red)
all:
@echo Japanese colors are $(if $(call set_is_subset,$(japan),$(france)),,not) a subset of French colors
germany := $(call set_create,black red yellow)
all: @echo German colors are $(if $(call set_is_subset,$(germany),$(france)),,not) a subset of French colors
all:
@echo Red is $(if $(call set_is_member,red,$(usa)),,not) a color in the US flag Union and intersection all:
@echo The French and German flags have the following colors: $(call set_union,$(france),$(germany))
all:
@echo The Japanese and US flags have the following colors in common: $(call set_intersection,$(japan),$(usa))
Next time I'll use these set functions to maintain a set of breakpoints (which will be the names of targets to break on) as I enhance the GNU Make Debugger to allow the user to enter breakpoints at the debugger prompt. John Graham-Cumming is Mr Make and Chief Scientist at Electric Cloud, Inc., a Silicon Valley start-up that speeds up builds by 10-20x using cluster technology.
Set as favorite
Bookmark
Email this
Hits: 11486 Trackback(0)Comments (0)
|
| Last Updated on Thursday, 23 July 2009 11:22 |

The colors of the US flag could be built using set_create from the complete list of colors appearing on the flag. In this example the colors appear once for the stars, once for each stripe and once for the background of the star-spangled rectangle. set_create converts a list of elements (perhaps with duplicates) into a set.

