|
1 |
| -export CGO_ENABLED:=0 |
| 1 | +# kernel-style V=1 build verbosity |
| 2 | +ifeq ("$(origin V)", "command line") |
| 3 | + BUILD_VERBOSE = $(V) |
| 4 | +endif |
2 | 5 |
|
3 |
| -VERSION=$(shell git describe --dirty) |
4 |
| -LD_FLAGS="-w -X github.com/coreos/container-linux-config-transpiler/internal/version.Raw=$(VERSION)" |
| 6 | +ifeq ($(BUILD_VERBOSE),1) |
| 7 | + Q = |
| 8 | +else |
| 9 | + Q = @ |
| 10 | +endif |
5 | 11 |
|
| 12 | +VERSION=$(shell git describe --dirty) |
6 | 13 | REPO=github.com/coreos/container-linux-config-transpiler
|
| 14 | +LD_FLAGS="-w -X $(REPO)/internal/version.Raw=$(VERSION)" |
7 | 15 |
|
8 |
| -all: build |
| 16 | +export GOPATH=$(shell pwd)/gopath |
| 17 | +export CGO_ENABLED:=0 |
9 | 18 |
|
10 |
| -build: bin/ct |
| 19 | +.PHONY: all |
| 20 | +all: bin/ct |
11 | 21 |
|
12 |
| -bin/ct: |
13 |
| - @go build -o $@ -v -ldflags $(LD_FLAGS) $(REPO)/internal |
| 22 | +gopath: |
| 23 | + $(Q)mkdir -p gopath/src/github.com/coreos |
| 24 | + $(Q)ln -s ../../../.. gopath/src/$(REPO) |
14 | 25 |
|
| 26 | +.PHONY: test |
15 | 27 | test:
|
16 |
| - @./test |
| 28 | + $(Q)./test |
17 | 29 |
|
18 | 30 | .PHONY: vendor
|
19 | 31 | vendor:
|
20 |
| - @glide update --strip-vendor |
21 |
| - @glide-vc --use-lock-file --no-tests --only-code |
| 32 | + $(Q)glide update --strip-vendor |
| 33 | + $(Q)glide-vc --use-lock-file --no-tests --only-code |
22 | 34 |
|
| 35 | +.PHONY: clean |
23 | 36 | clean:
|
24 |
| - @rm -rf bin |
25 |
| - @rm -rf _output |
| 37 | + $(Q)rm -rf bin |
26 | 38 |
|
27 | 39 | .PHONY: release
|
28 | 40 | release: \
|
29 |
| - _output/unknown-linux-gnu/ct \ |
30 |
| - _output/apple-darwin/ct \ |
31 |
| - _output/pc-windows-gnu/ct |
32 |
| - |
33 |
| -_output/unknown-linux-gnu/ct: GOARGS = GOOS=linux GOARCH=amd64 |
34 |
| -_output/apple-darwin/ct: GOARGS = GOOS=darwin GOARCH=amd64 |
35 |
| -_output/pc-windows-gnu/ct: GOARGS = GOOS=windows GOARCH=amd64 |
| 41 | + bin/ct-$(VERSION)-x86_64-unknown-linux-gnu \ |
| 42 | + bin/ct-$(VERSION)-x86_64-apple-darwin \ |
| 43 | + bin/ct-$(VERSION)-x86_64-pc-windows-gnu.exe |
36 | 44 |
|
37 |
| -_output/%/ct: NAME=_output/ct-$(VERSION)-x86_64-$* |
38 |
| -_output/%/ct: |
39 |
| - $(GOARGS) go build -o $(NAME) -ldflags $(LD_FLAGS) $(REPO)/internal |
| 45 | +bin/ct-%-x86_64-unknown-linux-gnu: GOARGS = GOOS=linux GOARCH=amd64 |
| 46 | +bin/ct-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64 |
| 47 | +bin/ct-%-x86_64-pc-windows-gnu.exe: GOARGS = GOOS=windows GOARCH=amd64 |
40 | 48 |
|
41 |
| -.PHONY: all build clean test |
| 49 | +bin/%: | gopath |
| 50 | + $(Q)$(GOARGS) go build -o $@ -ldflags $(LD_FLAGS) $(REPO)/internal |
0 commit comments