From a67173f4b37e0388603572686732929bba85f919 Mon Sep 17 00:00:00 2001 From: Alex Sergeyev Date: Sun, 27 Jan 2019 22:50:35 -0500 Subject: [PATCH] Change root makefile (really does not update anything) --- .gitignore | 1 - Makefile | 44 ++++++++++++++------------------------------ 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index a2296fb8..365cc915 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ websocketd *.swo go go-v* -go-workspace diff --git a/Makefile b/Makefile index c7c87da0..b720d61d 100644 --- a/Makefile +++ b/Makefile @@ -10,49 +10,33 @@ # To manually invoke the locally installed Go, use ./go # Go installation config. -#GO_VERSION=1.2.1.linux-amd64 -GO_VER=1.4 +GO_VER=1.11.5 SYSTEM_NAME:=$(shell uname -s | tr '[:upper:]' '[:lower:]') SYSTEM_ARCH:=$(shell uname -m) GO_ARCH:=$(if $(filter x86_64, $(SYSTEM_ARCH)),amd64,386) -GO_VERSION:=$(GO_VER).$(SYSTEM_NAME)-$(GO_ARCH)$(if $(filter darwin,$(SYSTEM_NAME)),-osx10.8) -GO_DOWNLOAD_URL=http://golang.org/dl/go$(GO_VERSION).tar.gz +GO_VERSION:=$(GO_VER).$(SYSTEM_NAME)-$(GO_ARCH) +GO_DOWNLOAD_URL:=http://golang.org/dl/go$(GO_VERSION).tar.gz +GO_WORKDIR:=go-v$(GO_VERSION) # Build websocketd binary -websocketd: go $(wildcard *.go) $(wildcard libwebsocketd/*.go) go-workspace/src/github.com/joewalnes/websocketd - ./go get ./go-workspace/src/github.com/joewalnes/websocketd - ./go fmt github.com/joewalnes/websocketd/libwebsocketd github.com/joewalnes/websocketd - ./go build - -# Create local go workspace and symlink websocketd into the right location. -go-workspace/src/github.com/joewalnes/websocketd: - mkdir -p go-workspace/src/github.com/joewalnes - ln -s ../../../../ go-workspace/src/github.com/joewalnes/websocketd - -# Setup ./go wrapper to use local GOPATH/GOROOT. -# Need to set PATH for gofmt. -go: go-v$(GO_VERSION)/.done - @echo '#!/bin/sh' > $@ - @echo export PATH=$(abspath go-v$(GO_VERSION)/bin):$(PATH) >> $@ - @echo mkdir -p $(abspath go-workspace) >> $@ - @echo GOPATH=$(abspath go-workspace) GOROOT=$(abspath go-v$(GO_VERSION)) $(abspath go-v$(GO_VERSION)/bin/go) \$$@ >> $@ - chmod +x $@ - @echo 'Created ./$@ wrapper' +websocketd: $(GO_WORKDIR)/bin/go $(wildcard *.go) $(wildcard libwebsocketd/*.go) + $(GO_WORKDIR)/bin/go build # Download and unpack Go distribution. -go-v$(GO_VERSION)/.done: - mkdir -p $(dir $@) +$(GO_WORKDIR)/bin/go: + mkdir -p $(GO_WORKDIR) rm -f $@ - @echo Downloading and unpacking Go $(GO_VERSION) to $(dir $@) - wget -q -O - $(GO_DOWNLOAD_URL) | tar xzf - --strip-components=1 -C $(dir $@) - touch $@ + @echo Downloading and unpacking Go $(GO_VERSION) to $(GO_WORKDIR) + wget -q -O - $(GO_DOWNLOAD_URL) | tar xzf - --strip-components=1 -C $(GO_WORKDIR) # Clean up binary clean: - rm -rf websocketd go-workspace + rm -rf websocketd + .PHONY: clean # Also clean up downloaded Go clobber: clean - rm -rf go $(wildcard go-v*) + rm -rf $(wildcard go-v*) + .PHONY: clobber