github.com/lheiskan/zebrapack@v4.1.1-0.20181107023619-e955d028f9bf+incompatible/Makefile (about)

     1  
     2  # NOTE: This Makefile is only necessary if you 
     3  # plan on developing the msgp tool and library.
     4  # Installation can still be performed with a
     5  # normal `go install`.
     6  
     7  
     8  # generated integration test files
     9  GGEN = ./_generated/generated.go ./_generated/generated_test.go
    10  # generated unit test files
    11  
    12  MGEN = ./msgp/defgen_test.go ./msgp/nestedgen_test.go
    13  
    14  # generated zebra layer above msgp
    15  ZGEN = ./zebra/zebra_gen.go
    16  
    17  SHELL := /bin/bash
    18  
    19  BIN = $(GOBIN)/zebrapack
    20  
    21  .PHONY: clean wipe install get-deps bench all dev
    22  
    23  dev: clean install test
    24  
    25  $(BIN): */*.go *.go
    26  	@go install && (cd ./cmd/addzid && make)
    27  
    28  install:
    29  	go install  && (cd ./cmd/addzid && make)
    30  
    31  $(GGEN): ./_generated/def.go
    32  	go generate ./_generated
    33  
    34  $(MGEN): ./msgp/defs_test.go
    35  	go generate ./msgp
    36  
    37  $(ZGEN): ./zebra/zebra.go
    38  	go install
    39  	go generate ./zebra
    40  	zebrapack -method-prefix Zebra -o zebra/zebra_zebra.go -file zebra/zebra.go
    41  
    42  test: all
    43  	go test -v ./parse
    44  	go test -v ./msgp
    45  	go test -v ./_generated
    46  	go test -v ./zebra
    47  	# and test addzid
    48  	go test -v ./cmd/addzid
    49  	# build and run on testdata/
    50  	go build -o ./zebrapack && ./zebrapack -write-schema testdata/my.z -file testdata/my.go && go test -v ./testdata
    51  	cd testdata && go generate && go test -v
    52  	./zebrapack -file testdata/my.go && go test -v ./testdata/my_gen_test.go ./testdata/my.go ./testdata/my_gen.go
    53  	./zebrapack -file testdata/my.go -msgp -o testdata/my_msgp_gen.go -method-prefix=MSGP -tests=false -io=false # test the -method-prefix flag
    54  	./zebrapack -schema-to-go testdata/my.z > /tmp/remy.go && echo "func main() {}" >> /tmp/remy.go && go run /tmp/remy.go && rm /tmp/remy.go
    55  
    56  bench: all
    57  	go test -bench . ./msgp
    58  	go test -bench . ./_generated
    59  
    60  clean:
    61  	$(RM) $(GGEN) $(MGEN) 
    62  
    63  wipe: clean
    64  	$(RM) $(BIN)
    65  
    66  get-deps:
    67  	go get -d -t ./...
    68  
    69  all: install $(GGEN) $(MGEN) $(ZGEN)
    70  
    71  # travis CI enters here
    72  travis:
    73  	go get -d -t ./...
    74  	go build -o "$${GOPATH%%:*}/bin/msgp" .
    75  	go generate ./msgp
    76  	go generate ./_generated
    77  	go test ./msgp
    78  	go test ./_generated