From csus.edu!csusac!charnel.ecst.csuchico.edu!yeshua.marcam.com!usc!howland.reston.ans.net!news.sprintlink.net!EU.net!uunet!psinntp!uu1030!sparco!shoe Tue Nov  1 21:33:02 1994
Newsgroups: comp.lang.c++
Path: csus.edu!csusac!charnel.ecst.csuchico.edu!yeshua.marcam.com!usc!howland.reston.ans.net!news.sprintlink.net!EU.net!uunet!psinntp!uu1030!sparco!shoe
From: shoe@objectSpace.com (Brett L. Schuchert)
Subject: Re: makefile : g++
In-Reply-To: skramiah@red.seas.upenn.edu's message of 25 Oct 1994 19:54:59 GMT
Message-ID: <SHOE.94Oct28082343@sparco.sparco>
Organization: objectSpace, Inc.
Date: Fri, 28 Oct 1994 14:23:43 GMT

> Can someone tell me how to create a makefile. I would like
> to include the -ggdb option too while compiling.
> I am using g++ .

The following is a generic Makefile. Call it either 'makefile' or
'Makefile' in the current directory. Type 'make' to make your program
or 'make clean' to remove all .o files and the executable.

Just fill in the blanks for other programs. 

The following marcors are used:
	CC	define which compiler to use
	CFLAGS	define compiler flags used for compiling and linking
	SRCS	list of source files for program
	OBJS	don't modify. can add to end with hard-coded obj files
		if you have to link to code you don't have source for.
	LIBS	any libs you may need
	TARGET	name of program to execute

Find a good book on make. The one by nutshell is a good book.

shoe
----------- cut here ----------------
CC 	= g++
CFLAGS 	= -ggdb
SRCS 	= a.c b.c c.c d.c
OBJS	= $(SRCS:.c=.o)
LIBS	=
TARGET	= myExeName

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

clean:
	rm -f $(OBJS) $(TARGET)


