This repository has been archived on 2024-11-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mattermost-plugin-attachmen.../build/setup.mk
Jesse Hallam 2de3471aa2
more Makefile improvements
* warn upfront if go/dep/npm not available
* try to find dep in $GOPATH/bin if not installed globally
* only override variables if not externally defined, allowing manual override from command line
* split up Makefile into a buid/setup.mk for simplicity

I didn't actually find anything that made this Makefile not-linux
specific -- tested on Debian with the standard make installed.
2018-07-31 16:15:55 -04:00

42 lines
1.3 KiB
Makefile

# Ensure that go is installed. Note that this is independent of whether or not a server is being
# built, since the build script itself uses go.
ifeq ($(GO),)
$(error "go is not available: see https://golang.org/doc/install")
endif
# Ensure that the build tools are compiled. Go's caching makes this quick.
$(shell cd build/manifest && $(GO) build -o ../bin/manifest)
# Extract the plugin id from the manifest.
PLUGIN_ID ?= $(shell build/bin/manifest plugin_id)
ifeq ($(PLUGIN_ID),)
$(error "Cannot parse id from $(MANIFEST_FILE)")
endif
# Determine if a server is defined in the manifest.
HAS_SERVER ?= $(shell build/bin/manifest has_server)
# Determine if a webapp is defined in the manifest.
HAS_WEBAPP ?= $(shell build/bin/manifest has_webapp)
# Try looking for dep in $(GOPATH) in case $(GOPATH)/bin isn't in $(PATH).
GOPATH ?= $(shell $(GO) env GOPATH)
ifeq ($(DEP),)
ifneq ($(wildcard $(GOPATH)/bin/dep),)
DEP = $(GOPATH)/bin/dep
endif
endif
# Ensure that dep is installed.
ifneq ($(HAS_SERVER),)
ifeq ($(DEP),)
$(error "dep is not available: see https://golang.github.io/dep/docs/installation.html")
endif
endif
# Ensure that npm (and thus node) is installed.
ifneq ($(HAS_WEBAPP),)
ifeq ($(NPM),)
$(error "npm is not available: see https://www.npmjs.com/get-npm")
endif
endif