Couple questions from a newbie

Gerard Beekmans gerard at linuxfromscratch.org
Mon Jul 24 15:34:28 PDT 2000


> Let me see if I understand the build process correctly. When you run
> configure, the script checks a bunch of host-specific things (like cpu,
> libc version, etc) and uses the information it gains to create
> Makefiles. The only thing the configure script does is create Makefiles,
> right?

Not entirely. It also creates other files but Makefile files like
config.h and sometimes other config. files in various subdirectories.

You imagine a package like binutils that has more than one Makefile and
has a couple of files in various subdirectories. If you compile the
package with a command like "make prefix=$LFS/usr" it will not always
work. It will pass prefix=$LFS/usr to the top-level Makefile file, but
often not to the Makefile files in the other directories. So you would
have to execute "make -e prefix=$LFS/usr" to make sure your environment
variable prefix preceeds the variables declared in all the Makefile
files. But using the "-e" make paramater doesn't only override the
prefix variable, it also overrides possible other variables like CFLAGS
and CXXFLAGS.

Often this will not pose a problem, but there's always the case where a
package takes your CFLAGS environment variable during the 'configure'
stage and *adds* a couple of variables to the CFLAGS variable that ends
up in the Makefile files. Passing "-e" to the make program causes make
to ingore CFLAGS declared in Makefile files and uses whatever your shell
has declared which, as you can guess, results in a CFLAGS used during
compilation that could miss variables which cause the package to either
not compile or compile with missing features.

So, to avoid this happening, override as little as possible and use
configure to setup your variables like prefix and CFLAGS. If the
binutils had a configure option to set the 'tooldir' variable I'd use
that.

> Since nothing is compiled until the make stage, it seems that it is
> pointless to set the --prefix option in the configure stage if you are
> just going to override it in the make stage. Does configure do something
> with the option, other than just pass it on to the Makefiles?

Like said above, it sometimes adds other values to it (especially in
case of setting CFLAGS and CXXFLAGS variables)
 
> I could have sworn I tried setting tooldir=/usr and I still got that
> directory, but I'll try again tonight. If I still end up with it, I'll
> just delete it.

Passing -e might be necessary in your case done (like it is with gcc
when you want to set a LDFLAGS variable. Without -e, that variable isn't
passed into make sub-processes that run in sub-directories)

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
--
Mail archive: http://www.pcrdallas.com/mail-archives/lfs-discuss
IRC access: server: irc.linuxfromscratch.org port: 6667 channel: #LFS
Unsubscribe: email lfs-discuss-request at linuxfromscratch.org and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)



More information about the lfs-dev mailing list