An error occurred while loading the file. Please try again.
  • James Nugent's avatar
    build: Replace shell scripts with GNUmakefile · dcdc91fb
    James Nugent authored
    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
    dcdc91fb