-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
73 lines (57 loc) · 2.47 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
include lib/make/*/Makefile
.PHONY: clencli/test
clencli/test: clencli/build go/test
.PHONY: clencli/build
clencli/build: clencli/clean go/mod/tidy go/version go/fmt go/generate go/install clencli/update-readme ## Builds the app
.PHONY: clencli/install
clencli/install: go/get go/fmt go/generate go/install ## Builds the app and install all dependencies
.PHONY: clencli/run
clencli/run: go/fmt ## Run a command
ifdef command
make go/run command='$(command)'
else
make go/run
endif
.PHONY: clencli/compile
clencli/compile: ## Compile to multiple architectures
@mkdir -p dist
@echo "Compiling for every OS and Platform"
GOOS=darwin GOARCH=amd64 go build -o dist/clencli-darwin-amd64 main.go
GOOS=solaris GOARCH=amd64 go build -o dist/clencli-solaris-amd64 main.go
GOOS=freebsd GOARCH=386 go build -o dist/clencli-freebsd-386 main.go
GOOS=freebsd GOARCH=amd64 go build -o dist/clencli-freebsd-amd64 main.go
GOOS=freebsd GOARCH=arm go build -o dist/clencli-freebsd-arm main.go
GOOS=openbsd GOARCH=386 go build -o dist/clencli-openbsd-386 main.go
GOOS=openbsd GOARCH=amd64 go build -o dist/clencli-openbsd-amd64 main.go
GOOS=openbsd GOARCH=arm go build -o dist/clencli-openbsd-arm main.go
GOOS=linux GOARCH=386 go build -o dist/clencli-linux-386 main.go
GOOS=linux GOARCH=amd64 go build -o dist/clencli-linux-amd64 main.go
GOOS=linux GOARCH=arm go build -o dist/clencli-linux-arm main.go
GOOS=windows GOARCH=386 go build -o dist/clencli-windows-386.exe main.go
GOOS=windows GOARCH=amd64 go build -o dist/clencli-windows-amd64.exe main.go
.PHONY: clencli/clean
clencli/clean: ## Removes unnecessary files and directories
rm -rf downloads/
rm -rf generated-*/
rm -rf dist/
rm -rf build/
rm -f box/blob.go
#rm -f $$GOPATH/bin/clencli
.PHONY: clencli/update-readme
clencli/update-readme: ## Renders template readme.tmpl with additional documents
@echo "Updating README.tmpl to the latest version"
@cp box/resources/init/clencli/readme.tmpl clencli/readme.tmpl
@echo "Generate COMMANDS.md"
@echo "## Commands" > COMMANDS.md
@echo '```' >> COMMANDS.md
@clencli --help >> COMMANDS.md
@echo '```' >> COMMANDS.md
@echo "COMMANDS.md generated successfully"
@clencli render template --name readme
# .PHONY: clencli/test
# clencli/test: go/test
.DEFAULT_GOAL := help
.PHONY: help
help: ## This HELP message
@fgrep -h ": ##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'