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

Fix Makefile errors that prevent builds on macOS #409

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

humblehacker
Copy link
Contributor

@humblehacker humblehacker commented Mar 15, 2024

What's changed:

Remove unnecessary quotes from variable assignments, errant comments, and an unnecessary call to strip. I also inlined the variable detected_OS since it's only used in one place.

Why has this change been implemented:

Back in January 2023, some changes were made to Makefile to drop some flags that aren't available in macOS builds that were causing those builds to fail.

Unfortunately, these changes had a few small syntax issues that prevent the conditional checks for "Darwin" from ever being true. See commits 0e19696, d011eea, 0737d53.

Specifically, a trailing comment after a variable assignment with spaces before the comment character actually has the effect of adding those trailing spaces to the variable being assigned (detected_OS). The subsequent line attempts to strip these spaces, but inadvertently adds them back with another trailing comment. Further, the quotes around these assignments added in commit 0737d53 also end up verbatim in the variable's value. The consequence of this the comparison actually ends up comparing "Darwin" with Darwin, so the check never succeeds and the wrong flags are used. You can confirm this by adding

echo .$(detected_OS).

to the all target and running make. You'll see the quotes and extra spaces between the dots when the echo command is written to the console (the quotes are eaten by the shell when echo is executed).

What (if any) actions must a user take after this change:

No user actions necessary. I tested these changes on macOS 14.4 and Ubuntu Linux 22.04.4 LTS

Back in January 2023, some changes were made to the Makefile to drop
some flags that aren't available in macOS builds, that were causing
those builds to fail.

Unfortunately, these changes had a few small syntax issues that prevent
the conditional checks for "Darwin" from ever being true. See commits
0e19696, d011eea, 0737d53.

Specifically, a trailing comment after a variable assignment with spaces
before the comment character actually has the effect of adding those
trailing spaces to the variable being assigned (`detected_OS`). The
subsequent line attempts to strip this spaces, but inadvertently adds
them back with another trailing comment. Further, the quotes around
these assignments added in commit 0737d53 also end up verbatim in the
variable's value. The consequence of this the comparison actually ends up
comparing `"Darwin" ` with `Darwin`, so the check never succeeds and the
wrong flags are used. You can confirm this by adding

    echo .$(detected_OS).

to the `all` target and running make. You'll see the quotes and extra
spaces between the dots when the echo command is written to the console
(the quotes are eaten by the shell when echo is executed).

The fix is to remove the unnecessary quotes, the comments, and the now
unnecessary call to `strip`. I went a bit further and removed `detected_OS`
altogether since it's only used in one place.

I tested these changes on macOS 14.4 and Ubuntu Linux 22.04.4 LTS
@ReFil
Copy link
Collaborator

ReFil commented Mar 15, 2024

The quotes were added to facilitate WSL support, I'll give it a test on WSL and get back to you

@humblehacker
Copy link
Contributor Author

humblehacker commented Mar 15, 2024 via email

@ReFil
Copy link
Collaborator

ReFil commented Mar 15, 2024

Leave it as is for now and i will give it a test on wsl

@ReFil
Copy link
Collaborator

ReFil commented Apr 1, 2024

Sorry it took me so long to test this! I can confirm it still builds on my WSL instance

@ReFil
Copy link
Collaborator

ReFil commented Apr 1, 2024

Would you be able to tweak changelog.md to the PR title and link with the current date? Other than that it looks good to me :)

@humblehacker
Copy link
Contributor Author

Sure thing. Thanks!

@ReFil ReFil merged commit 742d19e into KinesisCorporation:V3.0 Apr 2, 2024
1 check passed
@ReFil
Copy link
Collaborator

ReFil commented Apr 2, 2024

Thanks!

alok added a commit to alok/Adv360-Pro-ZMK that referenced this pull request Apr 8, 2024
…ro-ZMK

