erroneousboat-slack-term/Makefile

74 lines
1.9 KiB
Makefile
Raw Permalink Normal View History

2016-09-11 17:55:19 +02:00
default: test
# -timeout timout in seconds
# -v verbose output
test:
2018-07-21 13:16:41 +02:00
@ echo "+ $@"
2016-10-09 18:37:00 +02:00
@ go test -timeout=5s -v
2016-09-11 17:55:19 +02:00
2018-07-21 13:16:41 +02:00
dev: build
@ ./bin/slack-term -debug
2016-09-11 17:55:19 +02:00
# `CGO_ENABLED=0`
# Because of dynamically linked libraries, this will statically compile the
# app with all libraries built in. You won't be able to cross-compile if CGO
# is enabled. This is because Go binary is looking for libraries on the
# operating system its running in. We compiled our app, but it still is
# dynamically linked to the libraries it needs to run
# (i.e., all the C libraries it binds to). When using a minimal docker image
# the operating system doesn't have these libraries.
#
# `GOOS=linux`
# We're setting the OS to linux (in case someone builds the binary on Mac or
# Windows)
#
# `-mod=vendor`
# This ensures that the build process will use the modules in the vendor
# folder.
#
2016-09-11 17:55:19 +02:00
# `-a`
# Force rebuilding of package, all import will be rebuilt with cgo disabled,
# which means all the imports will be rebuilt with cgo disabled.
#
# `-installsuffix cgo`
# A suffix to use in the name of the package installation directory
#
# `-o`
# Output
#
# `./bin/slack-term`
# Placement of the binary
#
2016-10-19 09:08:31 +02:00
# `.`
2016-09-11 17:55:19 +02:00
# Location of the source files
build:
2016-10-09 18:37:00 +02:00
@ echo "+ $@"
@ CGO_ENABLED=0 go build -mod=vendor -a -installsuffix cgo -o ./bin/slack-term .
2016-09-11 17:55:19 +02:00
2016-10-02 16:07:35 +02:00
# Cross-compile
# http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5
build-linux:
2016-10-09 18:37:00 +02:00
@ echo "+ $@"
@ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=vendor -a -installsuffix cgo -o ./bin/slack-term-linux-amd64 .
2016-10-02 16:07:35 +02:00
build-mac:
2016-10-09 18:37:00 +02:00
@ echo "+ $@"
@ GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -mod=vendor -a -installsuffix cgo -o ./bin/slack-term-darwin-amd64 .
2016-10-02 16:07:35 +02:00
2016-09-11 17:55:19 +02:00
run: build
2016-10-09 18:37:00 +02:00
@ echo "+ $@"
@ ./bin/slack-term
install:
2016-10-09 18:37:00 +02:00
@ echo "+ $@"
2016-10-19 09:08:31 +02:00
@ go install .
2016-09-11 17:55:19 +02:00
2019-09-28 13:10:48 +02:00
modules:
@ echo "+ $@"
@ go mod tidy
@ go mod vendor
build-all: build build-linux build-mac
2016-10-09 18:37:00 +02:00
.PHONY: default test build build-linux build-mac run install