Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Makefile: propose to remove CXX
Makefile: propose to remove CXX [message #32207] Sun, 01 May 2011 00:19 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

When Makefile is made by TheIDE, the CXX directive is included:
CXX = c++

It is not that good when one's using non-default compiler (i.e. g++44 instead of c++). I propose removing this directive from generated Makefile or at least make it optional, when CXX is not defined by environment.
Re: Makefile: propose to remove CXX [message #32209 is a reply to message #32207] Sun, 01 May 2011 09:59 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Mindtraveller wrote on Sun, 01 May 2011 00:19

When Makefile is made by TheIDE, the CXX directive is included:
CXX = c++

It is not that good when one's using non-default compiler (i.e. g++44 instead of c++). I propose removing this directive from generated Makefile or at least make it optional, when CXX is not defined by environment.

Hi Pavel,

It is easy to override the value on command line, but I understand that if you already have it in environment, it is annoying to write it every time.

There is a little problem: The CXX variable is not guaranteed to be defined if it is not stated in makefile. GNU make sets it to g++, BSD make probably too, but it is not in the POSIX specification so other implementations may differ. The conditional assignment CXX ?= c++, which would solve this elegantly is an extension as well. Again, it works in GNU make and BSD make, but it is not guaranteed to work everywhere...

The only fully POSIX compliant solution I can think of is using make with -e option, which causes environment variables to have higher precedence than macro definitions in makefile. The only downside of this (apart from having to type the additional '-e') is that if someone has an empty environment variable CXX, it overrides it as well.

So the question is whether we want to keep the makefile as portable as possible for the price of little inconvenience of typing few more characters for some users OR making it slightly less portable but easier to use. Anyone else has an opinion on this?

Best regards,
Honza
Previous Topic: Linking Ubuntu 10.10
Next Topic: MINGW resource compile problem , M$ Windows
Goto Forum:
  


Current Time: Wed Oct 21 04:01:50 CEST 2020

Total time taken to generate the page: 0.01467 seconds