Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit 390af23

Browse files
authored
Merge pull request #92 from crawford/build
build: various fixes to the build programs
2 parents 66d84b2 + b43e7ba commit 390af23

File tree

3 files changed

+64
-45
lines changed

3 files changed

+64
-45
lines changed

Makefile

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
1-
export CGO_ENABLED:=0
1+
# kernel-style V=1 build verbosity
2+
ifeq ("$(origin V)", "command line")
3+
BUILD_VERBOSE = $(V)
4+
endif
25

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
511

12+
VERSION=$(shell git describe --dirty)
613
REPO=github.com/coreos/container-linux-config-transpiler
14+
LD_FLAGS="-w -X $(REPO)/internal/version.Raw=$(VERSION)"
715

8-
all: build
16+
export GOPATH=$(shell pwd)/gopath
17+
export CGO_ENABLED:=0
918

10-
build: bin/ct
19+
.PHONY: all
20+
all: bin/ct
1121

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)
1425

26+
.PHONY: test
1527
test:
16-
@./test
28+
$(Q)./test
1729

1830
.PHONY: vendor
1931
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
2234

35+
.PHONY: clean
2336
clean:
24-
@rm -rf bin
25-
@rm -rf _output
37+
$(Q)rm -rf bin
2638

2739
.PHONY: release
2840
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
3644

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
4048

41-
.PHONY: all build clean test
49+
bin/%: | gopath
50+
$(Q)$(GOARGS) go build -o $@ -ldflags $(LD_FLAGS) $(REPO)/internal

release.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
[ $# == 1 ] || { echo "usage: $0 version" && exit 1; }
6+
7+
VER=$1
8+
9+
[[ "${VER}" =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]] || {
10+
echo "malformed version: \"${VER}\""
11+
exit 2
12+
}
13+
14+
if test -n "$(git ls-files --others | \
15+
grep --invert-match '\(gopath/src/github.com/coreos/container-linux-config-transpiler\|bin/ct\)')";
16+
then
17+
echo "directory has untracked files"
18+
exit 1
19+
fi
20+
21+
if ! $(git diff-index --quiet HEAD --); then
22+
echo "directory has uncommitted files"
23+
exit 1
24+
fi
25+
26+
make test
27+
28+
git tag --sign --message "Config-Transpiler ${VER}" "${VER}"
29+
30+
git verify-tag --verbose "${VER}"
31+
32+
make release

tag_release.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)