Sometimes while I’m deep inside mgmt’s project directory, I want to run an operation from the Makefile which lives in the root! Unfortunately, if you do so while nested, you’ll just get:
james@computer:~/code/mgmt/resources$ make build make: *** No rule to make target 'build'. Stop. The Ten Minute Solution:
I figured I’d hack out a quick solution. What I came up with looks like this:
#!/bin/bash # James Shubin, 2018 # run `make` in the first directory (or its parent recursively) that it works in MF='Makefile' # looks for this file, could look for others, but that's silly CWD=$(pwd) # starting here while true; do if [ -e "$MF" ]; then make $@ # run make!