-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (33 loc) · 811 Bytes
/
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
# Makefile for aws-lambda-tool
NAME=lambdatool
VERSION=$$(git describe --tags --always)
LDFLAGS=-ldflags "-X main.version=${VERSION}"
all: tools build
tools:
go get -u -v "github.com/mitchellh/gox"
build:
@mkdir -p bin/
go get -t ./...
go test -v ./...
go build ${LDFLAGS} -o bin/${NAME} cmd/lambdadeploy/main.go
xbuild: clean
@mkdir -p build
gox \
-os="linux" \
-os="windows" \
-os="darwin" \
-arch="amd64" \
${LDFLAGS} \
-output="build/{{.Dir}}_$(VERSION)_{{.OS}}_{{.Arch}}/$(NAME)" \
./...
package: xbuild
$(eval FILES := $(shell ls build))
@mkdir -p build/tgz
for f in $(FILES); do \
(cd $(shell pwd)/build && tar -zcvf tgz/$$f.tar.gz $$f); \
echo $$f; \
done
clean:
@rm -rf bin/ && rm -rf build/
ci: tools package
.PHONY: all tools build xbuild package clean ci