20
20
# ## Variables & Definitions
21
21
# ##
22
22
23
- export GOPROXY=https ://proxy.golang.org
24
-
25
23
GO ?= go
26
24
GO_LDFLAGS: = $(shell if $(GO ) version|grep -q gccgo ; then echo "-gccgoflags"; else echo "-ldflags"; fi)
27
25
GOCMD = CGO_ENABLED=$(CGO_ENABLED ) GOOS=$(GOOS ) GOARCH=$(GOARCH ) $(GO )
28
26
COVERAGE_PATH ?= .coverage
29
27
DESTDIR ?=
30
28
EPOCH_TEST_COMMIT ?= $(shell git merge-base $${DEST_BRANCH:-main} HEAD)
31
29
HEAD ?= HEAD
32
- CHANGELOG_BASE ?= HEAD~
33
- CHANGELOG_TARGET ?= HEAD
34
30
PROJECT := github.com/containers/podman
35
31
GIT_BASE_BRANCH ?= origin/main
36
32
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
@@ -69,8 +65,6 @@ PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit
69
65
# triggered.
70
66
SOURCES = $(shell find . -path './.* ' -prune -o \( \( -name '* .go' -o -name '* .c' \) -a ! -name '*_test.go' \) -print)
71
67
72
- BUILDFLAGS := -mod=vendor $(BUILDFLAGS )
73
-
74
68
BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
75
69
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
76
70
OCI_RUNTIME ?= ""
@@ -90,10 +84,8 @@ GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT
90
84
DATE_FMT = %s
91
85
ifdef SOURCE_DATE_EPOCH
92
86
BUILD_INFO ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
93
- ISODATE ?= $(shell date -d "@$(SOURCE_DATE_EPOCH)" --iso-8601)
94
87
else
95
88
BUILD_INFO ?= $(shell date "+$(DATE_FMT)")
96
- ISODATE ?= $(shell date --iso-8601)
97
89
endif
98
90
LIBPOD := ${PROJECT}/v4/libpod
99
91
GOFLAGS ?= -trimpath
@@ -120,22 +112,10 @@ RELEASE_NUMBER = $(shell echo "$(RELEASE_VERSION)" | sed -e 's/^v\(.*\)/\1/')
120
112
# If non-empty, logs all output from server during remote system testing
121
113
PODMAN_SERVER_LOG ?=
122
114
123
- # If GOPATH not specified, use one in the local directory
124
- ifeq ($(GOPATH ) ,)
125
- export GOPATH := $(HOME ) /go
126
- unexport GOBIN
127
- endif
128
- FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH ) ) )
129
- GOPKGDIR := $(FIRST_GOPATH ) /src/$(PROJECT )
130
- GOPKGBASEDIR ?= $(shell dirname "$(GOPKGDIR ) ")
131
-
132
- GOBIN := $(shell $(GO ) env GOBIN)
133
- ifeq ($(GOBIN ) ,)
134
- GOBIN := $(FIRST_GOPATH ) /bin
135
- endif
136
-
115
+ # Ensure GOBIN is not set so the default (`go env GOPATH`/bin) is used.
116
+ override undefine GOBIN
137
117
# This must never include the 'hack' directory
138
- export PATH := $(PATH ) :$(GOBIN )
118
+ export PATH := $(shell $( GO ) env GOPATH) /bin :$(PATH )
139
119
140
120
GOMD2MAN ?= $(shell command -v go-md2man || echo './test/tools/build/go-md2man')
141
121
@@ -223,15 +203,8 @@ help: ## (Default) Print listing of key targets with their descriptions
223
203
# ## Linting/Formatting/Code Validation targets
224
204
# ##
225
205
226
- .gopathok :
227
- ifeq ("$(wildcard $(GOPKGDIR ) ) ","")
228
- mkdir -p "$(GOPKGBASEDIR)"
229
- ln -sfn "$(CURDIR)" "$(GOPKGDIR)"
230
- endif
231
- touch $@
232
-
233
206
.PHONY : .gitvalidation
234
- .gitvalidation : .gopathok
207
+ .gitvalidation :
235
208
@echo " Validating vs commit '$( call err_if_empty,EPOCH_TEST_COMMIT) '"
236
209
GIT_CHECK_EXCLUDE=" ./vendor:./test/tools/vendor:docs/make.bat:test/buildah-bud/buildah-tests.diff" ./test/tools/build/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT ) ..$(HEAD )
237
210
@@ -245,46 +218,34 @@ endif
245
218
$(PRE_COMMIT) run -a
246
219
247
220
.PHONY : golangci-lint
248
- golangci-lint : .gopathok . install.golangci-lint
221
+ golangci-lint : .install.golangci-lint
249
222
hack/golangci-lint.sh run
250
223
251
- .PHONY : gofmt
252
- gofmt : # # Verify the source code gofmt
253
- find . -name ' *.go' -type f \
254
- -not \( \
255
- -name ' .golangci.yml' -o \
256
- -name ' Makefile' -o \
257
- -path ' ./vendor/*' -prune -o \
258
- -path ' ./test/tools/vendor/*' -prune -o \
259
- -path ' ./contrib/*' -prune \
260
- \) -exec gofmt -d -e -s -w {} \+
261
- git diff --exit-code
262
-
263
224
.PHONY : test/checkseccomp/checkseccomp
264
- test/checkseccomp/checkseccomp : .gopathok $(wildcard test/checkseccomp/* .go)
225
+ test/checkseccomp/checkseccomp : $(wildcard test/checkseccomp/* .go)
265
226
$(GOCMD ) build $(BUILDFLAGS ) $(GO_LDFLAGS ) ' $(LDFLAGS_PODMAN)' -tags " $( BUILDTAGS) " -o $@ ./test/checkseccomp
266
227
267
228
.PHONY : test/testvol/testvol
268
- test/testvol/testvol : .gopathok $(wildcard test/testvol/* .go)
229
+ test/testvol/testvol : $(wildcard test/testvol/* .go)
269
230
$(GOCMD ) build $(BUILDFLAGS ) $(GO_LDFLAGS ) ' $(LDFLAGS_PODMAN)' -o $@ ./test/testvol
270
231
271
232
.PHONY : volume-plugin-test-image
272
233
volume-plugin-test-img :
273
234
podman build -t quay.io/libpod/volume-plugin-test-img -f Containerfile-testvol .
274
235
275
236
.PHONY : test/goecho/goecho
276
- test/goecho/goecho : .gopathok $(wildcard test/goecho/* .go)
237
+ test/goecho/goecho : $(wildcard test/goecho/* .go)
277
238
$(GOCMD ) build $(BUILDFLAGS ) $(GO_LDFLAGS ) ' $(LDFLAGS_PODMAN)' -o $@ ./test/goecho
278
239
279
- test/version/version : .gopathok version/version.go
240
+ test/version/version : version/version.go
280
241
$(GO ) build -o $@ ./test/version/
281
242
282
243
.PHONY : codespell
283
244
codespell :
284
245
codespell -S bin,vendor,.git,go.sum,.cirrus.yml," RELEASE_NOTES.md,*.xz,*.gz,*.ps1,*.tar,swagger.yaml,*.tgz,bin2img,*ico,*.png,*.1,*.5,copyimg,*.orig,apidoc.go" -L uint,iff,od,seeked,splitted,marge,ERRO,hist,ether -w
285
246
286
247
.PHONY : validate
287
- validate : gofmt lint .gitvalidation validate.completions man-page-check swagger-check tests-included tests-expect-exit
248
+ validate : lint .gitvalidation validate.completions man-page-check swagger-check tests-included tests-expect-exit
288
249
289
250
.PHONY : build-all-new-commits
290
251
build-all-new-commits :
@@ -293,9 +254,9 @@ build-all-new-commits:
293
254
294
255
.PHONY : vendor
295
256
vendor :
296
- GO111MODULE=on $(GO ) mod tidy
297
- GO111MODULE=on $(GO ) mod vendor
298
- GO111MODULE=on $(GO ) mod verify
257
+ $(GO ) mod tidy
258
+ $(GO ) mod vendor
259
+ $(GO ) mod verify
299
260
300
261
.PHONY : vendor-in-container
301
262
vendor-in-container :
@@ -309,7 +270,7 @@ vendor-in-container:
309
270
# ##
310
271
311
272
# Make sure to warn in case we're building without the systemd buildtag.
312
- bin/podman : .gopathok $(SOURCES ) go.mod go.sum
273
+ bin/podman : $(SOURCES ) go.mod go.sum
313
274
ifeq (,$(findstring systemd,$(BUILDTAGS ) ) )
314
275
@echo "Podman is being compiled without the systemd build tag. \
315
276
Install libsystemd on Ubuntu or systemd-devel on rpm based \
@@ -325,14 +286,14 @@ endif
325
286
$(SRCBINDIR ) :
326
287
mkdir -p $(SRCBINDIR )
327
288
328
- $(SRCBINDIR ) /podman$(BINSFX ) : $(SRCBINDIR ) .gopathok $(SOURCES ) go.mod go.sum
289
+ $(SRCBINDIR ) /podman$(BINSFX ) : $(SRCBINDIR ) $(SOURCES ) go.mod go.sum
329
290
$(GOCMD ) build \
330
291
$(BUILDFLAGS ) \
331
292
$(GO_LDFLAGS ) ' $(LDFLAGS_PODMAN)' \
332
293
-tags " ${REMOTETAGS} " \
333
294
-o $@ ./cmd/podman
334
295
335
- $(SRCBINDIR ) /podman-remote-static : $(SRCBINDIR ) .gopathok $(SOURCES ) go.mod go.sum
296
+ $(SRCBINDIR ) /podman-remote-static : $(SRCBINDIR ) $(SOURCES ) go.mod go.sum
336
297
CGO_ENABLED=0 \
337
298
GOOS=$(GOOS ) \
338
299
GOARCH=$(GOARCH ) \
@@ -368,7 +329,7 @@ podman-remote-windows: ## Build podman-remote for Windows
368
329
bin/windows/podman.exe
369
330
370
331
.PHONY : podman-winpath
371
- podman-winpath : .gopathok $(SOURCES ) go.mod go.sum
332
+ podman-winpath : $(SOURCES ) go.mod go.sum
372
333
CGO_ENABLED=0 \
373
334
GOOS=windows \
374
335
$(GO ) build \
@@ -395,7 +356,7 @@ podman-mac-helper: ## Build podman-mac-helper for macOS
395
356
-o bin/darwin/podman-mac-helper \
396
357
./cmd/podman-mac-helper
397
358
398
- bin/rootlessport : .gopathok $(SOURCES ) go.mod go.sum
359
+ bin/rootlessport : $(SOURCES ) go.mod go.sum
399
360
CGO_ENABLED=$(CGO_ENABLED ) \
400
361
$(GO ) build \
401
362
$(BUILDFLAGS ) \
@@ -411,11 +372,11 @@ rootlessport: bin/rootlessport
411
372
.PHONY : generate-bindings
412
373
generate-bindings :
413
374
ifneq ($(GOOS ) ,darwin)
414
- GO111MODULE=off $(GOCMD) generate ./pkg/bindings/... ;
375
+ $(GOCMD) generate ./pkg/bindings/... ;
415
376
endif
416
377
417
378
# DO NOT USE: use local-cross instead
418
- bin/podman.cross.% : .gopathok
379
+ bin/podman.cross.% :
419
380
TARGET=" $* " ; \
420
381
GOOS=" $$ {TARGET%%.*}" ; \
421
382
GOARCH=" $$ {TARGET##*.}" ; \
@@ -455,7 +416,7 @@ completions: podman podman-remote
455
416
# ## Documentation targets
456
417
# ##
457
418
458
- pkg/api/swagger.yaml : .gopathok
419
+ pkg/api/swagger.yaml :
459
420
make -C pkg/api
460
421
461
422
$(MANPAGES ) : % : % .md .install.md2man docdir
@@ -531,7 +492,7 @@ run-docker-py-tests:
531
492
.PHONY : localunit
532
493
localunit : test/goecho/goecho test/version/version
533
494
rm -rf ${COVERAGE_PATH} && mkdir -p ${COVERAGE_PATH}
534
- UNIT=1 $( GOBIN ) / ginkgo \
495
+ UNIT=1 ginkgo \
535
496
-r \
536
497
$(TESTFLAGS ) \
537
498
--skipPackage test/e2e,pkg/apparmor,pkg/bindings,hack,pkg/machine/e2e \
@@ -550,8 +511,8 @@ test: localunit localintegration remoteintegration localsystem remotesystem ##
550
511
551
512
.PHONY : ginkgo-run
552
513
ginkgo-run :
553
- ACK_GINKGO_RC=true $( GOBIN ) / ginkgo version
554
- ACK_GINKGO_RC=true $( GOBIN ) / ginkgo -v $(TESTFLAGS ) -tags " $( TAGS) " $(GINKGOTIMEOUT ) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 -debug test/e2e/. $(HACK )
514
+ ACK_GINKGO_RC=true ginkgo version
515
+ ACK_GINKGO_RC=true ginkgo -v $(TESTFLAGS ) -tags " $( TAGS) " $(GINKGOTIMEOUT ) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 -debug test/e2e/. $(HACK )
555
516
556
517
.PHONY : ginkgo
557
518
ginkgo :
@@ -569,7 +530,7 @@ remoteintegration: test-binaries ginkgo-remote
569
530
570
531
.PHONY : localbenchmarks
571
532
localbenchmarks : test-binaries
572
- PATH=$(PATH ) :$(shell pwd) /hack ACK_GINKGO_RC=true $( GOBIN ) / ginkgo \
533
+ PATH=$(PATH ) :$(shell pwd) /hack ACK_GINKGO_RC=true ginkgo \
573
534
-focus " Podman Benchmark Suite" \
574
535
-tags " $( BUILDTAGS) benchmarks" -noColor \
575
536
-noisySkippings=false -noisyPendings=false \
@@ -759,7 +720,7 @@ package-install: package ## Install rpm packages
759
720
/usr/bin/podman info # will catch a broken conmon
760
721
761
722
.PHONY : install
762
- install : .gopathok install.bin install.remote install.man install.systemd # # Install binaries to system locations
723
+ install : install.bin install.remote install.man install.systemd # # Install binaries to system locations
763
724
764
725
.PHONY : install.catatonit
765
726
install.catatonit :
@@ -865,14 +826,12 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n
865
826
make -C test/tools
866
827
867
828
.PHONY : .install.ginkgo
868
- .install.ginkgo : .gopathok
869
- if [ ! -x " $( GOBIN) /ginkgo" ]; then \
870
- $(GO ) install $(BUILDFLAGS ) ./vendor/github.com/onsi/ginkgo/ginkgo ; \
871
- fi
829
+ .install.ginkgo :
830
+ $(GO ) install $(BUILDFLAGS ) ./vendor/github.com/onsi/ginkgo/ginkgo
872
831
873
832
.PHONY : .install.golangci-lint
874
- .install.golangci-lint : .gopathok
875
- VERSION=1.45.2 GOBIN= $( GOBIN ) ./hack/install_golangci.sh
833
+ .install.golangci-lint :
834
+ VERSION=1.45.2 ./hack/install_golangci.sh
876
835
877
836
.PHONY : .install.md2man
878
837
.install.md2man :
@@ -881,7 +840,7 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n
881
840
fi
882
841
883
842
.PHONY : .install.bats
884
- .install.bats : .gopathok
843
+ .install.bats :
885
844
VERSION=v1.1.0 ./hack/install_bats.sh
886
845
887
846
.PHONY : .install.pre-commit
@@ -890,13 +849,6 @@ install.tools: .install.ginkgo .install.golangci-lint .install.bats ## Install n
890
849
python3 -m pip install --user pre-commit; \
891
850
fi
892
851
893
- # $BUILD_TAGS variable is used in hack/golangci-lint.sh
894
- .PHONY : install.libseccomp.sudo
895
- install.libseccomp.sudo :
896
- rm -rf ../../seccomp/libseccomp
897
- git clone https://github.com/seccomp/libseccomp ../../seccomp/libseccomp
898
- cd ../../seccomp/libseccomp && git checkout --detach $(LIBSECCOMP_COMMIT ) && ./autogen.sh && ./configure --prefix=/usr && make all && make install
899
-
900
852
.PHONY : uninstall
901
853
uninstall :
902
854
for i in $( filter %.1,$( MANPAGES_DEST) ) ; do \
@@ -927,7 +879,6 @@ clean-binaries: ## Remove platform/architecture specific binary files
927
879
.PHONY : clean
928
880
clean : clean-binaries # # Clean all make artifacts
929
881
rm -rf \
930
- .gopathok \
931
882
_output \
932
883
$(wildcard podman-* .msi) \
933
884
$(wildcard podman-remote* .zip) \
@@ -943,7 +894,6 @@ clean: clean-binaries ## Clean all make artifacts
943
894
libpod/pod_ffjson.go \
944
895
libpod/container_easyjson.go \
945
896
libpod/pod_easyjson.go \
946
- .install.goimports \
947
897
docs/build \
948
898
.venv
949
899
make -C docs clean
0 commit comments