2017-01-25 03:36:30 +00:00
|
|
|
# Update this variable, then run 'make'
|
2016-06-15 17:50:45 +00:00
|
|
|
# Naming convention:
|
|
|
|
# for stable releases we use "1.0.0" format
|
|
|
|
# for pre-releases, we use "1.0.0-beta.2" format
|
2017-01-31 05:49:20 +00:00
|
|
|
VERSION=2.0.0-alpha.2
|
2016-06-14 23:52:32 +00:00
|
|
|
|
2016-04-18 03:55:46 +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 ?=
|
2017-01-13 06:56:53 +00:00
|
|
|
PWD ?= `pwd`
|
2016-05-11 05:05:01 +00:00
|
|
|
TELEPORT_DEBUG ?= no
|
2017-01-19 00:53:19 +00:00
|
|
|
GITTAG=v$(VERSION)
|
|
|
|
BUILDFLAGS := $(ADDFLAGS) -ldflags '-w -s'
|
2016-04-16 00:48:25 +00:00
|
|
|
|
2017-01-16 00:27:19 +00:00
|
|
|
RELEASE=teleport-$(GITTAG)-`go env GOOS`-`go env GOARCH`-bin
|
|
|
|
BINARIES=$(BUILDDIR)/tsh $(BUILDDIR)/teleport $(BUILDDIR)/tctl
|
|
|
|
|
2017-01-25 03:36:30 +00:00
|
|
|
VERSRC = version.go gitref.go
|
|
|
|
LIBS = $(shell find lib -type f -name '*.go') *.go
|
2017-01-16 00:27:19 +00:00
|
|
|
|
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
|
|
|
#
|
2016-02-14 01:09:05 +00:00
|
|
|
.PHONY: all
|
2017-01-25 03:36:30 +00:00
|
|
|
all: $(VERSRC) $(BINARIES)
|
2016-02-14 01:09:05 +00:00
|
|
|
|
2017-01-16 00:27:19 +00:00
|
|
|
$(BUILDDIR)/tctl: $(LIBS) $(TOOLS) tool/tctl/*.go
|
2016-06-14 23:52:32 +00:00
|
|
|
go build -o $(BUILDDIR)/tctl -i $(BUILDFLAGS) ./tool/tctl
|
2016-02-08 22:51:22 +00:00
|
|
|
|
2017-01-25 03:36:30 +00:00
|
|
|
$(BUILDDIR)/teleport: $(LIBS) tool/teleport/*.go
|
2016-06-14 23:52:32 +00:00
|
|
|
go build -o $(BUILDDIR)/teleport -i $(BUILDFLAGS) ./tool/teleport
|
2016-02-10 00:09:21 +00:00
|
|
|
|
2017-01-16 00:27:19 +00:00
|
|
|
$(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
|
|
|
|
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
|
|
|
|
2017-01-28 02:26:27 +00:00
|
|
|
|
2016-03-19 17:32:08 +00:00
|
|
|
#
|
2016-03-22 17:11:12 +00:00
|
|
|
# Builds docs using containerized mkdocs
|
2016-03-19 17:32:08 +00:00
|
|
|
#
|
|
|
|
.PHONY:docs
|
|
|
|
docs:
|
|
|
|
$(MAKE) -C build.assets docs
|
|
|
|
|
2016-05-14 23:44:41 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2016-03-23 18:12:24 +00:00
|
|
|
.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/... \
|
2016-10-24 06:42:17 +00:00
|
|
|
./tool/teleport... $(FLAGS) $(ADDFLAGS)
|
2016-03-11 02:09:17 +00:00
|
|
|
go vet ./tool/... ./lib/...
|
2016-02-24 07:35:25 +00:00
|
|
|
|
2016-04-14 21:42:10 +00:00
|
|
|
#
|
|
|
|
# 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/...
|
2016-03-23 00:03:58 +00:00
|
|
|
|
2017-01-25 03:36:30 +00:00
|
|
|
# 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
|
|
|
|
2016-06-15 17:50:45 +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"
|
2016-03-23 00:03:58 +00:00
|
|
|
|
|
|
|
#
|
2016-06-15 17:50:45 +00:00
|
|
|
# make release - produces a binary release tarball
|
|
|
|
#
|
2017-01-16 00:27:19 +00:00
|
|
|
.PHONY:
|
|
|
|
release: clean all $(BUILDDIR)/webassets.zip
|
|
|
|
cp -f build.assets/release.mk $(BUILDDIR)/Makefile
|
2016-11-02 00:09:47 +00:00
|
|
|
cat $(BUILDDIR)/webassets.zip >> $(BUILDDIR)/teleport
|
|
|
|
zip -q -A $(BUILDDIR)/teleport
|
2016-06-15 17:50:45 +00:00
|
|
|
cp -rf $(BUILDDIR) teleport
|
|
|
|
@echo $(GITTAG) > teleport/VERSION
|
|
|
|
tar -czf $(RELEASE).tar.gz teleport
|
|
|
|
rm -rf teleport
|
2017-01-16 00:27:19 +00:00
|
|
|
@echo "\nCREATED: $(RELEASE).tar.gz"
|
2016-03-23 00:03:58 +00:00
|
|
|
|
2017-01-16 00:27:19 +00:00
|
|
|
# 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
|
|
|
|
2016-03-23 18:12:24 +00:00
|
|
|
.PHONY: test-package
|
|
|
|
test-package: remove-temp-files
|
2015-08-26 15:31:34 +00:00
|
|
|
go test -v -test.parallel=0 ./$(p)
|
2015-03-02 20:11:23 +00:00
|
|
|
|
2016-03-23 18:12:24 +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)
|
|
|
|
|
2016-12-27 02:50:59 +00:00
|
|
|
.PHONY: test-dynamo
|
|
|
|
test-dynamo:
|
|
|
|
go test -v ./lib/... -tags dynamodb
|
|
|
|
|
2016-03-23 18:12:24 +00:00
|
|
|
.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
|
|
|
|
|
2016-03-23 18:12:24 +00:00
|
|
|
.PHONY: profile
|
2015-03-02 20:11:23 +00:00
|
|
|
profile:
|
|
|
|
go tool pprof http://localhost:6060/debug/pprof/profile
|
|
|
|
|
2016-03-23 18:12:24 +00:00
|
|
|
.PHONY: sloccount
|
2015-03-02 20:11:23 +00:00
|
|
|
sloccount:
|
2016-02-24 01:26:23 +00:00
|
|
|
find . -path ./vendor -prune -o -name "*.go" -print0 | xargs -0 wc -l
|
2015-05-14 01:40:39 +00:00
|
|
|
|
2016-03-23 18:12:24 +00:00
|
|
|
.PHONY: remove-temp-files
|
|
|
|
remove-temp-files:
|
|
|
|
find . -name flymake_* -delete
|
2016-10-09 23:00:20 +00:00
|
|
|
|
|
|
|
# Dockerized build: usefule for making Linux releases on OSX
|
|
|
|
.PHONY:docker
|
|
|
|
docker:
|
2016-11-03 21:52:28 +00:00
|
|
|
make -C build.assets
|
2016-12-21 00:39:11 +00:00
|
|
|
|
|
|
|
# Interactively enters a Docker container (which you can build and run Teleport inside of)
|
|
|
|
.PHONY:enter
|
|
|
|
enter:
|
|
|
|
make -C build.assets enter
|