Rules.mk 3.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
TGT_BIN :=
CLEAN :=
COVERAGE :=
DISTCLEAN :=
TEST :=
TEST_SHORT :=

all: help    # all has to be first defined target
.PHONY: all

Jakub Sztandera's avatar
Jakub Sztandera committed
11 12
include mk/git.mk # has to be before tarball.mk
include mk/tarball.mk
13 14 15 16
include mk/util.mk
include mk/golang.mk
include mk/gx.mk

Jakub Sztandera's avatar
Jakub Sztandera committed
17 18 19 20 21 22 23 24 25
# -------------------- #
#   extra properties   #
# -------------------- #

ifeq ($(TEST_NO_FUSE),1)
	GOTAGS += nofuse
endif
export IPFS_REUSEPORT=false

26 27 28 29 30 31
# -------------------- #
#       sub-files      #
# -------------------- #
dir := bin
include $(dir)/Rules.mk

32 33 34 35
# tests need access to rules from plugin
dir := plugin
include $(dir)/Rules.mk

36 37 38 39 40 41
dir := test
include $(dir)/Rules.mk

dir := cmd/ipfs
include $(dir)/Rules.mk

42 43
# include this file only if coverage target is executed
# it is quite expensive
44
ifneq ($(filter coverage% clean distclean,$(MAKECMDGOALS)),)
45 46 47 48
	# has to be after cmd/ipfs due to PATH
	dir := coverage
	include $(dir)/Rules.mk
endif
49 50 51 52

dir := pin/internal/pb
include $(dir)/Rules.mk

53 54 55
dir := filestore/pb
include $(dir)/Rules.mk

56

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# -------------------- #
#   universal rules    #
# -------------------- #

%.pb.go: %.proto
	$(PROTOC)

# -------------------- #
#     core targets     #
# -------------------- #

build: $(TGT_BIN)
.PHONY: build

clean:
Jakub Sztandera's avatar
Jakub Sztandera committed
72
	rm -rf $(CLEAN)
73 74 75 76 77 78
.PHONY: clean

coverage: $(COVERAGE)
.PHONY: coverage

distclean: clean
Jakub Sztandera's avatar
Jakub Sztandera committed
79
	rm -rf $(DISTCLEAN)
80
	git clean -ffxd
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
.PHONY: distclean

test: $(TEST)
.PHONY: test

test_short: $(TEST_SHORT)
.PHONY: test_short

deps: gx-deps
.PHONY: deps

nofuse: GOTAGS += nofuse
nofuse: build
.PHONY: nofuse

96
install: cmd/ipfs-install
97 98
.PHONY: install

99 100 101
install_unsupported:
	@echo "note: this command has yet to be tested to build in the system you are using"
	@echo "installing gx"
102 103 104 105
	go get -v -u github.com/whyrusleeping/gx
	go get -v -u github.com/whyrusleeping/gx-go
	@echo check gx and gx-go
	gx -v && gx-go -v
106 107 108
	@echo downloading dependencies
	gx install --global
	@echo "installing go-ipfs"
109
	go install -v -tags nofuse ./cmd/ipfs
110 111
.PHONY: install_unsupported

112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
uninstall:
	go 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 ''
Steven Allen's avatar
Steven Allen committed
138 139 140
	@echo '  test                    - Run all tests'
	@echo '  test_short              - Run short go tests and short sharness tests'
	@echo '  test_go_short           - Run short go tests'
141 142
	@echo '  test_go_test            - Run all go tests'
	@echo '  test_go_expensive       - Run all go tests and compile on all platforms'
Steven Allen's avatar
Steven Allen committed
143 144 145 146
	@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'
147 148 149
	@echo '  coverage     - Collects coverage info from unit tests and sharness'
	@echo
.PHONY: help