Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect user-set compiler and linker flags #15

Merged
merged 2 commits into from
Aug 12, 2018

Conversation

AMDmi3
Copy link
Contributor

@AMDmi3 AMDmi3 commented Nov 3, 2017

No description provided.

Copy link
Contributor

@greno4ka greno4ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really good idea! For example, I want to compile your program on my Android phone, using clang.

Please, merge this PR to your project!

Copy link
Owner

@mpereira mpereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC ?= gcc seems to not set the CC variable if the CC environment variable is unset in the shell.

Should this be handled with make conditional expressions instead?

@mpereira
Copy link
Owner

mpereira commented May 7, 2018

cc @greno4ka

@AMDmi3
Copy link
Contributor Author

AMDmi3 commented May 7, 2018

CC ?= gcc seems to not set the CC variable if the CC environment variable is unset in the shell.

No, it does. It may be affected by the system rules though which may set other default values.

% cat Makefile 
CC ?= gcc
CXX ?= g++
FOO ?= foo
  
all:
	@echo CC=${CC}
	@echo CXX=${CXX}
	@echo FOO=${FOO}
% make       
CC=cc
CXX=g++
FOO=foo
% CC=clang CXX=clang++ FOO=bar make
CC=clang
CXX=clang++
FOO=bar

@greno4ka
Copy link
Contributor

greno4ka commented May 7, 2018

I think @AMDmi3 is right. I saw many opensource projects, where is used "?=". I vote for merging this commit. How else can I help?

@mpereira
Copy link
Owner

mpereira commented May 7, 2018

Thanks for the quick replies @AMDmi3 @greno4ka

What I meant was this:

$ cat Makefile
CC ?= gcc
CXX ?= g++
FOO ?= foo

all:
	@echo CC=${CC}
	@echo CXX=${CXX}
	@echo FOO=${FOO}
$ make
CC=cc
CXX=c++
FOO=foo
$ export CC=
$ make
CC=
CXX=c++
FOO=foo

If you think this is fine I'll merge it.

Copy link
Owner

@mpereira mpereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AMDmi3!

@mpereira mpereira merged commit 5056ae8 into mpereira:master Aug 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants