Improve mymake.sh to keep looking recursively in the parent folder if a rule is not found in the current Makefile

Issue #4 resolved
Lilian Besson (Naereen) repo owner created an issue

Goal

Improve mymake.sh to keep looking recursively in the parent folder if a rule is not found in the current Makefile.

Example:

│   ├── Makefile        # ← Second
│   ├── dir/
│   │   ├── Makefile    # ← First

If I run make stuff inside the directory dir, the first Makefile is read, and if it has no rule to build stuff, then I would like my improved make command (mymake.sh) to keep looking for a valid Makefile that has a rule to build stuff.

mymake.sh already goes in the parent folder recursively, this is just an improvement.

How?

Should not be too hard, grep on the output of the make command, and recursively call the same inner function after a simple cd ... Should be cautious to stop if $pwd = /...

Comments (1)

  1. Lilian Besson (Naereen) reporter

    This commit closed this issue.

    Quite hard to make it nicely, and now I have a 'make' command that does what I wanted. 👏 👏

    🎀 Bonus: the default bash autocompletion is implemented with 'make' and not '/usr/bin/make' so it now autocompletes with rules found in Makefile in higher directories. Quite surprising!

  2. Log in to comment