Re: gcc questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 27, 2005 at 09:08:26PM +0200, Dotan Cohen wrote:
> As for the -o option, I would like to have the compiler output
> filename.out for filename.c without me having to write it out every
> time. Is this possible? If the answer to that question lies in the man
> page, then it is in the second half!


The real answer to this is: learn how to write a simple makefile. You can
find some quick tutorials on the web. It seems intimidating, but although
makefiles *can* get really complicated, a basic one is very simple. You have
a list of things you want to make, and for each thing, a list of the steps
to make it. (Really, the biggest gotcha is the strange syntax, where
indentation *must* be done with tabs.)

Or, since you're staring from scratch, you could use scons, which is
designed as a more modern replacement for make. It's included in Fedora
Extras.

A simple SContruct file for your "filename.c" would look like this:

  Program('filename.c')

and that's it (no indentation, though). You'd then type "scons" to build it.

Hmmm -- on my system, I don't need to link in libm explicitly to get sqrt()
-- it just works. But if you *do* need a library, do this:

  Program('filename.c',LIBS='m')




-- 
Matthew Miller           mattdm@xxxxxxxxxx          <http://mattdm.org/>
Boston University Linux      ------>              <http://linux.bu.edu/>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux