Elad Weiss
Elad Weiss

Reputation: 4002

By convention, does 'make install' copy header files to /usr/include?

I do make install on a certain library I should be using. I see .so files are copied to /usr/lib, but .h are not copied to /usr/include. Is that right by convention?

Upvotes: 1

Views: 1945

Answers (3)

shawnhcorey
shawnhcorey

Reputation: 3601

Another place they may be installed is the /opt directory.

/opt/include/*.h
/opt/lib/lib*.so
/opt/bin/*

In general the top-level directories (/bin, /lib) are for the system commands and libraries (eg. /bin/bash). The /usr directories for applications software and libraries (eg. /usr/bin/libreoffice). The /opt directories for in-house software. Also, if an app needs an older library, it may be store in /opt so it won't interfere with other apps.

Upvotes: 1

Klaus
Klaus

Reputation: 25623

There is no "default" for Makefiles and install pathes. But there is a more or less common file system hierarchy which can be found e.g. here:

https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

From a user perspective I expect that any manual installation will go to /usr/local/...

/usr/... is managed by the distribution and as this it is dangerous to put own files there by default. Maybe your file will conflict with others from the distribution management.

There are a lot of conventions around with different linux ditributions and there is a "standard" which gives more rules also for file system organization: https://en.wikipedia.org/wiki/Linux_Standard_Base http://www.pathname.com/fhs/

So you can check your requirements against this standards.

Upvotes: 2

igagis
igagis

Reputation: 2079

By convention, files should be copied to

headers  -> $DESTDIR$PREFIX/include
libs     -> $DESTDIR$PREFIX/lib
binaries -> $DESTDIR$PREFIX/bin

where DESTDIR variable is empty by default. And PREFIX is usually set to something like /usr or /usr/local, depending on your intentions. Usually, software which is managed by your system's native package manager is installed to /usr, while software which is not supposed to be managed by operating system's package manager usually goes to /usr/local. So, in your case it should go to /usr/local, but what your makefile actually does is under question.

Upvotes: 3

Related Questions