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 CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS. #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PiotrSikora
Copy link

Signed-off-by: Piotr Sikora [email protected]

@PiotrSikora
Copy link
Author

cc @rossberg


# Linking C / C++ example
.PRECIOUS: ${EXAMPLES:%=${EXAMPLE_OUT}/%-c}
${EXAMPLE_OUT}/%-c: ${EXAMPLE_OUT}/%-c.o ${WASM_C_O}
${CC_COMP} ${C_FLAGS} ${LD_FLAGS} $< -o $@ \
${CXX} ${CXXFLAGS} ${LDFLAGS} $< -o $@ \
Copy link
Author

@PiotrSikora PiotrSikora May 17, 2019

Choose a reason for hiding this comment

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

Note: I changed CFLAGS to CXXFLAGS here, since CXX is used to link those targets, so it seemed more correct.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense.

@PiotrSikora
Copy link
Author

Ping.

Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

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

To be honest, I'm not a big fan of inheriting configuration flags from the environment, since they are easily clobbered by accident that way (dynamic scoping sucks!). Do you have a use case where it is not enough to set them from the command line (make VAR=X instead of VAR=X make)?


C_COMP = clang
ifeq ($(origin CC),default)
CC = clang
Copy link
Member

Choose a reason for hiding this comment

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

Why not simply CC ?= clang?

CC = clang
endif
ifeq ($(origin CXX),default)
CXX = clang++
Copy link
Member

Choose a reason for hiding this comment

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

Same here.
Of course, moving this here loses the ability to set both compilers with just one command line var.


# Linking C / C++ example
.PRECIOUS: ${EXAMPLES:%=${EXAMPLE_OUT}/%-c}
${EXAMPLE_OUT}/%-c: ${EXAMPLE_OUT}/%-c.o ${WASM_C_O}
${CC_COMP} ${C_FLAGS} ${LD_FLAGS} $< -o $@ \
${CXX} ${CXXFLAGS} ${LDFLAGS} $< -o $@ \
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense.

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.

2 participants