🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #1125

Re: no se como se hace un makefile,,me podeís ayudar,..por favor?

#1125
From: sergio
Date: Mon, 13 Mar 2006 23:43
39 lines
2182 bytes
On 2006-03-13, pacorubio77@gmail.com <pacorubio77@gmail.com> wrote:
> Hola..soy un poco nuevo en esto..y necesitaria un poco de ayuda..
> Tengo que hacer un makefile con los siguientes archivos o
> m�dules..lib1.cc lib.h y mi programa principal p1.cc..Como se
> har�a?Por favor agradecer�a ayuda..
>

Hola.

Un Makefile sencillo de ejemplo, suponiendo que tienes todo en el mismo
directorio, y que el objetivo es �nicamente el programa principal:

------------------------
CXX=g++
CXXFLAGS=
LDFLAGS=

p1: p1.o lib1.o
	$(CXX) $(LDFLAGS) -o p1 p1.o lib1.o

p1.o: p1.cc
	$(CXX) $(CFLAGS) -c p1.cc

lib1.o: lib1.cc
	$(CXX) $(CFLAGS) -c lib1.cc

.PHONY: clean

clean:
	rm -f p1.o lib1.o p1
-------------------------

Simple y deliberadamente expl�cito. He definido variables para que veas
c�mo se hace. Lo de .PHONY hay que ponerlo para que el objetivo clean,
que lo que hace es borrar el c�digo compilado, funcione correctamente.
En cuanto a la indentaci�n, ojo, que se hace con un tabulado.

Un saludo,
Sergio
Technical Details
Message-ID: <slrne1c0te.aa0.sergio@t4t9w4.kepis.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed101.telia.com!nf02.dk.telia.net!fu-berlin.de!nsnmpen1-lo.nuria.telefonica-data.net!nsnmrro2-lo.nuria.telefonica-data.net!not-for-mail
References: <1142243290.294262.213000@z34g2000cwc.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,a868a9d06e31de1a
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed101.telia.com!nf02.dk.telia.net!fu-berlin.de!nsnmpen1-lo.nuria.telefonica-data.net!nsnmrro2-lo.nuria.telefonica-data.net!not-for-mail
From: sergio@t4t9w4.kepis.net
Newsgroups: es.comp.os.linux.programacion
Subject: Re: no se como se hace un makefile,,me podeís
 ayudar,..por favor?
Date: Mon, 13 Mar 2006 23:43:42 +0000 (UTC)
Organization: Telefonica Data Espagna
Lines: 39
Message-ID: <slrne1c0te.aa0.sergio@t4t9w4.kepis.net>
References: <1142243290.294262.213000@z34g2000cwc.googlegroups.com>
NNTP-Posting-Host: 45.red-80-37-2.staticip.rima-tde.net
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: nsnmrro2-gest.nuria.telefonica-data.net 1142293422 4843 80.37.2.45 (13 Mar 2006 23:43:42 GMT)
X-Complaints-To: usenet@nsnmrro2-gest.nuria.telefonica-data.net
NNTP-Posting-Date: Mon, 13 Mar 2006 23:43:42 +0000 (UTC)
User-Agent: slrn/0.9.8.1 (Linux)