Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
feature: add 'help' target to Makefile and make it the default
Browse files Browse the repository at this point in the history
Signed-off-by: SataQiu <[email protected]>
  • Loading branch information
SataQiu committed Sep 23, 2019
1 parent a37632b commit 4fc4fea
Showing 1 changed file with 34 additions and 29 deletions.
63 changes: 34 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

.DEFAULT_GOAL:=help

# You can assign 1 to USE_DOCKER so that you can build components of Dragonfly
# with docker.
USE_DOCKER?=0 # Default: build components in the local environment.
Expand All @@ -25,127 +27,130 @@ export GO111MODULE=on
# Default: use GOPROXY to speed up downloading go mod dependency.
export GOPROXY=https://goproxy.io

clean:
help: ## Display this help information
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m make %-22s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

clean: ## Clean up redundant files
@echo "Begin to clean redundant files."
@rm -rf ./bin
@rm -rf ./release
.PHONY: clean

build-dirs:
build-dirs: ## Prepare required folders for build
@mkdir -p ./bin
.PHONY: build-dirs

build: build-dirs
@echo "Begin to build dfget and dfdaemon and supernode."
build: build-dirs ## Build dfget, dfdaemon and supernode
@echo "Begin to build dfget, dfdaemon and supernode."
./hack/build.sh
.PHONY: build

build-client: build-dirs
build-client: build-dirs ## Build dfget and dfdaemon
@echo "Begin to build dfget and dfdaemon."
./hack/build.sh dfget
./hack/build.sh dfdaemon
.PHONY: build-client

build-supernode: build-dirs
build-supernode: build-dirs ## Build supernode
@echo "Begin to build supernode."
./hack/build.sh supernode
.PHONY: build-supernode

install:
@echo "Begin to install dfget and dfdaemon and supernode."
install: ## Install dfget, dfdaemon and supernode
@echo "Begin to install dfget, dfdaemon and supernode."
./hack/install.sh install
.PHONY: install

install-client:
install-client: ## Install dfget and dfdaemon
@echo "Begin to install dfget and dfdaemon."
./hack/install.sh install dfclient
.PHONY: install-client

install-supernode:
install-supernode: ## Install supernode
@echo "Begin to install supernode."
./hack/install.sh install supernode
.PHONY: install-supernode

uninstall:
@echo "Begin to uninstall dfget and dfdaemon and supernode."
uninstall: ## Uninstall dfget, dfdaemon and supernode
@echo "Begin to uninstall dfget, dfdaemon and supernode."
./hack/install.sh uninstall
.PHONY: uninstall

uninstall-client:
uninstall-client: ## Uninstall dfget and dfdaemon
@echo "Begin to uninstall dfget and dfdaemon."
./hack/install.sh uninstall-dfclient
.PHONY: uninstall-client

uninstall-supernode:
uninstall-supernode: ## Uninstall supernode
@echo "Begin to uninstall supernode."
./hack/install.sh uninstall-supernode
.PHONY: uninstall-supernode

docker-build:
docker-build: ## Build dfclient and supernode images
@echo "Begin to use docker build dfclient and supernode images."
./hack/docker-build.sh
.PHONY: docker-build

docker-build-client:
docker-build-client: ## Build dfclient image
@echo "Begin to use docker build dfclient image."
./hack/docker-build.sh dfclient
.PHONY: docker-build-client

docker-build-supernode:
docker-build-supernode: ## Build supernode image
@echo "Begin to use docker build supernode image."
./hack/docker-build.sh supernode
.PHONY: docker-build-supernode

unit-test: build-dirs
unit-test: build-dirs ## Run unit test
./hack/unit-test.sh
.PHONY: unit-test

# TODO: output the log file when the test is failed
integration-test:
integration-test: ## Run integration test
@go test ./test
.PHONY: integration-test

check: boilerplate-check
check: boilerplate-check ## Check code formats
@echo "Begin to check code formats."
./hack/check.sh
@echo "Begin to check dockerd whether is startup"
./hack/check-docker.sh
.PHONY: check

boilerplate-check:
boilerplate-check: ## Check code boilerplate
@echo "Begin to check code boilerplate."
./hack/boilerplate-check.sh
.PHONY: boilerplate-check

go-mod-tidy:
go-mod-tidy: ## Tidy up go.mod and go.sum
@echo "Begin to tidy up go.mod and go.sum"
@go mod tidy
.PHONY: go-mod-tidy

go-mod-vendor:
go-mod-vendor: ## Vendor go mod dependency
@echo "Begin to vendor go mod dependency"
@go mod vendor
.PHONY: go-mod-vendor

check-go-mod: go-mod-tidy
check-go-mod: go-mod-tidy ## Check for unused/missing packages in go.mod
@echo "Begin to check for unused/missing packages in go.mod"
@git diff --exit-code -- go.sum go.mod
.PHONY: check-go-mod

docs:
docs: ## Generate docs of API/CLI
@echo "Begin to generate docs of API/CLI"
./hack/generate-docs.sh
.PHONY: docs

rpm:
rpm: ## Build rpm package
./hack/package.sh rpm
.PHONY: rpm

deb:
deb: ## Build deb package
./hack/package.sh deb
.PHONY: deb

release:
release: ## Build a release
./hack/package.sh
.PHONY: release

Expand All @@ -159,6 +164,6 @@ df.crt: df.key
openssl x509 -req -sha256 -days 365 -in df.csr -signkey df.key -out df.crt
rm df.csr

golangci-lint:
golangci-lint: ## Run golangci-lint
./hack/golangci-lint.sh
.PHONY: golangci-lint

0 comments on commit 4fc4fea

Please sign in to comment.