LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2012, 04:52 AM   #1
mrpc_cambodia
Member
 
Registered: Jun 2004
Posts: 131

Rep: Reputation: 15
Question Determine install folder when building from source


Hi,

When building binary from source using make command line, is it possible to know the destination directory that all files will be copied to when running make install?

I suppose a few lines in the makefile will indicate this. Someone tells I could check then value of these variable prefix and exec_prefix, but what i've found is only this:

prefix = @prefix@
exec_prefix = @exec_prefix@

Don't really know what does it mean?


Thanks,

mrpc_cambodia
 
Old 01-05-2012, 08:04 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
By default most software you download and build with configure, make, make install will be installed in /usr/local -- and that's not a bad idea.

You can override the default when you execute configure. The easy way to find out what the options are is to do this:
Code:
configure --help | more
You'll see
Code:
Usage: configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]
You really only need to set PREFIX to some other tree if you want to do that; however, installing "add-on" software in /usr/local (the default) is so that you don't mix your distributed software (what you installed) with additional software; it makes it easier to keep track of what you've added.

Hope this helps some.
 
Old 01-05-2012, 10:45 AM   #3
mrpc_cambodia
Member
 
Registered: Jun 2004
Posts: 131

Original Poster
Rep: Reputation: 15
Thanks for the comment.

But I am really curious about the value @prefix@ that is assigned to the prefix variable in my case. What does it really mean?

Mrpc_cambodia
 
Old 01-05-2012, 12:44 PM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
Oh, sorry about that -- the @ as the first character on a line in a Makefile prevents the command from being echoed.

Also,
Quote:
14.5 Variables for Installation Directories

Installation directories should always be named by variables, so it is easy to install in a nonstandard place. The standard names for these variables and the values they should have in GNU packages are described below. They are based on a standard file system layout; variants of it are used in GNU/Linux and other modern operating systems.

Installers are expected to override these values when calling make (e.g., make prefix=/usr install or configure (e.g., configure --prefix=/usr). GNU packages should not try to guess which value should be appropriate for these variables on the system they are being installed onto: use the default settings specified here so that all GNU packages behave identically, allowing the installer to achieve any desired layout.

All installation directories, and their parent directories, should be created (if necessary) before they are installed into.

These first two variables set the root for the installation. All the other installation directories should be subdirectories of one of these two, and nothing should be directly installed into these two directories.

prefix
A prefix used in constructing the default values of the variables listed below. The default value of prefix should be /usr/local. When building the complete GNU system, the prefix will be empty and /usr will be a symbolic link to /. (If you are using Autoconf, write it as ‘@prefix@’.)

Running ‘make install’ with a different value of prefix from the one used to build the program should not recompile the program.
exec_prefix
A prefix used in constructing the default values of some of the variables listed below. The default value of exec_prefix should be $(prefix). (If you are using Autoconf, write it as ‘@exec_prefix@’.)

Generally, $(exec_prefix) is used for directories that contain machine-specific files (such as executables and subroutine libraries), while $(prefix) is used directly for other directories.

Running ‘make install’ with a different value of exec_prefix from the one used to build the program should not recompile the program.
See the entire section at http://www.gnu.org/software/make/man...tory-Variables.

Hope this helps some.
 
Old 01-05-2012, 10:17 PM   #5
mrpc_cambodia
Member
 
Registered: Jun 2004
Posts: 131

Original Poster
Rep: Reputation: 15
Make is the command to compile source into binary. I wonder if it's possible to inspect what's has been compiled, ex: binary, lib, etc.. before running the "make install" command so that I know what will be copied to my computer?


Thanks,
 
Old 01-06-2012, 05:30 AM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
You can read through the Makefile to see what is being "made" and what's going to happen to it; you ought to start, however, with The Gnu Make Manual, http://www.gnu.org/software/make/manual/ (this may be on your system as an info document).

You can execute make with (from the man make page)
Code:
-n, --just-print, --dry-run, --recon
Print the commands that would be executed, but do not execute them (except in certain circumstances).
Hope this helps some.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefiles, building source from another folder with obj files > subfolder of current? Funkster Programming 1 11-11-2011 07:29 AM
[SOLVED] Determine the size of each file in a folder. ppj Linux - Newbie 5 11-30-2010 10:34 AM
building from source vs. yum install vs. rpm vbekker Linux - Newbie 7 11-08-2010 09:13 PM
Determine if folder has subfolders with out overhead from find or ls davstin2002 Programming 8 12-21-2006 03:26 PM
how to determine the folder contain data or not izza_azhar Programming 2 05-24-2005 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration