Hello Aditya,
* Aditya Kousik <adit267.kousik@...9...> [2015-05-04 20:15:16 -0700]:
If I get the order of the .port and libports/lib/mk/<port-name>.mk right, DIRS and DIRS_CONTENT are the generated/copied headers during the build; and INC_DIR in the .mk file configures make to look at the current folder for local includes.
Yes, directories in DIRS get populated from the content in DIRS_CONTENT while preparing the port. Basically, the populated include directory should only contain the files that are needed on Genode. The same goes for the src directory, although we do not do that for most small libraries/applications but only for larger ones (VirtualBox, Linux sources etc).
I'm asking this because if the include files that appear in contrib-<hash>/src/lib/include have multiple dependencies, the build will still work, right? I'm guessing the headers in the DIRS are just for the genode application to include and the build system takes the actual src while compiling.
Actually, these header files are also used by the library/application itself. If the libraries depend on other libraries you only have to add the library to the LIBS variable in the .mk file and the build system will try to pick up the matching import-<port-name>.mk file. This in return will extend INC_DIR, that is used by the build system to generate the right compiler flags.
On that account, the INC_DIR variable in the import file should only contain the public header paths used by other libraries/applications. In the lib/target.mk file it is fine to point the build system and thereby the compiler to other directories in addition, e.g. $(REP_DIR)/src/lib/<port-name> or even contrib-<hash>/src. In this regard, the SDL port is a good example.
Regards Josef