github.com/spg/deis@v1.7.3/logger/Makefile (about) 1 include ../includes.mk 2 3 # the filepath to this repository, relative to $GOPATH/src 4 repo_path = github.com/deis/deis/logger 5 6 GO_FILES = main.go 7 GO_PACKAGES = syslog syslogd tests 8 GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES)) 9 GO_TESTABLE_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,syslog syslogd) 10 11 COMPONENT = $(notdir $(repo_path)) 12 IMAGE = $(IMAGE_PREFIX)$(COMPONENT):$(BUILD_TAG) 13 DEV_IMAGE = $(DEV_REGISTRY)/$(IMAGE) 14 BINARY_DEST_DIR = image/bin 15 16 build: check-docker 17 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/logger github.com/deis/deis/logger || exit 1 18 $(call check-static-binary,$(BINARY_DEST_DIR)/logger) 19 docker build -t $(IMAGE) image 20 21 clean: check-docker check-registry 22 rm -f image/bin/logger 23 docker rmi $(IMAGE) 24 25 full-clean: check-docker check-registry 26 docker images -q $(IMAGE_PREFIX)$(COMPONENT) | xargs docker rmi -f 27 28 install: check-deisctl 29 deisctl install $(COMPONENT) 30 31 uninstall: check-deisctl 32 deisctl uninstall $(COMPONENT) 33 34 start: check-deisctl 35 deisctl start $(COMPONENT) 36 37 stop: check-deisctl 38 deisctl stop $(COMPONENT) 39 40 restart: stop start 41 42 run: install start 43 44 dev-release: push set-image 45 46 push: check-registry 47 docker tag -f $(IMAGE) $(DEV_IMAGE) 48 docker push $(DEV_IMAGE) 49 50 set-image: check-deisctl 51 deisctl config $(COMPONENT) set image=$(DEV_IMAGE) 52 53 release: 54 docker push $(IMAGE) 55 56 deploy: build dev-release restart 57 58 setup-root-gotools: 59 sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/cover 60 sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/vet 61 sudo rm -rf /tmp/tmpGOPATH 62 63 setup-gotools: 64 go get -v github.com/golang/lint/golint 65 66 test: test-style test-unit test-functional 67 68 test-functional: 69 @docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest 70 GOPATH=`cd ../tests/ && godep path`:$(GOPATH) go test -v ./tests/... 71 72 test-style: 73 # display output, then check 74 $(GOFMT) $(GO_PACKAGES) $(GO_FILES) 75 @$(GOFMT) $(GO_PACKAGES) $(GO_FILES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi 76 $(GOVET) $(repo_path) $(GO_PACKAGES_REPO_PATH) 77 $(GOLINT) ./... 78 79 test-unit: test-style 80 $(GOTEST) $(GO_TESTABLE_PACKAGES_REPO_PATH) 81 82 coverage: 83 go test -coverprofile coverage.out ./syslog 84 go tool cover -html=coverage.out