kubo/Rules.mk
Christopher Buesser f31dd2aae6 GOCC implementation & fix in make & build scripts
The usage of a native 'go' command has been replaced with a make &
environment variable $GOCC. This enables building with multiple go
versions on a single machine as documented:
  * https://golang.org/doc/install#extra_versions

This enables the usage of:
```bash
$ make install
$ # OR
$ GOCC=go1.12.3 make install
$ # OR
$ GOCC=go1.12.4 make install
```
And the build and test tools now pick up on this change

 On branch go-version-check
 Changes to be committed:
	modified:   Rules.mk
	modified:   bin/check_go_version
	modified:   bin/dist_get
	modified:   bin/maketarball.sh
	modified:   coverage/Rules.mk
	modified:   mk/golang.mk
	modified:   mk/tarball.mk
License: MIT
Signed-off-by: Chris Buesser <christopher.buesser@gmail.com>
2019-04-30 21:22:43 -04:00

145 lines
3.6 KiB
Makefile

TGT_BIN :=
CLEAN :=
COVERAGE :=
DISTCLEAN :=
TEST :=
TEST_SHORT :=
GOCC ?= go
all: help # all has to be first defined target
.PHONY: all
include mk/git.mk # has to be before tarball.mk
include mk/tarball.mk
include mk/util.mk
include mk/golang.mk
# -------------------- #
# extra properties #
# -------------------- #
ifeq ($(TEST_NO_FUSE),1)
GOTAGS += nofuse
endif
export IPFS_REUSEPORT=false
# -------------------- #
# sub-files #
# -------------------- #
dir := bin
include $(dir)/Rules.mk
# tests need access to rules from plugin
dir := plugin
include $(dir)/Rules.mk
dir := test
include $(dir)/Rules.mk
dir := cmd/ipfs
include $(dir)/Rules.mk
# include this file only if coverage target is executed
# it is quite expensive
ifneq ($(filter coverage% clean distclean test/unit/gotest.junit.xml,$(MAKECMDGOALS)),)
# has to be after cmd/ipfs due to PATH
dir := coverage
include $(dir)/Rules.mk
endif
dir := pin/internal/pb
include $(dir)/Rules.mk
dir := filestore/pb
include $(dir)/Rules.mk
# -------------------- #
# universal rules #
# -------------------- #
%.pb.go: %.proto
$(PROTOC)
# -------------------- #
# core targets #
# -------------------- #
build: $(TGT_BIN)
.PHONY: build
clean:
rm -rf $(CLEAN)
.PHONY: clean
coverage: $(COVERAGE)
.PHONY: coverage
distclean: clean
rm -rf $(DISTCLEAN)
git clean -ffxd
.PHONY: distclean
test: $(TEST)
.PHONY: test
test_short: $(TEST_SHORT)
.PHONY: test_short
deps:
.PHONY: deps
nofuse: GOTAGS += nofuse
nofuse: build
.PHONY: nofuse
install: cmd/ipfs-install
.PHONY: install
install_unsupported: install
@echo "/=======================================================================\\"
@echo '| |'
@echo '| `make install_unsupported` is deprecated, use `make install` instead. |'
@echo '| |'
@echo "\\=======================================================================/"
.PHONY: install_unsupported
uninstall:
$(GOCC) clean -i ./cmd/ipfs
.PHONY: uninstall
help:
@echo 'DEPENDENCY TARGETS:'
@echo ''
@echo ' deps - Download dependencies using bundled gx'
@echo ' test_sharness_deps - Download and build dependencies for sharness'
@echo ''
@echo 'BUILD TARGETS:'
@echo ''
@echo ' all - print this help message'
@echo ' build - Build binary at ./cmd/ipfs/ipfs'
@echo ' nofuse - Build binary with no fuse support'
@echo ' install - Build binary and install into $$GOPATH/bin'
# @echo ' dist_install - TODO: c.f. ./cmd/ipfs/dist/README.md'
@echo ''
@echo 'CLEANING TARGETS:'
@echo ''
@echo ' clean - Remove files generated by build'
@echo ' distclean - Remove files that are no part of a repository'
@echo ' uninstall - Remove binary from $$GOPATH/bin'
@echo ''
@echo 'TESTING TARGETS:'
@echo ''
@echo ' test - Run all tests'
@echo ' test_short - Run short go tests and short sharness tests'
@echo ' test_go_short - Run short go tests'
@echo ' test_go_test - Run all go tests'
@echo ' test_go_expensive - Run all go tests and compile on all platforms'
@echo ' test_go_race - Run go tests with the race detector enabled'
@echo ' test_go_megacheck - Run the `megacheck` vetting tool'
@echo ' test_sharness_short - Run short sharness tests'
@echo ' test_sharness_expensive - Run all sharness tests'
@echo ' coverage - Collects coverage info from unit tests and sharness'
@echo
.PHONY: help