Skip to content

Commit

Permalink
Makefile: Mirror bash by using ${…} & $(…) for all variables & co…
Browse files Browse the repository at this point in the history
…mmand substitutions, respectively.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
  • Loading branch information
rgoldberg committed Nov 15, 2024
1 parent 1d1335a commit 9f9923e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ SWIFT_VERSION = 5.7.1
# run swift build and see where the output executable is created

# OS specific differences
UNAME = ${shell uname}
ARCH = ${shell uname -m}

ifeq ($(UNAME), Darwin)
PLATFORM = $(ARCH)-apple-macosx
ifeq ($(shell uname), Darwin)
PLATFORM = $(shell uname -m)-apple-macosx
EXECUTABLE_DIRECTORY = ./.build/${PLATFORM}/debug
endif

Expand All @@ -39,7 +36,7 @@ help: ## (default) Displays this message
@echo "mas Makefile"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z0-9_-]*:.*?##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?##"}; {printf $(MAKEFILE_FMT), $$1, $$2}'
@grep -E '^[a-zA-Z0-9_-]*:.*?##' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?##"}; {printf ${MAKEFILE_FMT}, $$1, $$2}'
: # Hacky way to display a newline ##

################################################################################
Expand All @@ -56,8 +53,8 @@ version: ## Prints versions of tools used by this Makefile.

.PHONY: init
init: ## Installs tools.
- swiftenv install $(SWIFT_VERSION)
swiftenv local $(SWIFT_VERSION)
- swiftenv install ${SWIFT_VERSION}
swiftenv local ${SWIFT_VERSION}

################################################################################
#
Expand Down Expand Up @@ -100,7 +97,7 @@ test: build ## Runs tests.
# make run ARGS="asdf"
.PHONY: run
run: build
${EXECUTABLE_DIRECTORY}/${CMD_NAME} $(ARGS)
${EXECUTABLE_DIRECTORY}/${CMD_NAME} ${ARGS}

.PHONY: update-headers
update-headers: ## Updates private macOS headers.
Expand Down Expand Up @@ -138,7 +135,7 @@ build-universal: ## Builds a "fat" universal binary.

.PHONY: install
install: build ## Installs the binary.
script/install $(PREFIX)
script/install ${PREFIX}

.PHONY: install-universal
install-universal: build-universal ## Installs a universal binary.
Expand Down

0 comments on commit 9f9923e

Please sign in to comment.