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 | |
Ryo Hashimoto | 564e7a4 | 2015-09-04 17:37:59 +0900 | [diff] [blame] | 17 | ifeq (${GOPATH},) |
| 18 | KATI_GOPATH:=$$(pwd)/out |
| 19 | else |
| 20 | KATI_GOPATH:=$$(pwd)/out:$${GOPATH} |
| 21 | endif |
| 22 | |
Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [diff] [blame] | 23 | kati: go_src_stamp |
Fumitoshi Ukai | d4a016e | 2015-07-27 16:50:00 +0900 | [diff] [blame] | 24 | -rm -f out/bin/kati |
Ryo Hashimoto | 564e7a4 | 2015-09-04 17:37:59 +0900 | [diff] [blame] | 25 | GOPATH=${KATI_GOPATH} go install -ldflags "-X github.com/google/kati.gitVersion $(shell git rev-parse HEAD)" github.com/google/kati/cmd/kati |
Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [diff] [blame] | 26 | cp out/bin/kati $@ |
| 27 | |
Shinichiro Hamaji | ceedf3f | 2016-01-26 16:42:20 +0900 | [diff] [blame] | 28 | go_src_stamp: $(GO_SRCS) $(wildcard cmd/*/*.go) |
Fumitoshi Ukai | 9c2f98c | 2015-07-22 16:46:08 +0900 | [diff] [blame] | 29 | -rm -rf out/{src,pkg/*}/github.com/google/kati |
| 30 | mkdir -p out/{src,pkg/*}/github.com/google/kati |
Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [diff] [blame] | 31 | cp -a $(GO_SRCS) cmd out/src/github.com/google/kati |
Ryo Hashimoto | 564e7a4 | 2015-09-04 17:37:59 +0900 | [diff] [blame] | 32 | GOPATH=${KATI_GOPATH} go get github.com/google/kati/cmd/kati |
Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [diff] [blame] | 33 | touch $@ |
| 34 | |
| 35 | go_test: $(GO_SRCS) |
Ryo Hashimoto | 564e7a4 | 2015-09-04 17:37:59 +0900 | [diff] [blame] | 36 | GOPATH=${KATI_GOPATH} go test *.go |
Colin Cross | 43767ff | 2015-07-21 14:35:33 -0700 | [diff] [blame] | 37 | |
| 38 | go_clean: |
| 39 | rm -rf out kati go_src_stamp |
| 40 | |
| 41 | .PHONY: go_clean go_test |