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

Makefile.mk: address minor issues #10000

Closed
wants to merge 3 commits into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Nov 29, 2022

  • Fix NROFF auto-detection with certain shell/make-build combinations:

    When a non-MSYS2 GNU Make runs inside an MSYS2 shell, Make executes
    the detection command as-is via CreateProcess(). It fails because
    command is an sh built-in. Ensure to explicitly invoke the shell.

  • Initialize user-customizable variables:

    Silences a list of warnings when running GNU Make with the option
    --warn-undefined-variables. Another benefit is that it's now easy
    to look up all user-customizable Makefile.mk variables by grepping
    for ?= in the curl source tree.

    Suggested-by: Gisle Vanem
    Ref: Makefile.mk: portable Makefile.m32 #9764 (comment)

  • Fix MKDIR invocation:

    Avoid a warning and potential issue in envs without forward-slash
    support.

Closes #10000

@vszakats vszakats added build Windows Windows-specific labels Nov 29, 2022
vszakats added a commit to vszakats/curl that referenced this pull request Nov 29, 2022
Auto-detection used either `command -v` (for unixy shells) or `where`
(for Windows ones). The former is an internal command, and it fails to
run from an MSYS2 shell via a non-MSYS2 GNU Make, because make executes
it as-is via `CreateProcess()`. This also results in a warning.

Prepending `$(SHELL) -c` would fix it, but would also need to enclose
the rest of the command line in quotes, what makes this code
overly complex for little benefit. Using `which` would also solve it,
but this isn't the correct way to check for tool presence and some *nix
systems don't have it.

Resolve this by dropping auto-detection and expect the caller to set the
`NROFF` variable to `nroff`/`groff` tool, in case someone wants to
rebuild the manual and such tool is available.

Closes curl#10000

[ci skip]
@vszakats vszakats removed the Windows Windows-specific label Nov 29, 2022
@vszakats vszakats changed the title Makefile.mk: expect NROFF variable instead of auto-detection Makefile.mk: address two minor issues Nov 29, 2022
vszakats added a commit to vszakats/curl that referenced this pull request Nov 29, 2022
Auto-detection used either `command -v` (for unixy shells) or `where`
(for Windows ones). The former is an internal command, and it fails to
run from an MSYS2 shell via a non-MSYS2 GNU Make, because make executes
it as-is via `CreateProcess()`. This also results in a warning.

Prepending `$(SHELL) -c` would fix it, but would also need to enclose
the rest of the command line in quotes, what makes this code
overly complex for little benefit. Using `which` would also solve it,
but this isn't the correct way to check for tool presence and some *nix
systems don't have it.

Resolve this by dropping auto-detection and expect the caller to set the
`NROFF` variable to `nroff`/`groff` tool, in case someone wants to
rebuild the manual and such tool is available.

Closes curl#10000

[ci skip]
@vszakats vszakats changed the title Makefile.mk: address two minor issues Makefile.mk: address minor issues Nov 29, 2022
Auto-detection used either `command -v` (for unixy shells) or `where`
(for Windows ones). The former is an internal command, and it fails to
run from an MSYS2 shell via a non-MSYS2 GNU Make, because make executes
it as-is via `CreateProcess()`. This also results in a warning.

Prepending `$(SHELL) -c` would fix it, but would also need to enclose
the rest of the command line in quotes, what makes this code
overly complex for little benefit. Using `which` would also solve it,
but this isn't the correct way to check for tool presence and some *nix
systems don't have it.

Resolve this by dropping auto-detection and expect the caller to set the
`NROFF` variable to `nroff`/`groff` tool, in case someone wants to
rebuild the manual and such tool is available.

Closes curl#10000

[ci skip]
This silences a list of warnings when GNU Make is run with the option
`--warn-undefined-variables`. Another benefit is that it is now easy
to look up all user-customizable `Makefile.mk` variables by grepping
for ` ?=` in the curl source tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant