diff options
author | Corey Hulen <corey@hulen.com> | 2016-09-21 04:59:11 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-09-21 07:59:11 -0400 |
commit | 1b7e12caa5ecf231c8b56b513e0a502414936746 (patch) | |
tree | b4c26e7f40987c4d4fc0261389a65a54f0e44b03 /Makefile | |
parent | f7297d5a310343dac2bcaa42e70196dbff230ef9 (diff) | |
download | chat-1b7e12caa5ecf231c8b56b513e0a502414936746.tar.gz chat-1b7e12caa5ecf231c8b56b513e0a502414936746.tar.bz2 chat-1b7e12caa5ecf231c8b56b513e0a502414936746.zip |
Fixing make file so you can build linx on mac easily (#4058)
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -42,6 +42,9 @@ GO_LINKER_FLAGS ?= -ldflags \ -X github.com/mattermost/platform/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ -X github.com/mattermost/platform/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)" +# GOOS/GOARCH of the build host, used to determine whether we're cross-compiling or not +BUILDER_GOOS_GOARCH="$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)" + # Output paths DIST_ROOT=dist DIST_PATH=$(DIST_ROOT)/mattermost @@ -310,7 +313,11 @@ endif @# Make osx package @# Copy binary - cp $(GOPATH)/bin/darwin_amd64/platform $(DIST_PATH)/bin +ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64") + cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled +else + cp $(GOPATH)/bin/darwin_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir +endif @# Package tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-osx-amd64.tar.gz mattermost @# Cleanup @@ -318,7 +325,11 @@ endif @# Make windows package @# Copy binary - cp $(GOPATH)/bin/windows_amd64/platform.exe $(DIST_PATH)/bin +ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64") + cp $(GOPATH)/bin/platform.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled +else + cp $(GOPATH)/bin/windows_amd64/platform.exe $(DIST_PATH)/bin # from cross-compiled bin dir +endif @# Package tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-windows-amd64.tar.gz mattermost @# Cleanup @@ -326,10 +337,14 @@ endif @# Make linux package @# Copy binary - cp $(GOPATH)/bin/platform $(DIST_PATH)/bin +ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64") + cp $(GOPATH)/bin/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled +else + cp $(GOPATH)/bin/linux_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir +endif @# Package tar -C dist -czf $(DIST_PATH)-$(BUILD_TYPE_NAME)-linux-amd64.tar.gz mattermost - @# Don't cleanup linux package so dev machines will have an unziped linux package avalilable + @# Don't clean up native package so dev machines will have an unzipped package available @#rm -f $(DIST_PATH)/bin/platform |