github.com/awslabs/clencli@v0.0.0-20210514234156-7ecf17182a20/Makefile (about)

     1  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
     2  
     3  include lib/make/*/Makefile
     4  
     5  .PHONY: clencli/test
     6  clencli/test: clencli/build go/test
     7  
     8  .PHONY: clencli/build
     9  clencli/build: clencli/clean go/mod/tidy go/version go/fmt go/generate go/install clencli/update-readme ## Builds the app
    10  
    11  .PHONY: clencli/install
    12  clencli/install: go/get go/fmt go/generate go/install ## Builds the app and install all dependencies
    13  
    14  .PHONY: clencli/run
    15  clencli/run: go/fmt ## Run a command
    16  ifdef command
    17  	make go/run command='$(command)'
    18  else
    19  	make go/run
    20  endif
    21  
    22  .PHONY: clencli/compile
    23  clencli/compile: ## Compile to multiple architectures
    24  	@mkdir -p dist
    25  	@echo "Compiling for every OS and Platform"
    26  	GOOS=darwin GOARCH=amd64 go build -o dist/clencli-darwin-amd64 main.go
    27  	GOOS=solaris GOARCH=amd64 go build -o dist/clencli-solaris-amd64 main.go
    28  
    29  	GOOS=freebsd GOARCH=386 go build -o dist/clencli-freebsd-386 main.go
    30  	GOOS=freebsd GOARCH=amd64 go build -o dist/clencli-freebsd-amd64 main.go
    31  	GOOS=freebsd GOARCH=arm go build -o dist/clencli-freebsd-arm main.go
    32  
    33  	GOOS=openbsd GOARCH=386 go build -o dist/clencli-openbsd-386 main.go
    34  	GOOS=openbsd GOARCH=amd64 go build -o dist/clencli-openbsd-amd64 main.go
    35  	GOOS=openbsd GOARCH=arm go build -o dist/clencli-openbsd-arm main.go
    36  
    37  	GOOS=linux GOARCH=386 go build -o dist/clencli-linux-386 main.go
    38  	GOOS=linux GOARCH=amd64 go build -o dist/clencli-linux-amd64 main.go
    39  	GOOS=linux GOARCH=arm go build -o dist/clencli-linux-arm main.go
    40  
    41  	GOOS=windows GOARCH=386 go build -o dist/clencli-windows-386.exe main.go
    42  	GOOS=windows GOARCH=amd64 go build -o dist/clencli-windows-amd64.exe main.go
    43  
    44  .PHONY: clencli/clean
    45  clencli/clean: ## Removes unnecessary files and directories
    46  	rm -rf downloads/
    47  	rm -rf generated-*/
    48  	rm -rf dist/
    49  	rm -rf build/
    50  	rm -f box/blob.go
    51  
    52  #rm -f $$GOPATH/bin/clencli
    53  
    54  .PHONY: clencli/update-readme
    55  clencli/update-readme: ## Renders template readme.tmpl with additional documents
    56  	@echo "Updating README.tmpl to the latest version"
    57  	@cp box/resources/init/clencli/readme.tmpl clencli/readme.tmpl
    58  	@echo "Generate COMMANDS.md"
    59  	@echo "## Commands" > COMMANDS.md
    60  	@echo '```' >> COMMANDS.md
    61  	@clencli --help >> COMMANDS.md
    62  	@echo '```' >> COMMANDS.md
    63  	@echo "COMMANDS.md generated successfully"
    64  	@clencli render template --name readme
    65  
    66  # .PHONY: clencli/test
    67  # clencli/test: go/test
    68  
    69  .DEFAULT_GOAL := help
    70  
    71  .PHONY: help
    72  help: ## This HELP message
    73  	@fgrep -h ": ##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'