1# General
2WORKDIR = $(PWD)
3
4# Go parameters
5GOCMD = go
6GOTEST = $(GOCMD) test
7
8# Git config
9GIT_VERSION ?=
10GIT_DIST_PATH ?= $(PWD)/.git-dist
11GIT_REPOSITORY = http://github.com/git/git.git
12
13# Coverage
14COVERAGE_REPORT = coverage.out
15COVERAGE_MODE = count
16
17build-git:
18 @if [ -f $(GIT_DIST_PATH)/git ]; then \
19 echo "nothing to do, using cache $(GIT_DIST_PATH)"; \
20 else \
21 git clone $(GIT_REPOSITORY) -b $(GIT_VERSION) --depth 1 --single-branch $(GIT_DIST_PATH); \
22 cd $(GIT_DIST_PATH); \
23 make configure; \
24 ./configure; \
25 make all; \
26 fi
27
28test:
29 @echo "running against `git version`"; \
30 $(GOTEST) ./...
31
32test-coverage:
33 @echo "running against `git version`"; \
34 echo "" > $(COVERAGE_REPORT); \
35 $(GOTEST) -coverprofile=$(COVERAGE_REPORT) -coverpkg=./... -covermode=$(COVERAGE_MODE) ./...
36
37clean:
38 rm -rf $(GIT_DIST_PATH)