Most of the time spent on developing software is in the maintenance phase of its lifecycle (adding new features, fixing bugs). In SaaS, where software is sold to customers as a service - its critical to get developer productivity high in this phase.
Unix utility make is the swiss army knife of software automation toolset. Unfortunately, lots of new programmers get scared by its peculiar tab syntax. However there are lots of rewards for programmers who spend a little bit of extra time learning about the extensive feature set of make.
Unix utility make is the swiss army knife of software automation toolset. Unfortunately, lots of new programmers get scared by its peculiar tab syntax. However there are lots of rewards for programmers who spend a little bit of extra time learning about the extensive feature set of make.
One of the niceties of make lies in making use of its meta-programming features (using built in eval function). Using eval, we can define new targets runtime. I use this technique all the time - avoiding boilerplate work (for me and other developers on the team).
Here's the tip/ trick in all its glory:
# we assume that each module is encapsulated # in its own directory (relative to current) # note: $$ is needed to escape make from # interpreting $N (from $NF) modules=$(shell \ls -l . | awk '/^d/ {print $$NF}') # 'all' target is the default # needs to be the first target # in the Makefile all: $(modules) # ensure that presence of directory # does not imply to make # that the module has already # been built .PHONY: $(modules) # build process of a single module # $(1) is the passed in module name define process_module $(1): @echo building $(1) endef # for each module 'x' evaluate the # macro process_module $(foreach x,$(modules),$(eval $(call process_module,$(x))))
1 comment:
Can I post your publish to my wordpress weblog? I'll add a one-way link to your forum. That’s one actually nice post.
Here is my web page stop working when pregnant
Post a Comment