Skip to content

Makefile.mk: address minor issues#10000

Closed
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:mk-groff-nodetect
Closed

Makefile.mk: address minor issues#10000
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:mk-groff-nodetect

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 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 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.
@vszakats vszakats closed this in 8fc2423 Dec 2, 2022
@vszakats vszakats deleted the mk-groff-nodetect branch December 2, 2022 15:27
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.

1 participant