From f010a1c430552b67f0601fde15edf8f7eace5657 Mon Sep 17 00:00:00 2001 From: "Da K. Ma" Date: Sat, 27 Apr 2019 14:30:47 +0800 Subject: [PATCH] Makefile Cleanup. Signed-off-by: Da K. Ma --- .travis.yml | 2 +- Makefile | 32 ++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index c56e89721d..323510fd61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ jobs: - sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/0.2.0/kind-linux-amd64 - sudo chmod +x /usr/local/bin/kind script: - - make cli + - make vkctl - make images - make e2e-test-kind after_failure: diff --git a/Makefile b/Makefile index 4111e00bf1..668740c710 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,44 @@ BIN_DIR=_output/bin -BIN_OSARCH=linux/amd64 +REL_OSARCH=linux/amd64 +REPO_PATH=volcano.sh/volcano IMAGE_PREFIX=volcanosh/vk -TAG = latest +TAG=latest +GitSHA=`git rev-parse HEAD` +Date=`date "+%Y-%m-%d %H:%M:%S"` +LD_FLAGS=" \ + -X '${REPO_PATH}/pkg/version.GitSHA=${GitSHA}' \ + -X '${REPO_PATH}/pkg/version.Built=${Date}' \ + -X '${REPO_PATH}/pkg/version.Version=${RELEASE_VER}'" .EXPORT_ALL_VARIABLES: -all: init verify cli images e2e-test-kind +all: kube-batch vk-controllers vk-admission vkctl init: mkdir -p ${BIN_DIR} -cli: - go get github.com/mitchellh/gox - CGO_ENABLED=0 gox -osarch=${BIN_OSARCH} -output ${BIN_DIR}/${BIN_OSARCH}/vkctl ./cmd/cli +kube-batch: init + go build -ldflags ${LD_FLAGS} -o=${BIN_DIR}/kube-batch ./cmd/scheduler + +vk-controllers: init + go build -ldflags ${LD_FLAGS} -o=${BIN_DIR}/vk-controllers ./cmd/controllers + +vk-admission: init + go build -ldflags ${LD_FLAGS} -o=${BIN_DIR}/vk-admission ./cmd/admission + +vkctl: init + go build -ldflags ${LD_FLAGS} -o=${BIN_DIR}/vkctl ./cmd/cli image_bins: go get github.com/mitchellh/gox + CGO_ENABLED=0 gox -osarch=${REL_OSARCH} -output ${BIN_DIR}/${REL_OSARCH}/vkctl ./cmd/cli for name in controllers scheduler admission; do\ - CGO_ENABLED=0 gox -osarch=${BIN_OSARCH} -output ${BIN_DIR}/${BIN_OSARCH}/vk-$$name ./cmd/$$name; \ + CGO_ENABLED=0 gox -osarch=${REL_OSARCH} -output ${BIN_DIR}/${REL_OSARCH}/vk-$$name ./cmd/$$name; \ done images: image_bins for name in controllers scheduler admission; do\ - cp ${BIN_DIR}/${BIN_OSARCH}/vk-$$name ./installer/dockerfile/$$name/; \ + cp ${BIN_DIR}/${REL_OSARCH}/vk-$$name ./installer/dockerfile/$$name/; \ docker build --no-cache -t $(IMAGE_PREFIX)-$$name:$(TAG) ./installer/dockerfile/$$name; \ rm installer/dockerfile/$$name/vk-$$name; \ done