Reputation: 822
In a makefile, what is the difference in meaning between include
and -include
?
Examples:
-include $(APPINCLUDES)
include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET)
Upvotes: 38
Views: 15217
Reputation: 122391
The difference is that -include
won't generate an error if the include file doesn't exist.
The -
prefix can be used many places in the Makefile
to perform actions that you don't mind if they fail.
Upvotes: 50
Reputation: 229088
From the docs
If you want make to simply ignore a makefile which does not exist or cannot be remade, with no error message, use the -include directive instead of include, like this:
-include filenames...
This acts like include in every way except that there is no error (not even a warning) if any of the filenames (or any prerequisites of any of the filenames) do not exist or cannot be remade.
Upvotes: 10