-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
49 lines (43 loc) · 1.55 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
default: build
# -timeout timeout in seconds
# -v verbose output
test:
@ echo "+ $@"
@ go test -timeout=5s -v
# `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 it’s 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.
#
# `-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/[name-of-app]`
# Placement of the binary
#
# `./cmd/[name-of-app]`
# Location of the cmd package
build:
@ echo "+ $@"
@ CGO_ENABLED=0 go build -a -installsuffix cgo -o ./bin/resume ./cmd/resume
build-linux:
@ echo "+ $@"
@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o ./bin/resume-linux-amd64 ./cmd/resume
build-darwin:
@ echo "+ $@"
@ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -installsuffix cgo -o ./bin/resume-darwin-amd64 ./cmd/resume
build-windows:
@ echo "+ $@"
@ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -installsuffix cgo -o ./bin/resume-windows-amd64 ./cmd/resume
.PHONY: default test build build-linux build-darwin build-windows