From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: Makefiles with DJGPP Date: Sat, 18 Aug 2001 17:45:30 +0100 Lines: 23 Message-ID: References: NNTP-Posting-Host: modem-60.acyclovir.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg4.svr.pol.co.uk 998153183 2582 62.136.75.188 (18 Aug 2001 16:46:23 GMT) NNTP-Posting-Date: 18 Aug 2001 16:46:23 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Patrick Mitran" wrote: > Hi, > > I'm trying to write a makefile that will run with DJGPP and Linux. There is > only > one issue that troubles me. I have a line > > LDLIBS = -lm -lstdcxx > > in my makefile. In DJGPP, this links fine, no problem. In linux, I would > need > the second library to be -lstdc++ instead. How can I make the makefile > detect the build environment and choose the right library? Another solution to the one already mentioned is to rewrite the internal make rule to use g++ for linking rather than gcc. With ths rule the makefile should DTRT however g++/libstdc++ are named: LDLIBS = -lm %: %.o $(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@