~nskaggs/+junk/juju-packaging-test

« back to all changes in this revision

Viewing changes to src/github.com/altoros/gosigma/Makefile

  • Committer: Nicholas Skaggs
  • Date: 2016-10-27 20:23:11 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161027202311-sux4jk2o73p1d6rg
Re-add src

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Makefile for gosigma
 
3
#
 
4
 
 
5
PROJECT := github.com/altoros/gosigma
 
6
PROJECT_DIR := $(shell go list -e -f '{{.Dir}}' $(PROJECT))
 
7
 
 
8
ifeq ($(shell uname -p | sed -r 's/.*(x86|armel|armhf).*/golang/'), golang)
 
9
        GO_C := golang
 
10
        INSTALL_FLAGS := 
 
11
else
 
12
        GO_C := gccgo-4.9  gccgo-go
 
13
        INSTALL_FLAGS := -gccgoflags=-static-libgo
 
14
endif
 
15
 
 
16
default: build
 
17
 
 
18
# Start of GOPATH-dependent targets. Some targets only make sense -
 
19
# and will only work - when this tree is found on the GOPATH.
 
20
ifeq ($(CURDIR),$(PROJECT_DIR))
 
21
 
 
22
build:
 
23
        go build $(PROJECT)/...
 
24
 
 
25
check test: check-license
 
26
        go test $(PROJECT)/...
 
27
 
 
28
check-license:
 
29
        @(fgrep "Copyright 2014 ALTOROS" -rl | grep -v Makefile ; \
 
30
         find -name "*.go" | cut -b3-) | sort | uniq -u | xargs -I {} echo FAIL: license missed: {}
 
31
 
 
32
install:
 
33
        go install $(INSTALL_FLAGS) -v $(PROJECT)/...
 
34
 
 
35
clean:
 
36
        go clean $(PROJECT)/...
 
37
        find -name "*.test" | xargs rm -f
 
38
        find -name "*.out" | xargs rm -f
 
39
 
 
40
coverage.out: *.go data/*.go https/*.go
 
41
        -rm -rf *cover.out
 
42
        go test -coverprofile=data.cover.out -coverpkg=./,./data,./https ./data
 
43
        go test -coverprofile=https.cover.out -coverpkg=./,./data,./https ./https
 
44
        go test -coverprofile=gosigma.cover.out -coverpkg=./,./data,./https ./
 
45
        echo "mode: set" > coverage.out && cat *.cover.out | grep -v mode: | sort -r | \
 
46
                awk '{if($$1 != last) {print $$0;last=$$1}}' >> coverage.out
 
47
        rm data.cover.out
 
48
        rm https.cover.out
 
49
        rm gosigma.cover.out
 
50
 
 
51
cover-html: coverage.out
 
52
        go tool cover -html=$<
 
53
 
 
54
cover: coverage.out
 
55
        go tool cover -func=$<
 
56
 
 
57
update:
 
58
        go get -u -v ./...
 
59
 
 
60
else # --------------------------------
 
61
 
 
62
build check test install clean:
 
63
        $(error Cannot $@; $(CURDIR) is not on GOPATH)
 
64
 
 
65
endif
 
66
# End of GOPATH-dependent targets.
 
67
 
 
68
# Reformat source files.
 
69
format:
 
70
        gofmt -w -l .
 
71
 
 
72
lc:
 
73
        find -name "*.go" | xargs cat | wc -l
 
74
 
 
75
.PHONY: build check test check-license install clean cover-html cover update
 
76
.PHONY: format
 
77
 
 
78