This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from crawford/build
build: various fixes to the build programs
- Loading branch information
Showing
3 changed files
with
64 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,50 @@ | ||
export CGO_ENABLED:=0 | ||
# kernel-style V=1 build verbosity | ||
ifeq ("$(origin V)", "command line") | ||
BUILD_VERBOSE = $(V) | ||
endif | ||
|
||
VERSION=$(shell git describe --dirty) | ||
LD_FLAGS="-w -X github.com/coreos/container-linux-config-transpiler/internal/version.Raw=$(VERSION)" | ||
ifeq ($(BUILD_VERBOSE),1) | ||
Q = | ||
else | ||
Q = @ | ||
endif | ||
|
||
VERSION=$(shell git describe --dirty) | ||
REPO=github.com/coreos/container-linux-config-transpiler | ||
LD_FLAGS="-w -X $(REPO)/internal/version.Raw=$(VERSION)" | ||
|
||
all: build | ||
export GOPATH=$(shell pwd)/gopath | ||
export CGO_ENABLED:=0 | ||
|
||
build: bin/ct | ||
.PHONY: all | ||
all: bin/ct | ||
|
||
bin/ct: | ||
@go build -o $@ -v -ldflags $(LD_FLAGS) $(REPO)/internal | ||
gopath: | ||
$(Q)mkdir -p gopath/src/github.com/coreos | ||
$(Q)ln -s ../../../.. gopath/src/$(REPO) | ||
|
||
.PHONY: test | ||
test: | ||
@./test | ||
$(Q)./test | ||
|
||
.PHONY: vendor | ||
vendor: | ||
@glide update --strip-vendor | ||
@glide-vc --use-lock-file --no-tests --only-code | ||
$(Q)glide update --strip-vendor | ||
$(Q)glide-vc --use-lock-file --no-tests --only-code | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -rf bin | ||
@rm -rf _output | ||
$(Q)rm -rf bin | ||
|
||
.PHONY: release | ||
release: \ | ||
_output/unknown-linux-gnu/ct \ | ||
_output/apple-darwin/ct \ | ||
_output/pc-windows-gnu/ct | ||
|
||
_output/unknown-linux-gnu/ct: GOARGS = GOOS=linux GOARCH=amd64 | ||
_output/apple-darwin/ct: GOARGS = GOOS=darwin GOARCH=amd64 | ||
_output/pc-windows-gnu/ct: GOARGS = GOOS=windows GOARCH=amd64 | ||
bin/ct-$(VERSION)-x86_64-unknown-linux-gnu \ | ||
bin/ct-$(VERSION)-x86_64-apple-darwin \ | ||
bin/ct-$(VERSION)-x86_64-pc-windows-gnu.exe | ||
|
||
_output/%/ct: NAME=_output/ct-$(VERSION)-x86_64-$* | ||
_output/%/ct: | ||
$(GOARGS) go build -o $(NAME) -ldflags $(LD_FLAGS) $(REPO)/internal | ||
bin/ct-%-x86_64-unknown-linux-gnu: GOARGS = GOOS=linux GOARCH=amd64 | ||
bin/ct-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64 | ||
bin/ct-%-x86_64-pc-windows-gnu.exe: GOARGS = GOOS=windows GOARCH=amd64 | ||
|
||
.PHONY: all build clean test | ||
bin/%: | gopath | ||
$(Q)$(GOARGS) go build -o $@ -ldflags $(LD_FLAGS) $(REPO)/internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
[ $# == 1 ] || { echo "usage: $0 version" && exit 1; } | ||
|
||
VER=$1 | ||
|
||
[[ "${VER}" =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]] || { | ||
echo "malformed version: \"${VER}\"" | ||
exit 2 | ||
} | ||
|
||
if test -n "$(git ls-files --others | \ | ||
grep --invert-match '\(gopath/src/github.com/coreos/container-linux-config-transpiler\|bin/ct\)')"; | ||
then | ||
echo "directory has untracked files" | ||
exit 1 | ||
fi | ||
|
||
if ! $(git diff-index --quiet HEAD --); then | ||
echo "directory has uncommitted files" | ||
exit 1 | ||
fi | ||
|
||
make test | ||
|
||
git tag --sign --message "Config-Transpiler ${VER}" "${VER}" | ||
|
||
git verify-tag --verbose "${VER}" | ||
|
||
make release |
This file was deleted.
Oops, something went wrong.