Makefile 3.33 KB
Newer Older
1 2

ifeq ($(TEST_NO_FUSE),1)
3
  go_test=go test -tags nofuse
4
else
5
  go_test=go test
6 7
endif

8 9 10
COMMIT := $(shell git rev-parse --short HEAD)
ldflags = "-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)"
MAKEFLAGS += --no-print-directory
11

12
all: help
13 14 15 16 17 18 19 20 21

godep:
	go get github.com/tools/godep

# saves/vendors third-party dependencies to Godeps/_workspace
# -r flag rewrites import paths to use the vendored path
# ./... performs operation on all packages in tree
vendor: godep
	godep save -r ./...
22

23
install:
24
	cd cmd/ipfs && go install -ldflags=$(ldflags)
25

26
build:
27
	cd cmd/ipfs && go build -i -ldflags=$(ldflags)
28

Henry's avatar
Henry committed
29
nofuse:
30
	cd cmd/ipfs && go install -tags nofuse -ldflags=$(ldflags)
Henry's avatar
Henry committed
31

32 33 34 35 36 37 38 39
clean:
	cd cmd/ipfs && go clean -ldflags=$(ldflags)

uninstall:
	cd cmd/ipfs && go clean -i -ldflags=$(ldflags)

PHONY += all help godep install build nofuse clean uninstall

40 41 42
##############################################################
# tests targets

43
test: test_expensive windows_build_check
44

45
test_short: build test_go_short test_sharness_short
46

47
test_expensive: build test_go_expensive test_sharness_expensive
48

49 50
test_3node:
	cd test/3nodetest && make
Brian Tiger Chow's avatar
Brian Tiger Chow committed
51

52
test_go_short:
53
	$(go_test) -test.short ./...
54 55

test_go_expensive:
56
	$(go_test) ./...
57

Brian Tiger Chow's avatar
Brian Tiger Chow committed
58
test_go_race:
59
	$(go_test) ./... -race
Brian Tiger Chow's avatar
Brian Tiger Chow committed
60

61
test_sharness_short:
62
	cd test/sharness/ && make
63 64

test_sharness_expensive:
65
	cd test/sharness/ && TEST_EXPENSIVE=1 make
66 67 68 69 70 71

test_all_commits:
	@echo "testing all commits between origin/master..HEAD"
	@echo "WARNING: this will 'git rebase --exec'."
	@test/bin/continueyn
	GIT_EDITOR=true git rebase -i --exec "make test" origin/master
72 73 74 75 76 77 78 79

test_all_commits_travis:
	# these are needed because travis.
	# we don't use this yet because it takes way too long.
	git config --global user.email "nemo@ipfs.io"
	git config --global user.name "IPFS BOT"
	git fetch origin master:master
	GIT_EDITOR=true git rebase -i --exec "make test" master
80 81 82

# since we have CI for osx and linux but not windows, this should help
windows_build_check:
83
	GOOS=windows GOARCH=amd64 go build -o .test.ipfs.exe ./cmd/ipfs
84
	rm .test.ipfs.exe
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

PHONY += test test_short test_expensive

##############################################################
# A semi-helpful help message

help:
	@echo 'DEPENDENCY TARGETS:'
	@echo ''
	@echo '  vendor       - Create a Godep workspace of 3rd party dependencies'
	@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 binary from build directory'
	@echo '  uninstall    - Remove binary from $$GOPATH/bin'
	@echo ''
	@echo 'TESTING TARGETS:'
	@echo ''
	@echo '  test                    - Run expensive tests and Window$$ check'
	@echo '  test_short              - Run short tests and sharness tests'
	@echo '  test_expensive          - Run a few extras'
	@echo '  test_3node'
	@echo '  test_go_short'
	@echo '  test_go_expensive'
	@echo '  test_go_race'
	@echo '  test_sharness_short'
	@echo '  test_sharness_expensive'
	@echo '  test_all_commits'
	@echo "  test_all_commits_travis - DON'T USE: takes way too long"
	@echo '  windows_build_check'
	@echo ''

PHONY += help

.PHONY: $(PHONY)