I have a simple makefile project where I just want make install to copy files to a target folder, ie:
all:
@echo "Nothing to build"
install:
cp ./*.wav /usr/share/snd
my_custom_target:
@echo "For testing purposes"
However, whenever I try to build any targets (ie: clean, all, install, my_custom_target, etc), every single one just echos “Nothing to be done for 'clean'“, “Nothing to be done for 'all'“, etc. My guess is that a makefile project is expecting at least something being built (ie: C/C++ file, etc).
Does anyone have any suggestions on how to proceed with this?
Thank you.
This seems to indicate that
makeis not able to find, or not able to correctly parse, your Makefile. What is the file named?Also, ensure that the commands in each rule (like the
cp ./*.wav /usr/share/snd) are prefixed by an actual tab character, not spaces. In the sample that you pasted in, they are prefixed simply by three spaces, but formaketo parse it properly, they need to be prefixed by an actual tab character.One more thing to check is whether there are files named
all,install, ormy_custom_target. Make does not care about whether some C or C++ file is built; the rules can do anything that you want. But it does check to see if there is a file named the same as the rule, and whether it is newer than the dependencies of the rule. If there is a file, and it is newer than all dependencies (or there are no dependencies, like in this example), then it will decide that there is nothing to do. In order to avoid this, add a.PHONYdeclaration to indicate that these are phony targets and don’t correspond to actual files to be built; thenmakewill always run these recipes, whether or not there is an up-to-date file with the same name.