github.com/lusis/distribution@v2.0.1+incompatible/Makefile (about) 1 # Set an output prefix, which is the local directory if not specified 2 PREFIX?=$(shell pwd) 3 4 # Used to populate version variable in main package. 5 VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) 6 GO_LDFLAGS=-ldflags "-X `go list ./version`.Version $(VERSION)" 7 8 .PHONY: clean all fmt vet lint build test binaries 9 .DEFAULT: default 10 all: AUTHORS clean fmt vet fmt lint build test binaries 11 12 AUTHORS: .mailmap .git/HEAD 13 git log --format='%aN <%aE>' | sort -fu > $@ 14 15 # This only needs to be generated by hand when cutting full releases. 16 version/version.go: 17 ./version/version.sh > $@ 18 19 ${PREFIX}/bin/registry: version/version.go $(shell find . -type f -name '*.go') 20 @echo "+ $@" 21 @go build -o $@ ${GO_LDFLAGS} ./cmd/registry 22 23 ${PREFIX}/bin/registry-api-descriptor-template: version/version.go $(shell find . -type f -name '*.go') 24 @echo "+ $@" 25 @go build -o $@ ${GO_LDFLAGS} ./cmd/registry-api-descriptor-template 26 27 ${PREFIX}/bin/dist: version/version.go $(shell find . -type f -name '*.go') 28 @echo "+ $@" 29 @go build -o $@ ${GO_LDFLAGS} ./cmd/dist 30 31 docs/spec/api.md: docs/spec/api.md.tmpl ${PREFIX}/bin/registry-api-descriptor-template 32 ./bin/registry-api-descriptor-template $< > $@ 33 34 vet: 35 @echo "+ $@" 36 @go vet ./... 37 38 fmt: 39 @echo "+ $@" 40 @test -z "$$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" || \ 41 echo "+ please format Go code with 'gofmt -s'" 42 43 lint: 44 @echo "+ $@" 45 @test -z "$$(golint ./... | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" 46 47 build: 48 @echo "+ $@" 49 @go build -v ${GO_LDFLAGS} ./... 50 51 test: 52 @echo "+ $@" 53 @go test -test.short ./... 54 55 test-full: 56 @echo "+ $@" 57 @go test ./... 58 59 binaries: ${PREFIX}/bin/registry ${PREFIX}/bin/registry-api-descriptor-template ${PREFIX}/bin/dist 60 @echo "+ $@" 61 62 clean: 63 @echo "+ $@" 64 @rm -rf "${PREFIX}/bin/registry" "${PREFIX}/bin/registry-api-descriptor-template" 65 66 67 # Use the existing docs build cmds from docker/docker 68 # Later, we will move this into an import 69 DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) 70 DOCSPORT := 8000 71 DOCKER_DOCS_IMAGE := docker-docs-$(VERSION) 72 DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE 73 74 docs: docs-build 75 $(DOCKER_RUN_DOCS) -p $(DOCSPORT):8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve 76 77 docs-shell: docs-build 78 $(DOCKER_RUN_DOCS) -p $(DOCSPORT):8000 "$(DOCKER_DOCS_IMAGE)" bash 79 80 docs-build: 81 docker build -t "$(DOCKER_DOCS_IMAGE)" -f docs/Dockerfile .