In my current setting, I have some .mk
that are automatically generated, over which I have no control. One of the rules defined in these files is clean
.
The part of the code I am working on uses include
to access variables from those .mk
files. However, I'd like to have another rule clean
to remove the files generated in the folder I am working on.
If I create a rule named clean
, I get the warning
warning: overriding commands for target
Is there a way to "extend" clean, i.e., o make it run both the clean
defined in those .mk
files and my own clean
?
Of course, I could create another rule other_clean
and call the old clean
. Or also I could do something like:
other_clean:
make clean
rm *.o
But I'd like to know if there is any functionality in make that allows me to "inherit" the recipe defined elsewhere into my own clean
. I saw there are these things called double-colon rules, but I can't use them because the files I am including are automatically generated.