Skip to content

Commit

Permalink
Merge pull request #2127 from rosento/shell_subst
Browse files Browse the repository at this point in the history
Fix shell substitution error (##2126)
  • Loading branch information
b-gehrke authored Jun 11, 2023
2 parents adb6a48 + 8591bb0 commit 8fd7828
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions var.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ OSVERS := $(shell uname -v 2>/dev/null)
# what makes comparing version numbers much easier. If any part in the version
# string is not a number, it gets replaced by '0'.
# This macro requires features found in shells like ksh93 or bash.
#
# Since gnu make version 4.3 sharps must no longer be escaped in shell calls.
# Ubuntu 20.04 comes with version 4.2.1, 22.04 with 4.3.
# TODO: remove once 20.04 is no longer supported
ifeq '$(shell echo -e "4.3\n${MAKE_VERSION}"|sort -V|head -1)' '4.3'
version = $(shell X="$(1)"; X="$${X##*-}"; A=( $${X//./ } 0 0 0 ); \
A=( $$( printf "%d %d %d" "$${A[0]}" "$${A[1]}" "$${A[2]}" )); \
echo $$(( $${A[0]} * 1000000 + $${A[1]} * 1000 + $${A[2]} )) \
)
else
version = $(shell X="$(1)"; X="$${X\#\#*-}"; A=( $${X//./ } 0 0 0 ); \
A=( $$( printf "%d %d %d" "$${A[0]}" "$${A[1]}" "$${A[2]}" )); \
echo $$(( $${A[0]} * 1000000 + $${A[1]} * 1000 + $${A[2]} )) \
)
endif

# If stack exists, use it. Otherwise skip it and use the system GHC.
STACK ?= $(shell command -v stack 2> /dev/null)
Expand Down

0 comments on commit 8fd7828

Please sign in to comment.