I have a Makefile like this
bin:
mkdir -p bin
bin/kustomize: bin
curl -fsSL "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s bin
When I run make bin/kustomize it tries to download it, every time, even though it is already there. I would expect that make doesn’t want to run that target.
When I remove the dependency to bin, it works as I expect.
>Solution :
Your bin/ is a directory, not a plain file.
The GNU make dependency in your rule
bin/kustomize: bin
says that file bin/kustomize should be reconstructed every time the modification time of bin/ is changing.
But overwriting a file entry (technically associating a name to an an inode) inside a directory is changing the directory modification time.
As commented by HolyBlackCat you want an order-only prerequisite
Should you want the building rules to fire when a content is changed (and not just using modification time), consider using other builder software, maybe omake