* 'V3.0' of https://github.com/KinesisCorporation/Adv360-Pro-ZMK:
  Fix Makefile errors that prevent builds on macOS (KinesisCorporation#409)
  Fix version.dtsi is reset after local firmware build (KinesisCorporation#385)
  Update build workflows (KinesisCorporation#376)
fmgrotepass added a commit to fmgrotepass/Adv360-Pro-ZMK that referenced this pull request Apr 9, 2024
Fix Makefile errors that prevent builds on macOS (KinesisCorporation#409)
ztomer pushed a commit to ztomer/Adv360-Pro-ZMK that referenced this pull request Apr 16, 2024
ztomer pushed a commit to ztomer/Adv360-Pro-ZMK that referenced this pull request Apr 16, 2024
gabrielfreiberg added a commit to gabrielfreiberg/Adv360-Pro-ZMK that referenced this pull request May 5, 2024
* upstream_V3.0:
  Changelog update (KinesisCorporation#448)
  Minor docs update (KinesisCorporation#445)
  Document new layer colors and modifier color configuration option (KinesisCorporation#431)
  Zephyr 3.5 Update (KinesisCorporation#426)
  Fix Makefile errors that prevent builds on macOS (KinesisCorporation#409)
  Fix version.dtsi is reset after local firmware build (KinesisCorporation#385)
  Update build workflows (KinesisCorporation#376)
gabrielfreiberg added a commit to gabrielfreiberg/Adv360-Pro-ZMK that referenced this pull request May 5, 2024
* main:
  Changelog update (KinesisCorporation#448)
  Minor docs update (KinesisCorporation#445)
  Document new layer colors and modifier color configuration option (KinesisCorporation#431)
  Zephyr 3.5 Update (KinesisCorporation#426)
  Fix Makefile errors that prevent builds on macOS (KinesisCorporation#409)
  Fix version.dtsi is reset after local firmware build (KinesisCorporation#385)
  Update build workflows (KinesisCorporation#376)
psoldunov added a commit to psoldunov/Adv360-Pro-ZMK that referenced this pull request Jun 10, 2024
Fix Makefile errors that prevent builds on macOS (KinesisCorporation#409)
zemackdaddy pushed a commit to zemackdaddy/Adv360-Pro-ZMK that referenced this pull request Jul 7, 2024
cr0rc pushed a commit to cr0rc/Adv360-Pro-ZMK that referenced this pull request Jul 13, 2024
moritzschatz pushed a commit to moritzschatz/Adv360-Pro-ZMK that referenced this pull request Aug 24, 2024
jan-l pushed a commit to jan-l/Adv360-Pro-ZMK that referenced this pull request Aug 28, 2024
shafayetkhan pushed a commit to shafayetkhan/Adv360-Pro-ZMK that referenced this pull request Sep 10, 2024
martypenner added a commit to martypenner/Adv360-Pro-ZMK that referenced this pull request Nov 6, 2024
* V3.0: (40 commits)
  Changelog update (KinesisCorporation#448)
  Minor docs update (KinesisCorporation#445)
  Document new layer colors and modifier color configuration option (KinesisCorporation#431)
  Zephyr 3.5 Update (KinesisCorporation#426)
  Fix Makefile errors that prevent builds on macOS (KinesisCorporation#409)
  Fix version.dtsi is reset after local firmware build (KinesisCorporation#385)
  Update build workflows (KinesisCorporation#376)
  Makefile enhancements to optimize local workflows (KinesisCorporation#363)
  Update Makefile variables (KinesisCorporation#335)
  Base ZMK update (KinesisCorporation#326)
  Prefer `tr` to ${char^^}, which does not work on older bash versions (KinesisCorporation#303)
  Add version macro (KinesisCorporation#300)
  Add pull request template (KinesisCorporation#293)
  Revert "Updated keymap"
  Revert "Updated keymap"
  Updated keymap
  Updated keymap
  Make get_version use bash from $PATH (KinesisCorporation#287)
  Update bluetooth settings in light of user feedback (KinesisCorporation#289)
  Revert "Add version macro to keymap.json (KinesisCorporation#269)"
  ...
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