From owner-freebsd-questions@FreeBSD.ORG Wed Mar 19 06:38:55 2008 Return-Path: Delivered-To: FreeBSD-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EBD7106564A for ; Wed, 19 Mar 2008 06:38:55 +0000 (UTC) (envelope-from peter@boosten.org) Received: from smtpq2.tilbu1.nb.home.nl (smtpq2.tilbu1.nb.home.nl [213.51.146.201]) by mx1.freebsd.org (Postfix) with ESMTP id B10738FC1A for ; Wed, 19 Mar 2008 06:38:54 +0000 (UTC) (envelope-from peter@boosten.org) Received: from [213.51.146.190] (port=46391 helo=smtp1.tilbu1.nb.home.nl) by smtpq2.tilbu1.nb.home.nl with esmtp (Exim 4.60) (envelope-from ) id 1Jbrwr-0003r0-2d; Wed, 19 Mar 2008 07:38:53 +0100 Received: from cp268254-a.landg1.lb.home.nl ([84.25.65.88]:5024 helo=ra.egypt.nl) by smtp1.tilbu1.nb.home.nl with esmtp (Exim 4.60) (envelope-from ) id 1Jbrwq-0006nN-FC; Wed, 19 Mar 2008 07:38:52 +0100 Received: from [127.0.0.1] (xp.egypt.nl [192.168.13.35]) by ra.egypt.nl (Postfix) with ESMTP id D366139877; Wed, 19 Mar 2008 07:38:51 +0100 (CET) Message-ID: <47E0B4FA.1070605@boosten.org> Date: Wed, 19 Mar 2008 07:38:50 +0100 From: Peter Boosten User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Eduardo Cerejo References: <20080318225936.9ef5af16.ejcerejo@optonline.net> In-Reply-To: <20080318225936.9ef5af16.ejcerejo@optonline.net> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 080319-0, 03/19/2008), Outbound message X-Antivirus-Status: Clean X-Spam-Score: 0.0 (/) Cc: FreeBSD-questions@FreeBSD.org Subject: Re: Gcc and make not producing executable X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Mar 2008 06:38:55 -0000 Eduardo Cerejo wrote: > Objective is to create a makefile which will create an executable named main. The books has this code in the Makefile: > > CC=gcc > CFLAGS=-Wall > main: main.o hello_fn.o > > clean: > rm -f main main.o hello_fn.o > > The book says this should create two object files named main.o and hello_fn.o plus an executable named main. gmake does the trick. Otherwise your Makefile should look like this: main: main.o hello_fn.o gcc main.o hello_fn.o -o main main.o: main.c gcc -c main.c hello_fn.o: hello_fn.c gcc -c hello_fn.c clean: rm -f main *.o Or easier: CC=gcc main: main.o hello_fn.o $(CC) main.o hello_fn.o -o main .c.o: $(CC) $(CFLAGS) -c $< clean: rm -f main *.o Peter -- http://www.boosten.org