Add redundant $(shell ...) in Makefile to fix builds on MacOS

MacOS uses an old GNU make that does not support the != syntax.

That syntax is not Posix (yet, it is accepted for next standard) but
we really need a way to call the shell from a Makefile. Hopefully we
can remove this soon (not holding my breath though)

Fixes #5117
This commit is contained in:
Maxime Coste 2024-03-31 20:19:20 +11:00
parent 7b93567bb1
commit dc123e71ae

View File

@ -30,6 +30,7 @@ tag-sanitize-undefined = .san_u
LDFLAGS-static-yes = -static -pthread
version = $(shell cat .version 2>/dev/null || git describe --tags HEAD 2>/dev/null || echo unknown)
version != cat .version 2>/dev/null || git describe --tags HEAD 2>/dev/null || echo unknown
PREFIX = /usr/local
@ -42,6 +43,7 @@ docdir = $(DESTDIR)$(PREFIX)/share/doc/kak
mandir = $(DESTDIR)$(PREFIX)/share/man/man1
# Both Cygwin and MSYS2 have "_NT" in their uname.
os = $(shell uname | sed 's/.*_NT.*/Windows/')
os != uname | sed 's/.*_NT.*/Windows/'
CPPFLAGS-os-Darwin = -I/opt/local/include
@ -63,6 +65,7 @@ LIBS-os-Windows = -ldbghelp
CXXFLAGS-default = -std=c++2a -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-sign-compare
compiler = $(shell $(CXX) --version | grep -E -o 'clang|g\+\+|c\+\+' | head -1)
compiler != $(CXX) --version | grep -E -o 'clang|g\+\+|c\+\+' | head -1
CXXFLAGS-compiler-clang = -fsized-deallocation
CXXFLAGS-compiler-g++ = -Wno-init-list-lifetime -Wno-stringop-overflow
@ -97,6 +100,7 @@ tag = $(tag-debug-$(debug))$(tag-sanitize-$(sanitize))
.SUFFIXES: $(tag).o .cc
.PHONY: src/kak
sources = $(shell find src -type f -name '*.cc' | sed -e '/\.version\.cc/d')
sources != find src -type f -name '*.cc' | sed -e '/\.version\.cc/d'
objects = $(sources:.cc=$(tag).o)
@ -108,6 +112,7 @@ src/kak: src/kak$(tag)
src/kak$(tag): src/.version.o $(objects)
$(CXX) $(KAK_LDFLAGS) $(KAK_CXXFLAGS) $(KAK_LIBS) $(objects) src/.version.o -o $@
deps = $(shell touch src/.version$(tag).d && find src -type f -name '.*$(tag).d' # Ensure we find one deps for FreeBSD make)
deps != touch src/.version$(tag).d && find src -type f -name '.*$(tag).d' # Ensure we find one deps for FreeBSD make
include $(deps)