Skip to content

Commit bde59d5

Browse files
Error handling
w/todo re: oneshell (vs. new subshell per target)
1 parent 5e51c46 commit bde59d5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DEFAULT_GOAL := help
2+
# TODO: test oneshell target (https://www.gnu.org/software/make/manual/html_node/One-Shell.html)
23
.ONESHELL:
34
export SHELL := $(shell which sh)
45
# .SHELLFLAGS := -eu -o pipefail -c
@@ -27,6 +28,14 @@ ifeq ($(shell command -v pip >/dev/null 2>&1; echo $$?), 0)
2728
export PIP := $(shell which pip3)
2829
endif
2930

31+
ifeq ($(shell command -v ansible >/dev/null 2>&1; echo $$?), 0)
32+
export ANSIBLE := $(shell which ansible)
33+
endif
34+
35+
ifeq ($(shell command -v ansible-lint >/dev/null 2>&1; echo $$?), 0)
36+
export ANSIBLE_LINT := $(shell which ansible-lint)
37+
endif
38+
3039
ifneq (,$(wildcard /etc/os-release))
3140
include /etc/os-release
3241
endif
@@ -107,7 +116,7 @@ pip: python ## install pip
107116

108117
ansible: pip ## install ansible
109118
@echo "Installing Ansible..."
110-
if [ "${UNAME}" == "Darwin" ]; then \
119+
if [ "${UNAME}" == "Darwin" ] && [ -z "${ANSIBLE}" ] || [ -z "${ANSIBLE_LINT}" ]; then \
111120
brew install ansible ansible-lint; \
112121
else \
113122
python3 -m pip install ansible ansible-lint; \

0 commit comments

Comments
 (0)