ramkuma@a.cs.okstate.edu (Ramkumar) (11/22/89)
========================================================================= I am posting the replies I received for my posting Is it possible to construct MAKEFILE for C++ programs? If yes, how? Thanks for your response. ------------------------------------------------------------------------ The following are the replies I received . - Ram Kumar ======================================================================== In-Reply-To: <5145@okstate.UUCP> Organization: Unify Corporation, Sacramento, CA, USA Cc: Yes. It is created the same way as a makefile for any other program. -Greg -- ------------------------------------------------------------------------------- Greg Pasquariello (916) 920-9092 grp@unify.UUCP Unify Corporation ...!{csusac, pyramid}!unify!grp Date: Mon, 20 Nov 89 12:28:47 EST From: "Joseph C. Konczal" <konczal@mail-gw.ncsl.nist.gov> Organization: National Institute of Standards and Technology formerly National Bureau of Standards Disclaimer: Opinions expressed are those of the sender and do not reflect NIST policy or agreement. Message-Id: <8911201728.AA00296@mail-gw.ncsl.nist.gov> To: ramkuma@a.cs.okstate.edu In-Reply-To: Ramkumar's message of 18 Nov 89 20:45:47 GMT Subject: Can a MAKEFILE be made for C++ programs? You can construct a Makefile to do just about anything. You need to define the suffix that you start with and the one you end up with in the .SUFFIXES rule, and then make a rule for compiling, like cc.o to produce an object file from a C++ source file with a suffix of `cc'. below. Here is what I usually put at the beginning of a Makefile so that it will compile C and C++ programs using GNU C and GNU C++: .SUFFIXES: .o .c .cc CC= gcc CFLAGS= -g -O C++= g++ C++FLAGS= -g -O .c.o: ${CC} -c ${CFLAGS} $< .cc.o: ${C++} -c ${C++FLAGS} $< .c: ${CC} ${CFLAGS} -o $* $< .cc: ${C++} ${C++FLAGS} -o $* $< -lg++ --Joe