Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [diff] [blame^] | 1 | # Copyright 2015 Google Inc. All rights reserved |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | GO_SRCS:=$(wildcard *.go) |
| 16 | |
| 17 | kati: go_src_stamp |
| 18 | GOPATH=$$(pwd)/out:$${GOPATH} go install -ldflags "-X github.com/google/kati.gitVersion $(shell git rev-parse HEAD)" github.com/google/kati/cmd/kati |
| 19 | cp out/bin/kati $@ |
| 20 | |
| 21 | go_src_stamp: $(GO_SRCS) cmd/*/*.go |
| 22 | -rm -rf out/src/github.com/google/kati |
| 23 | mkdir -p out/src/github.com/google/kati |
| 24 | cp -a $(GO_SRCS) cmd out/src/github.com/google/kati |
| 25 | GOPATH=$$(pwd)/out:$${GOPATH} go get github.com/google/kati/cmd/kati |
| 26 | touch $@ |
| 27 | |
| 28 | go_test: $(GO_SRCS) |
| 29 | GOPATH=$$(pwd)/out:$${GOPATH} go test *.go |
| 30 | |
| 31 | go_clean: |
| 32 | rm -rf out kati go_src_stamp |
| 33 | |
| 34 | .PHONY: go_clean go_test |