Skip to content

Fix Makefile handling of user CXXFLAGS & also add a DEBUG flag - #990

Merged
mhucka merged 4 commits into
quantumlib:mainfrom
mhucka:mh-fix-makefile-flag-handling
Jan 6, 2026
Merged

Fix Makefile handling of user CXXFLAGS & also add a DEBUG flag#990
mhucka merged 4 commits into
quantumlib:mainfrom
mhucka:mh-fix-makefile-flag-handling

Conversation

@mhucka

@mhucka mhucka commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

The way CXXFLAGS and other flags were being set meant that users had to add the default values (-std=c++17 -fopenmp -O3 etc) if they set the flags at all, or else lose the defaults. This was error-prone and suboptimal. The change here makes it so that the user values are appended at the end of the defaults, so that they can override values.

This PR also adds a DEBUG flag that switches between using -g -O0 and the regular -O3 option. Developers can invoke it using, e.g., make DEBUG=1.

mhucka added 2 commits January 5, 2026 21:57
The way `CXXFLAGS` and other flags were being set meant that users had
to add the default values (`-std=c++17 -fopenmp -O3` etc) if they set
the flags at all. The new approach here adds the user values to the
existing ones, so that they can override values more selectively.

This also adds a DEBUG flag that switches between using `-g -O0` and the
regular `-O3` option.
@github-actions github-actions Bot added the size: S 10< lines changed <50 label Jan 5, 2026
@mhucka
mhucka marked this pull request as ready for review January 6, 2026 04:11
@mhucka
mhucka enabled auto-merge January 6, 2026 04:11
Clang doesn't understand `-flto=auto` and G++ doesn't understand `-flto`.
@mhucka
mhucka added this pull request to the merge queue Jan 6, 2026
Merged via the queue into quantumlib:main with commit 6c33bda Jan 6, 2026
28 checks passed
@mhucka
mhucka deleted the mh-fix-makefile-flag-handling branch January 6, 2026 15:25
mhucka added a commit to mhucka/qsim that referenced this pull request Jan 18, 2026
…umlib#990)

The way `CXXFLAGS` and other flags were being set meant that users had
to add the default values (`-std=c++17 -fopenmp -O3` etc) if they set
the flags at all, or else lose the defaults. This was error-prone and
suboptimal. The change here makes it so that the user values are
appended at the end of the defaults, so that they can override values.

This PR also adds a DEBUG flag that switches between using `-g -O0` and
the regular `-O3` option. Developers can invoke it using, e.g., `make
DEBUG=1`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants