Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2002 08:27:07 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Peter Leftwich <Hostmaster@Video2Video.Com>
Cc:        FreeBSD LIST <FreeBSD-Questions@FreeBSD.Org>
Subject:   Re: make install clean ; more /etc/gcc.conf ; echo "Smiles..."
Message-ID:  <20020425062707.GA88136@student.uu.se>
In-Reply-To: <20020425013105.P7840-100000@earl-grey.cloud9.net>
References:  <20020425013105.P7840-100000@earl-grey.cloud9.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 25, 2002 at 01:34:44AM -0400, Peter Leftwich wrote:
> I just did `which make` thinking it was some kind of symlink (ln -s) to gcc
> or some sort of alias for gcc to use the "./Makefile" in ones current
> directory, but nupe...
> 
> So my question is this broad one ~ Can Makefiles be thought of as
> instantaneous little /etc/gcc.conf or ~/.gcc_config files?  That is, aren't
> they often just special conglomerations of flags and paths and so forth?

No.
Quoting from the manpage for make(1):

     Make is a program designed to simplify the maintenance of other
     programs.  Its input is a list of specifications describing
     dependency relationships between the generation of files and
     programs.

That 'list of specifications' is a Makefile.
In addition to describing how various files depend on each other, i.e.
which files/programs need to be created first in order to create
others, a makefile also contains rules for how to create the files.

Take a look at the following very short example of a Makefile

     foo: foo.o

     foo.o: foo.c
     	cc -c foo.c

It says that to create the file 'foo', one must first make foo.o
'foo.o'  in turn depends on 'foo.c', meaning that if 'foo.c' is updated
'foo.o' must also be updated.
The final line says that in order to make 'foo.o' the command 
'cc -c foo.c' should be executed.

The commands to be executed are often invocations of the C compiler but
that is by no means necessary.


One can do much more complicated things with makefiles.
The Makefiles found in the ports collections essentially just sets some
variables and then includes other, more complicated, makefiles from
/usr/ports/Mk/ that does the real job.

Assuming you have installed the documentation parts of FreeBSD the
following command might give you some more information:
  zmore /usr/share/doc/psd/12.make/paper.ascii.gz




-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020425062707.GA88136>