github.com/rohankumardubey/draft-classic@v0.16.0/Makefile (about)

     1  DOCKER_REGISTRY ?= docker.io
     2  IMAGE_PREFIX    ?= microsoft
     3  IMAGE_TAG       ?= canary
     4  SHORT_NAME      ?= draft
     5  TARGETS         = darwin/amd64 linux/amd64 linux/386 linux/arm windows/amd64
     6  DIST_DIRS       = find * -type d -exec
     7  APP             = draft
     8  
     9  # go option
    10  GO        ?= go
    11  TAGS      := kqueue
    12  TESTS     := .
    13  TESTFLAGS :=
    14  LDFLAGS   :=
    15  GOFLAGS   :=
    16  GOXFLAGS  :=
    17  BINDIR    := $(CURDIR)/bin
    18  BINARIES  := draft
    19  
    20  # Required for globs to work correctly
    21  SHELL=/bin/bash
    22  
    23  .PHONY: all
    24  all: build
    25  
    26  .PHONY: build
    27  build:
    28  	GOBIN=$(BINDIR) $(GO) install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' github.com/Azure/draft/cmd/...
    29  
    30  # usage: make clean build-cross dist APP=draft VERSION=v2.0.0-alpha.3
    31  .PHONY: build-cross
    32  build-cross: LDFLAGS += -extldflags "-static"
    33  build-cross:
    34  	CGO_ENABLED=0 gox -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' $(GOXFLAGS) github.com/Azure/draft/cmd/$(APP)
    35  
    36  .PHONY: dist
    37  dist:
    38  	( \
    39  		cd _dist && \
    40  		$(DIST_DIRS) cp ../LICENSE {} \; && \
    41  		$(DIST_DIRS) cp ../README.md {} \; && \
    42  		$(DIST_DIRS) tar -zcf draft-${VERSION}-{}.tar.gz {} \; && \
    43  		$(DIST_DIRS) zip -r draft-${VERSION}-{}.zip {} \; \
    44  	)
    45  
    46  .PHONY: checksum
    47  checksum:
    48  	for f in _dist/*.{gz,zip} ; do \
    49  		shasum -a 256 "$${f}"  | awk '{print $$1}' > "$${f}.sha256" ; \
    50  	done
    51  
    52  .PHONY: clean
    53  clean:
    54  	-rm bin/*
    55  	-rm rootfs/bin/*
    56  	-rm -rf _dist/
    57  
    58  .PHONY: test
    59  test: TESTFLAGS += -race -v
    60  test: test-lint test-unit
    61  
    62  test-cover:
    63  	scripts/cover.sh
    64  
    65  .PHONY: test-lint
    66  test-lint:
    67  	scripts/lint.sh
    68  
    69  .PHONY: test-unit
    70  test-unit:
    71  	$(GO) test $(GOFLAGS) -cover -run $(TESTS) ./... $(TESTFLAGS)
    72  
    73  HAS_GOMETALINTER := $(shell command -v gometalinter;)
    74  HAS_DEP := $(shell command -v dep;)
    75  HAS_GOX := $(shell command -v gox;)
    76  HAS_GIT := $(shell command -v git;)
    77  HAS_BINDATA := $(shell command -v go-bindata;)
    78  
    79  .PHONY: bootstrap
    80  bootstrap:
    81  ifndef HAS_GOMETALINTER
    82  	go get -u github.com/alecthomas/gometalinter
    83  	gometalinter --install
    84  endif
    85  ifndef HAS_DEP
    86  	go get -u github.com/golang/dep/cmd/dep
    87  endif
    88  ifndef HAS_GOX
    89  	go get -u github.com/mitchellh/gox
    90  endif
    91  ifndef HAS_GIT
    92  	$(error You must install git)
    93  endif
    94  ifndef HAS_BINDATA
    95  	go get github.com/jteeuwen/go-bindata/...
    96  endif
    97  	dep ensure -v
    98  
    99  include versioning.mk