setup.mk 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Ensure that go is installed. Note that this is independent of whether or not a server is being
  2. # built, since the build script itself uses go.
  3. ifeq ($(GO),)
  4. $(error "go is not available: see https://golang.org/doc/install")
  5. endif
  6. # Ensure that the build tools are compiled. Go's caching makes this quick.
  7. $(shell cd build/manifest && $(GO) build -o ../bin/manifest)
  8. # Ensure that the deployment tools are compiled. Go's caching makes this quick.
  9. $(shell cd build/pluginctl && $(GO) build -o ../bin/pluginctl)
  10. # Extract the plugin id from the manifest.
  11. PLUGIN_ID ?= $(shell build/bin/manifest id)
  12. ifeq ($(PLUGIN_ID),)
  13. $(error "Cannot parse id from $(MANIFEST_FILE)")
  14. endif
  15. # Extract the plugin version from the manifest.
  16. PLUGIN_VERSION ?= $(shell build/bin/manifest version)
  17. ifeq ($(PLUGIN_VERSION),)
  18. $(error "Cannot parse version from $(MANIFEST_FILE)")
  19. endif
  20. # Determine if a server is defined in the manifest.
  21. HAS_SERVER ?= $(shell build/bin/manifest has_server)
  22. # Determine if a webapp is defined in the manifest.
  23. HAS_WEBAPP ?= $(shell build/bin/manifest has_webapp)
  24. # Determine if a /public folder is in use
  25. HAS_PUBLIC ?= $(wildcard public/.)
  26. # Determine if the mattermost-utilities repo is present
  27. HAS_MM_UTILITIES ?= $(wildcard $(MM_UTILITIES_DIR)/.)
  28. # Store the current path for later use
  29. PWD ?= $(shell pwd)
  30. # Ensure that npm (and thus node) is installed.
  31. ifneq ($(HAS_WEBAPP),)
  32. ifeq ($(NPM),)
  33. $(error "npm is not available: see https://www.npmjs.com/get-npm")
  34. endif
  35. endif