Skip to content

Commit 01c50fb

Browse files
authored
Merge pull request #2285 from ucb-bar/mac_bash
Find a modern bash on MacOS
2 parents d519070 + 2df0872 commit 01c50fb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
SHELL=/bin/bash
21
SED ?= sed
32

43
# Note: Individual rules that use RISCV or external tools perform local checks to avoid
54
# blocking unrelated targets. Use $(require_riscv) and $(call require_cmd,<tool>) inside recipes.
65

6+
77
define require_riscv
88
@if [ -z "$(RISCV)" ]; then \
99
echo "RISCV is unset. Source env.sh (which activates the default conda env) before building sims." 1>&2; \

variables.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Ensure GNU Make uses a modern bash for recipes
2+
# - Set early (before other includes) so old make versions honor it.
3+
# - Prefer Homebrew or /usr/local bash, else fall back to /bin/bash.
4+
SHELL := $(shell \
5+
if [ -x /opt/homebrew/bin/bash ]; then printf /opt/homebrew/bin/bash; \
6+
elif [ -x /usr/local/bin/bash ]; then printf /usr/local/bin/bash; \
7+
elif command -v bash >/dev/null 2>&1; then command -v bash; \
8+
else printf /bin/bash; fi)
9+
110
#########################################################################################
211
# makefile variables shared across multiple makefiles
312
# - to use the help text, your Makefile should have a 'help' target that just

0 commit comments

Comments
 (0)