Skip to content

Commit

Permalink
makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
notnoop committed Dec 14, 2023
1 parent daa7cce commit 3cfce81
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
rockset-mongo
dump
state.json
bin/
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BINARY=rockset-mongo
VERSION=0.0.1
BUILD=`git rev-parse HEAD`
PLATFORMS=darwin linux windows
ARCHITECTURES=amd64 arm64

# Setup linker flags option for build that interoperate with variable names in src code
LDFLAGS=-ldflags "-X main.VersionStr=${VERSION} -X main.GitCommit=${BUILD}"

default: build

all: clean build_all

build:
go build ${LDFLAGS} -o ${BINARY}

build_all:
mkdir -p bin
$(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES), $(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build $(LDFLAGS) -o bin/$(BINARY)-$(GOOS)-$(GOARCH)-$(VERSION) .)))

clean:
go clean
rm -rf bin

.PHONY: check clean install build_all all

0 comments on commit 3cfce81

Please sign in to comment.