Skip to content

Commit

Permalink
Makefile.mk: expect NROFF variable instead of auto-detection
Browse files Browse the repository at this point in the history
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 #10000

[ci skip]
  • Loading branch information
vszakats committed Nov 29, 2022
1 parent f83610c commit 1454b0e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions lib/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,11 @@ DEL = rm -f $1
COPY = -cp -afv $1 $2
MKDIR = mkdir -p $1
RMDIR = rm -fr $1
WHICH = command -v
else
DEL = -del 2>NUL /q /f $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
MKDIR = -md 2>NUL $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
WHICH = where
endif

all: $(TARGETS)
Expand Down
3 changes: 1 addition & 2 deletions src/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ TOCLEAN := $(curl_OBJECTS)

ifneq ($(wildcard tool_hugehelp.c.cvs),)
PERL ?= perl
NROFF ?= groff

TOCLEAN += tool_hugehelp.c

ifneq ($(shell $(WHICH) $(NROFF)),)
ifdef NROFF
$(PROOT)/docs/curl.1: $(wildcard $(PROOT)/docs/cmdline-opts/*.d)
cd $(PROOT)/docs/cmdline-opts && \
$(PERL) gen.pl mainpage $(notdir $^) > ../curl.1
Expand Down

0 comments on commit 1454b0e

Please sign in to comment.