open-nomad/GNUmakefile

292 lines
8.2 KiB
Makefile
Raw Normal View History

build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
PROJECT_ROOT := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
THIS_OS := $(shell uname)
GIT_COMMIT := $(shell git rev-parse HEAD)
GIT_DIRTY := $(if $(shell git status --porcelain),+CHANGES)
GO_LDFLAGS := "-X main.GitCommit=$(GIT_COMMIT)$(GIT_DIRTY)"
GO_TAGS =
default: help
ifeq (,$(findstring $(THIS_OS),Darwin Linux FreeBSD))
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
$(error Building Nomad is currently only supported on Darwin and Linux.)
endif
# On Linux we build for Linux, Windows, and potentially Linux+LXC
ifeq (Linux,$(THIS_OS))
2017-08-22 00:09:17 +00:00
# Detect if we have LXC on the path
ifeq (0,$(shell pkg-config --exists lxc; echo $$?))
HAS_LXC="true"
endif
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
ALL_TARGETS += linux_386 \
linux_amd64 \
linux_arm \
linux_arm64 \
windows_386 \
windows_amd64
2017-10-19 22:53:19 +00:00
ifeq ("true",$(HAS_LXC))
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
ALL_TARGETS += linux_amd64-lxc
endif
endif
# On MacOS, we only build for MacOS
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
ifeq (Darwin,$(THIS_OS))
ALL_TARGETS += darwin_amd64
endif
# On FreeBSD, we only build for FreeBSD
ifeq (FreeBSD,$(THIS_OS))
ALL_TARGETS += freebsd_amd64
endif
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
pkg/darwin_amd64/nomad: $(SOURCE_FILES) ## Build Nomad for darwin/amd64
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@"
pkg/freebsd_amd64/nomad: $(SOURCE_FILES) ## Build Nomad for freebsd/amd64
@echo "==> Building $@..."
@CGO_ENABLED=1 GOOS=freebsd GOARCH=amd64 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@"
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
pkg/linux_386/nomad: $(SOURCE_FILES) ## Build Nomad for linux/386
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=linux GOARCH=386 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@"
pkg/linux_amd64/nomad: $(SOURCE_FILES) ## Build Nomad for linux/amd64
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@"
pkg/linux_arm/nomad: $(SOURCE_FILES) ## Build Nomad for linux/arm
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=linux GOARCH=arm CC=arm-linux-gnueabihf-gcc-5 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@"
pkg/linux_arm64/nomad: $(SOURCE_FILES) ## Build Nomad for linux/arm64
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc-5 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@"
# If CGO support for Windows is ever required, set the following variables
# in the environment for `go build` for both the windows/amd64 and the
# windows/386 targets:
# CC=i686-w64-mingw32-gcc
# CXX=i686-w64-mingw32-g++
pkg/windows_386/nomad: $(SOURCE_FILES) ## Build Nomad for windows/386
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=windows GOARCH=386 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@.exe"
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
pkg/windows_amd64/nomad: $(SOURCE_FILES) ## Build Nomad for windows/amd64
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
2017-09-06 00:23:21 +00:00
@CGO_ENABLED=1 GOOS=windows GOARCH=amd64 \
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS)" \
-o "$@.exe"
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
pkg/linux_amd64-lxc/nomad: $(SOURCE_FILES) ## Build Nomad+LXC for linux/amd64
2017-09-19 14:47:10 +00:00
@echo "==> Building $@ with tags $(GO_TAGS)..."
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS) lxc" \
-o "$@"
# Define package targets for each of the build targets we actually have on this system
define makePackageTarget
pkg/$(1).zip: pkg/$(1)/nomad
@echo "==> Packaging for $(1)..."
2017-08-29 05:29:49 +00:00
@zip -j pkg/$(1).zip pkg/$(1)/*
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
endef
# Reify the package targets
$(foreach t,$(ALL_TARGETS),$(eval $(call makePackageTarget,$(t))))
# Only for Travis CI compliance
.PHONY: bootstrap
bootstrap: deps
.PHONY: deps
deps: ## Install build and development dependencies
@echo "==> Updating build dependencies..."
go get -u github.com/alecthomas/gometalinter
gometalinter --install
go get -u github.com/kardianos/govendor
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/axw/gocov/gocov
go get -u gopkg.in/matm/v1/gocov-html
go get -u github.com/ugorji/go/codec/codecgen
2017-09-19 14:47:10 +00:00
go get -u github.com/jteeuwen/go-bindata/...
go get -u github.com/elazarl/go-bindata-assetfs/...
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
go get -u github.com/hashicorp/vault
go get -u github.com/a8m/tree/cmd/tree
.PHONY: check
check: ## Lint the source code
@echo "==> Linting source code..."
@gometalinter \
--deadline 10m \
--vendor \
2017-09-26 22:26:33 +00:00
--exclude='.*\.generated\.go' \
--exclude='.*bindata_assetfs\.go' \
2017-09-19 16:49:34 +00:00
--skip="ui/" \
2017-09-26 22:26:33 +00:00
--sort="path" \
--aggregate \
--enable-gc \
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
--disable-all \
2017-09-26 22:26:33 +00:00
--enable goimports \
--enable misspell \
--enable vet \
--enable deadcode \
--enable varcheck \
--enable ineffassign \
--enable structcheck \
--enable unconvert \
--enable gas \
--enable gofmt \
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
./...
2017-09-27 18:14:37 +00:00
@echo "==> Spell checking website..."
@misspell -error -source=text website/source/
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
.PHONY: checkscripts
checkscripts: ## Lint shell scripts
@echo "==> Linting scripts..."
@shellcheck ./scripts/*
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
generate: LOCAL_PACKAGES = $(shell go list ./... | grep -v '/vendor/')
2017-08-21 22:18:24 +00:00
generate: ## Update generated code
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@go generate $(LOCAL_PACKAGES)
.PHONY: dev
dev: GOOS=$(shell go env GOOS)
dev: GOARCH=$(shell go env GOARCH)
dev: GOPATH=$(shell go env GOPATH)
dev: DEV_TARGET=pkg/$(GOOS)_$(GOARCH)$(if $(HAS_LXC),-lxc)/nomad
dev: ## Build for the current development platform
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@echo "==> Removing old development build..."
@rm -f $(PROJECT_ROOT)/$(DEV_TARGET)
@rm -f $(PROJECT_ROOT)/bin/nomad
@rm -f $(GOPATH)/bin/nomad
@$(MAKE) --no-print-directory \
$(DEV_TARGET) \
2017-09-19 14:47:10 +00:00
GO_TAGS="nomad_test $(NOMAD_UI_TAG)"
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@mkdir -p $(PROJECT_ROOT)/bin
@mkdir -p $(GOPATH)/bin
@cp $(PROJECT_ROOT)/$(DEV_TARGET) $(PROJECT_ROOT)/bin/
@cp $(PROJECT_ROOT)/$(DEV_TARGET) $(GOPATH)/bin
.PHONY: release
2017-09-19 14:47:10 +00:00
release: GO_TAGS="ui"
release: clean ember-dist static-assets check $(foreach t,$(ALL_TARGETS),pkg/$(t).zip) ## Build all release packages which can be built on this platform.
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@echo "==> Results:"
@tree --dirsfirst $(PROJECT_ROOT)/pkg
.PHONY: test
2017-09-19 14:47:10 +00:00
test: ## Run the Nomad test suite and/or the Nomad UI test suite
@if [ ! $(SKIP_NOMAD_TESTS) ]; then \
make test-nomad; \
fi
@if [ $(RUN_UI_TESTS) ]; then \
make test-ui; \
fi
.PHONY: test-nomad
test-nomad: ## Run Nomad test suites
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
@echo "==> Running Nomad test suites:"
@NOMAD_TEST_RKT=1 \
go test \
-cover \
-timeout=900s \
-tags="nomad_test $(if $(HAS_LXC),lxc)" \
2017-10-23 23:51:40 +00:00
./...
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
.PHONY: clean
clean: GOPATH=$(shell go env GOPATH)
clean: ## Remove build artifacts
@echo "==> Cleaning build artifacts..."
@rm -rf "$(PROJECT_ROOT)/bin/"
@rm -rf "$(PROJECT_ROOT)/pkg/"
@rm -f "$(GOPATH)/bin/nomad"
.PHONY: travis
travis: ## Run Nomad test suites with output to prevent timeouts under Travis CI
@sh -C "$(PROJECT_ROOT)/scripts/travis.sh"
.PHONY: testcluster
testcluster: ## Bring up a Linux test cluster using Vagrant. Set PROVIDER if necessary.
vagrant up nomad-server01 \
nomad-server02 \
nomad-server03 \
nomad-client01 \
nomad-client02 \
nomad-client03 \
$(if $(PROVIDER),--provider $(PROVIDER))
2017-09-19 14:47:10 +00:00
.PHONY: static-assets
static-assets: ## Compile the static routes to serve alongside the API
@echo "--> Generating static assets"
@go-bindata-assetfs -pkg agent -prefix ui -modtime 1480000000 -tags ui ./ui/dist/...
@mv bindata_assetfs.go command/agent
.PHONY: test-ui
test-ui: ## Run Noma UI test suite
@echo "--> Installing JavaScript assets"
@cd ui && yarn install
@cd ui && npm install phantomjs-prebuilt
@echo "--> Running ember tests"
@cd ui && phantomjs --version
@cd ui && npm test
.PHONY: ember-dist
ember-dist: ## Build the static UI assets from source
@echo "--> Installing JavaScript assets"
@cd ui && yarn install
@cd ui && npm rebuild node-sass
@echo "--> Building Ember application"
@cd ui && npm run build
.PHONY: dev-ui
dev-ui: ember-dist static-assets
@$(MAKE) NOMAD_UI_TAG="ui" dev ## Build a dev binary with the UI baked in
build: Replace shell scripts with GNUmakefile This commit replaces the shell script-driven build process for Nomad with one based around GNU Make (note we _do_ use GNU-specific constructs), requiring no additional scripts for common cases of development. The following targets are implemented: Per-OS/arch combinations: Binaries (Host - Mac OS X): pkg/darwin_amd64/nomad Binaries (Host - Linux): pkg/linux_386/nomad pkg/linux_amd64/nomad pkg/linux_amd64-lxc/nomad pkg/linux_arm/nomad pkg/linux_arm64/nomad pkg/windows_386/nomad pkg/windows_amd64/nomad Packages (Host - Mac OS X): pkg/darwin_amd64.zip Packages (Host - Linux): pkg/linux_386.zip pkg/linux_amd64.zip pkg/linux_amd64-lxc.zip pkg/linux_arm.zip pkg/linux_arm64.zip pkg/windows_386.zip pkg/windows_amd64.zip Phony targets: dev - Builds for the current host GOOS/GOARCH (unless overriden in the environment) release - Builds all appropriate release packages for the current host GOOS/GOARCH (i.e. Windows and Linux packages on a Linux host, Darwin packages on an OSX host) generate - Generate code for the current host architecture using `go generate`. test - Runs the Nomad test suite clean - Removes build artifacts travis - Runs `make test` with the wrapper script to prevent Travis CI from timing out. help - Displays usage information about commonly used targets. Note that there are some semantic differences from the previous version. 1. `generate` is no longer a dependency of `dev` builds. This is because it causes a rebuild every time, even when no code has changed, since `go generate` does not appear to leave file timestamps alone. Regardless, it is insufficient to generate on one host OS - it needs to be run on each target to ensure everything is generated correctly. 2. `gofmt` is no longer checked. This should be enabled as a linter once the `gofmt -s` refactoring will pass on the whole code base, in order to avoid special cased checks versus using go-metalinter. Example Usages: Make a development build for the current GOOS/GOARCH: make dev Make release build packages appropriate for the host OS: make release Update generated code for the host OS: make generate Run linting checks: make check Build a specific alternative GOOS/GOARCH/tags combination: make pkg/linux_amd64-pkg/nomad make pkg/linux_amd64-pkg.zip
2017-08-18 05:29:26 +00:00
HELP_FORMAT=" \033[36m%-25s\033[0m %s\n"
.PHONY: help
help: ## Display this usage information
@echo "Valid targets:"
@grep -E '^[^ ]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ":.*?## "}; \
{printf $(HELP_FORMAT), $$1, $$2}'
@echo "\nThis host will build the following targets if 'make release' is invoked:"
@echo $(ALL_TARGETS) | sed 's/^/ /'