l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2006 Jan 31 13:29

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] gcc easy question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] gcc easy question

Alex Mandel wrote:
Jeff Newmiller wrote:

Alex Mandel wrote:

So I'm trying to learn how to compile things for distribution and had an easy question.
1. When I use gcc how do I tell it to output the files to a separate directory so that I have just the libraries and executables I need for distribution.

see the "-o" option for gcc.  Just specify a relative directory name as
part of the destination filename.
I guess what I'm confused about it that I'm running.
I know it uses gcc but I'm not calling it explicitly so I can' seem where to fit the -o option in.
Should I be using $gcc ?

Your original question led me to beleive that you had written a program
in C and were trying to figure out how to setup a make file that would
cleanly create the final installation files.

Given that you are trying to understand how an existing source
distribution works, I can think of two responses:

a) the "convention" is to "./configure ; make ; make install".  Most people
just do it and get on with life.

b) Picking and choosing files from the output of the build process
is something that you can normally only do if you know how the build works.
This is doable, but there can be quite a lot of "assumed knowledge"
in open source build processes.  For example, "./configure" is a shell
script to create a makefile customized for compiling that software
package on your operating system.  For example, this means that in
some cases it will accept an option as to where to put the final
files when "make install" is executed, so you can customize the installation
at a high level.  If you can follow shell script and makefiles, you
can read the configure script and the generated makefile to figure
out where things are going.

2. Will it output only what I need or will there be a bunch of intermediate files too that I could skip for the distribution.

While is is possible to compile and link from source to executable
in one step, it isn't very common for medium to large-scale programs
because the all-in-one compilation slows the development cycle down.
For this reason, many makefile authors put in a "clean" virtual target
to delete temporary files.

You might find reading [1] and [2] helpful... in particular the link to
"Makefile Conventions" in the latter.

[1] http://en.wikipedia.org/wiki/Make
[2] http://www.gnu.org/software/make/

As you can see from the above commands, maybe it's not one step. I need the results of make to end up in a directory on its own. Right now I'm using a diff program to extract new files that didn't exist in the source files but this gets me a lot of files, a ton with the .lo extension and I'm not sure I need these for the one component I need to run.
I advise building, installing, and using the package as a whole, rather
than picking and choosing pieces.  If you really need to pick and
choose, then you may have to learn rather more about how it is
constructed than you thought you would... a process that can take months
rather than minutes.

Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!