Navigation Menu

Skip to content

Commit

Permalink
Feat(build): fix Makefile when building on MacOS
Browse files Browse the repository at this point in the history
macos default `date` command doesn't seem to have the
`--rfc-3339=date` flag. So this switches to a presumably more
universal format string.

also adds the ability to override the default `DST` to `~/$(BIN)`
directories other than ~/.bin, and pulls shared commands into Make variables.
  • Loading branch information
beeceej committed Jun 16, 2020
1 parent a362302 commit 465ba71
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
@@ -1,7 +1,12 @@
DATE := $$(date +%Y-%m-%dT%T%z)
VERSION := $$(git describe --tags)
COMMIT := $$(git rev-list -1 HEAD)
DST ?= ~/.bin/

default:
go build -ldflags "-X main.GitCommit=$$(git rev-list -1 HEAD) -X main.Version=$$(git describe --tags) -X main.Date=$$(date --rfc-3339=date)"
go build -ldflags "-X main.GitCommit=$(COMMIT) -X main.Version=$(VERSION) -X main.Date=$(DATE)"

copy:
go build -ldflags "-X main.GitCommit=$$(git rev-list -1 HEAD) -X main.Version=$$(git describe --tags) -X main.Date=$$(date --rfc-3339=date)" && cp ./terraform-lsp ~/.bin/ && cp ./terraform-lsp ~/
go build -ldflags "-X main.GitCommit=$(COMMIT) -X main.Version=$(VERSION) -X main.Date=$(DATE)" && cp ./terraform-lsp $(DST) && cp ./terraform-lsp ~/

.PHONY: copy

0 comments on commit 465ba71

Please sign in to comment.