I'm planing to make several projects in C and C++ under Linux. In some projects I will need additional libraries. Correct me if I'm wrong. I'm planning to store libs in /usr/local/include. But is it good practice to mix all libs in one directory? Maybe it is better to create libs name subdirectories in /usr/local/include directory? And maybe it is better to store headers and source in different directories? Best practice is needed.
How to deal with not compiled libs like for example MiniIni https://code.google.com/p/minini/. It comes with header and C files. Should I compile it and place in /lib directory and headers to /include. Or maybe it is better place everything in /include?
If you talk about libs I assume you mean compiled libraries (
.sofiles or.afiles). Those should go into/usr/local/lib/. Headers should go into/usr/local/include. Sources.cppfiles usually should not go anywhere in the installation. Sometimes it is necessary to install them, so they can be rebuild on demand (dkms comes to mind). Then the sources should go into/usr/local/src/project_name/.I personally prefer headers and libs to be installed in sub-directories of
/usr/local/includeand/usr/local/lib, but not everybody will agree.The
/usr/localprefix always should be configurable. While a traditionalmake installshould use it as a default, packagers on distros will certainly change it to install directly into/usr.