I'm using gnu make and stow to manage some configurations (dotfiles).
I have multiple directories in my repo:

├── Makefile
├── package1/
└── package2/

Currently, my Makefile looks like:

PACKAGES = package1 package2


all: $(PACKAGES)

    stow --no-fold $@

    stow --no-fold $@

I want to define a default rule for packages, so I did:

PACKAGES = package1 package2


all: $(PACKAGES)

    stow --no-fold $@

But that didn't work:

$ make
make: Nothing to be done for `all'.
$ make package1
make: Nothing to be done for `package1'.
$ make package2
make: Nothing to be done for `package2'.

So: Is it possible to define a "default" rule for directories? If yes, how I do it?


You could replace your rule with:

    stow --no-fold $@
  • No, that's ok. It's equivalent to specifying identical rules for every member of the list. – Gilles 'SO- stop being evil' Feb 8 '17 at 23:42
  • Thanks for the answer, this solved my issue. Just for completeness, can I override a rule for a package (possibly without generating warnings)? – S1cK94 Feb 9 '17 at 13:02
  • Thanks for the comment, Gilles. I removed the irrelevant sentence from my answer. @S1cK94: I could not find a way to override a rule without getting a warning, unfortunately. – dhag Feb 9 '17 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.