5.1.3.2. Avoid Duplicating Include Files

Avoid duplicating include files. Use append files (.bbappend) for each recipe that uses an include file. Or, if you are introducing a new recipe that requires the included file, use the path relative to the original layer directory to refer to the file. For example, use require recipes-core/somepackage/somefile.inc instead of require somefile.inc. If you're finding you have to overlay the include file, it could indicate a deficiency in the include file in the layer to which it originally belongs. If this is the case, you need to address that deficiency instead of overlaying the include file.

For example, consider how support plug-ins for the Qt 4 database are configured. The Source Directory does not have MySQL or PostgreSQL. However, OpenEmbedded's layer meta-oe does. Consequently, meta-oe uses append files to modify the QT_SQL_DRIVER_FLAGS variable to enable the appropriate plug-ins. This variable was added to the qt4.inc include file in the Source Directory specifically to allow the meta-oe layer to be able to control which plug-ins are built.