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

Build with optimizations by default #543

Merged
merged 1 commit into from
Oct 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,15 @@ ifdef IS_LINUX
LDFLAGS += -Wl,--no-undefined
endif

CFLAGS += -O2 -fno-omit-frame-pointer -g

ifdef COVERAGE
CFLAGS += -g -O0 --coverage
CFLAGS += -O0 --coverage
Copy link
Collaborator

Choose a reason for hiding this comment

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

-O0 will override -O2 from outer scope?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. The compiler looks at the last specified level. With DEBUG enabled we end up with -O2 -O0 which is equivalent to just -O0. (Individual flags like -fno-omit-frame-pointer are effective regardless of the optimization level set by -O.)

LDFLAGS += --coverage
endif

ifdef DEBUG
CFLAGS += -DDEBUG -g
CFLAGS += -O0 -DDEBUG
endif

ifneq ($(GEM_INSTALL_OPTIONS),)
Expand Down