DESTDIR and PREFIX of make

后端 未结 3 1849
情书的邮戳
情书的邮戳 2020-12-07 06:44

I am trying to make software install to a specific directory. I found several ways, but not sure what are the differences between them.

  1. ./configure --pre
3条回答
  •  再見小時候
    2020-12-07 07:43

    ./configure --prefix=***

    Number 1 determines where the package will go when it is installed, and where it will look for its associated files when it is run. It's what you should use if you're just compiling something for use on a single host.


    make install DESTDIR=***

    Number 2 is for installing to a temporary directory which is not where the package will be run from. For example this is used when building deb packages. The person building the package doesn't actually install everything into its final place on his own system. He may have a different version installed already and not want to disturb it, or he may not even be root. So he uses

    ./configure --prefix=/usr
    

    so the program will expect to be installed in /usr when it runs, then

    make install DESTDIR=debian/tmp
    

    to actually create the directory structure.


    make install prefix=***

    Number 3 is going to install it to a different place but not create all the directories as DESTDIR=/foo/bar/baz would. It's commonly used with GNU stow via

    ./configure --prefix=/usr/local && make && sudo make install prefix=/usr/local/stow/foo
    

    , which would install binaries in /usr/local/stow/foo/bin. By comparison,

    make install DESTDIR=/usr/local/stow/foo
    

    would install binaries in /usr/local/stow/foo/usr/local/bin.

提交回复
热议问题