Skip to content

Use autovariables to reduce redundancy in rule definitions#246

Draft
jamezpolley wants to merge 2 commits intomainfrom
use-autovariables
Draft

Use autovariables to reduce redundancy in rule definitions#246
jamezpolley wants to merge 2 commits intomainfrom
use-autovariables

Conversation

@jamezpolley
Copy link
Member

depends-on: #245

The intention here is to reduce redundancy in rule definitions, so that it's easier to ensure that any change that applies to all the related targets does apply to all of them.

The way it achieves this is via the $@ auto-variable so that we can have one rule with multiple targets, and run the command only on the target that was invoked.

  • Because the targets have prefixes (check-, apply-, tf-), patsubst is used to trim the prefix. This is most clearly seen in the tf- rules - $(patsubst tf-%,%,$@)
  • Additionally, I didn't want to break the use of "rtk" as shorthand for "righttoknow", so I've added a subst call to handle that expansion.

However, I'm not sure if the outcome is good. On the plus side - it does remove redundancy. On the minus side - it loses readability, and I'm not sure that the reduction in redundancy justifies the loss of readability.

Feedback requested!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants