blob: db1b544ff8824c9b183c1054d817aaa29f8b507b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
128
129
130
131
|
# Top-level Makefile for Gitaly
#
# Responsibilities of this file:
# - create GOPATH in _build with symlink to current dir
# - re-generate _build/Makefile from makegen.go on each run
# - dispatch commands to _build/Makefile
#
# "Magic" should happen in the makegen.go dynamic template. We want
# _build/Makefile to be as static as possible.
BUILD_DIR = _build
PKG = gitlab.com/gitlab-org/gitaly
MAKEGEN = $(BUILD_DIR)/makegen
# These variables are handed down to make in _build
export PATH := $(BUILD_DIR)/bin:$(PATH)
export TEST_REPO_STORAGE_PATH := $(CURDIR)/internal/testhelper/testdata/data
export SOURCE_DIR := $(CURDIR)
export GO111MODULE = on
all: build
.PHONY: build
build: prepare-build
cd $(BUILD_DIR) && $(MAKE) install INSTALL_DEST_DIR=$(CURDIR)
# Remove this in 12.7 once wrapper is used in place of gitaly-wrapper
# https://gitlab.com/gitlab-org/gitaly/issues/2232
cp "$(BUILD_DIR)/bin/wrapper" "$(BUILD_DIR)/bin/gitaly-wrapper"
.PHONY: build-gitaly-remote
build-gitaly-remote: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: test-gitaly-remote
test-gitaly-remote: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: install
install: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: assemble
assemble: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: binaries
binaries: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
cd $(BULLD_DIR) && cp wrapper gitaly-wrapper
.PHONY: prepare-tests
prepare-tests: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: test
test: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: test-with-proxies
test-with-proxies: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: rspec
rspec: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: rspec-gitlab-shell
rspec-gitlab-shell: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: verify
verify: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: verify-warnings
verify-warnings: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: format
format: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: cover
cover: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: notice
notice: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: race-go
race-go: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: docker
docker: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: proto
proto: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: no-changes
no-changes: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: smoke-test
smoke-test: prepare-build
cd $(BUILD_DIR) && $(MAKE) $@
.PHONY: prepare-build
prepare-build: $(BUILD_DIR)/.ok update-makefile
$(BUILD_DIR)/.ok:
mkdir -p $(BUILD_DIR)/src/$(shell dirname $(PKG))
cd $(BUILD_DIR)/src/$(shell dirname $(PKG)) && rm -f $(shell basename $(PKG)) && \
ln -sf ../../../.. $(shell basename $(PKG))
touch $@
.PHONY: update-makefile
update-makefile: _build/makegen $(BUILD_DIR)/.ok
cd $(BUILD_DIR) && ./makegen > Makefile
# This go.mod file soaks up go.mod/go.sum changes that we don't want in the top-level go.mod.
$(BUILD_DIR)/go.mod: $(BUILD_DIR)/.ok
(cd $(BUILD_DIR) && go mod init _build)
_build/makegen: _support/makegen.go $(BUILD_DIR)/go.mod
cd $(BUILD_DIR) && go build -o $(CURDIR)/$@ $(SOURCE_DIR)/_support/makegen.go
clean:
git clean -fdX
|