Last active
October 3, 2015 15:21
-
-
Save timm/5525b9b01324a0c57e10 to your computer and use it in GitHub Desktop.
mock: death to recursive make
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mock () | |
| { | |
| root=$(git rev-parse --show-toplevel); | |
| if [ -d "$root" ]; then | |
| ( cd $root; | |
| make $* ); | |
| else | |
| echo "mock: nothing to do"; | |
| fi | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mock
One Makefile to rule them all, in the root of your github repo.
mockpasses its parameters to that Makefile.Usage:
Installation:
Add the above lines to your .bash_profile.
Motivation
Recursive makes have been considered harmful, for decades:
Recently, I found myself committing the sin of recursive makes.
commit, I run some autogen code to update some documentation files (e.g. a python code file gets rendered as a markdown file.Makefileto rule them all in the root of my repo. But that meant changing up there, and back again, just to do a repo commit.Makefiles like this, one per directory in my repo.But with
mockI need one, and only one,Makefilein the root of my github repo (and none of the silly littleMakefiles anywhere else).