teleport/Makefile

172 lines
4.4 KiB
Makefile
Raw Normal View History

# Update this variable, then run 'make'
# Naming convention:
# for stable releases we use "1.0.0" format
# for pre-releases, we use "1.0.0-beta.2" format
2017-05-21 18:48:32 +00:00
VERSION=2.1.0-alpha.8
2016-06-14 23:52:32 +00:00
# These are standard autotools variables, don't change them please
2016-03-23 01:22:48 +00:00
BUILDDIR ?= build
2016-03-24 19:32:59 +00:00
BINDIR ?= /usr/local/bin
DATADIR ?= /usr/local/share/teleport
2016-03-22 19:15:17 +00:00
ADDFLAGS ?=
PWD ?= `pwd`
TELEPORT_DEBUG ?= no
GITTAG=v$(VERSION)
BUILDFLAGS := $(ADDFLAGS) -ldflags '-w -s'
2016-04-16 00:48:25 +00:00
RELEASE=teleport-$(GITTAG)-`go env GOOS`-`go env GOARCH`-bin
BINARIES=$(BUILDDIR)/tsh $(BUILDDIR)/teleport $(BUILDDIR)/tctl
VERSRC = version.go gitref.go
LIBS = $(shell find lib -type f -name '*.go') *.go
2016-01-17 18:28:34 +00:00
#
2016-02-02 20:14:59 +00:00
# Default target: builds all 3 executables and plaaces them in a current directory
2016-01-17 18:28:34 +00:00
#
.PHONY: all
all: $(VERSRC) $(BINARIES)
$(BUILDDIR)/tctl: $(LIBS) $(TOOLS) tool/tctl/*.go
2016-06-14 23:52:32 +00:00
go build -o $(BUILDDIR)/tctl -i $(BUILDFLAGS) ./tool/tctl
$(BUILDDIR)/teleport: $(LIBS) tool/teleport/*.go tool/teleport/common/*.go
2016-06-14 23:52:32 +00:00
go build -o $(BUILDDIR)/teleport -i $(BUILDFLAGS) ./tool/teleport
$(BUILDDIR)/tsh: $(LIBS) tool/tsh/*.go
2016-06-14 23:52:32 +00:00
go build -o $(BUILDDIR)/tsh -i $(BUILDFLAGS) ./tool/tsh
2016-03-22 19:15:17 +00:00
2017-04-07 23:51:31 +00:00
.PHONY: goinstall
goinstall:
go install github.com/gravitational/teleport/tool/tsh
go install github.com/gravitational/teleport/tool/teleport
go install github.com/gravitational/teleport/tool/tctl
2016-06-14 23:52:32 +00:00
#
# make install will installs system-wide teleport
#
2016-03-22 19:15:17 +00:00
.PHONY: install
install: build
2016-06-14 23:52:32 +00:00
@echo "\n** Make sure to run 'make install' as root! **\n"
cp -f $(BUILDDIR)/tctl $(BINDIR)/
cp -f $(BUILDDIR)/tsh $(BINDIR)/
cp -f $(BUILDDIR)/teleport $(BINDIR)/
mkdir -p $(DATADIR)
cp -fr web/dist/* $(DATADIR)
2016-03-18 21:54:20 +00:00
2016-01-17 22:50:00 +00:00
2016-03-19 20:43:23 +00:00
.PHONY: clean
2016-01-17 22:50:00 +00:00
clean:
2016-03-19 20:43:23 +00:00
rm -rf $(BUILDDIR)
2016-06-14 23:52:32 +00:00
rm -rf teleport
2017-01-16 07:25:37 +00:00
rm -rf *.gz
2016-01-17 22:50:00 +00:00
2016-03-19 17:32:08 +00:00
#
# Builds docs using containerized mkdocs
2016-03-19 17:32:08 +00:00
#
.PHONY:docs
docs:
$(MAKE) -C build.assets docs
#
# Runs the documentation site inside a container on localhost with live updates
# Convenient for editing documentation.
#
.PHONY:run-docs
run-docs:
$(MAKE) -C build.assets run-docs
2016-02-16 21:18:58 +00:00
#
# tests everything: called by Jenkins
#
.PHONY: test
2016-03-11 02:09:17 +00:00
test: FLAGS ?= -cover
2016-02-16 21:18:58 +00:00
test:
2016-06-14 23:52:32 +00:00
go test -v ./tool/tsh/... \
./lib/... \
./tool/teleport... $(FLAGS) $(ADDFLAGS)
2016-03-11 02:09:17 +00:00
go vet ./tool/... ./lib/...
#
# integration tests. need a TTY to work and not compatible with a race detector
#
.PHONY: integration
integration:
2016-06-14 23:52:32 +00:00
go test -v ./integration/...
# This rule triggers re-generation of version.go and gitref.go if Makefile changes
$(VERSRC): Makefile
2016-12-31 08:13:41 +00:00
VERSION=$(VERSION) $(MAKE) -f version.mk setver
2016-06-13 18:27:19 +00:00
# make tag - prints a tag to use with git for the current version
# To put a new release on Github:
# - bump VERSION variable
# - run make setver
# - commit changes to git
# - build binaries with 'make release'
# - run `make tag` and use its output to 'git tag' and 'git push --tags'
.PHONY: tag
tag:
@echo "Run this:\n> git tag $(GITTAG)\n> git push --tags"
#
# make release - produces a binary release tarball
#
.PHONY:
release: clean all $(BUILDDIR)/webassets.zip
cp -f build.assets/release.mk $(BUILDDIR)/Makefile
cat $(BUILDDIR)/webassets.zip >> $(BUILDDIR)/teleport
rm -fr $(BUILDDIR)/webassets.zip
cp README.md $(BUILDDIR)
cp CHANGELOG.md $(BUILDDIR)
zip -q -A $(BUILDDIR)/teleport
cp -rf $(BUILDDIR) teleport
@echo $(GITTAG) > teleport/VERSION
tar -czf $(RELEASE).tar.gz teleport
rm -rf teleport
@echo "\nCREATED: $(RELEASE).tar.gz"
# build/webassets.zip archive contains the web assets (UI) which gets
# appended to teleport binary
$(BUILDDIR)/webassets.zip:
cd web/dist ; zip -qr ../../$(BUILDDIR)/webassets.zip .
2015-03-02 20:11:23 +00:00
.PHONY: test-package
test-package: remove-temp-files
go test -v -test.parallel=0 ./$(p)
2015-03-02 20:11:23 +00:00
.PHONY: test-grep-package
test-grep-package: remove-temp-files
2015-03-02 20:11:23 +00:00
go test -v ./$(p) -check.f=$(e)
.PHONY: test-dynamo
test-dynamo:
go test -v ./lib/... -tags dynamodb
.PHONY: cover-package
2015-05-04 15:28:32 +00:00
cover-package: remove-temp-files
2015-03-02 20:11:23 +00:00
go test -v ./$(p) -coverprofile=/tmp/coverage.out
go tool cover -html=/tmp/coverage.out
.PHONY: profile
2015-03-02 20:11:23 +00:00
profile:
go tool pprof http://localhost:6060/debug/pprof/profile
.PHONY: sloccount
2015-03-02 20:11:23 +00:00
sloccount:
find . -path ./vendor -prune -o -name "*.go" -print0 | xargs -0 wc -l
.PHONY: remove-temp-files
remove-temp-files:
find . -name flymake_* -delete
# Dockerized build: usefule for making Linux releases on OSX
.PHONY:docker
docker:
2016-11-03 21:52:28 +00:00
make -C build.assets
# Interactively enters a Docker container (which you can build and run Teleport inside of)
.PHONY:enter
enter:
make -C build.assets enter