mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Makefile: rm $(SOURCES), mark targets as PHONY
Since go has its own way to track dependencies and rebuild if needed, and it is efficient enough, let's drop using SOURCES variable, mark all targets as PHONY and let golang do its job. The primary motivation for this was concern about using find on every make invocation to build the list of all sources. Some unscientific performance analisys: Before: > $ time make > make: 'runc' is up to date. > > real 0m0.202s > user 0m0.177s > sys 0m0.031s After: > $ time make > go build -mod=vendor -buildmode=pie -tags "seccomp selinux apparmor" -ldflags "-X main.gitCommit="5a8210a58bd0f07cc987e6201b4174e5b93fa115" -X main.version=1.0.0-rc10+dev " -o runc . > > real 0m0.149s > user 0m0.315s > sys 0m0.106s So, it is slightly faster using the wall clock, uses more CPU, but we can be sure the binary is always up to date. This also fixes the Makefile to mark all targets as PHONY. The list was generated by `grep -E '^[a-z-]+:' Makefile | sed 's/:.*//'`. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
.PHONY: all shell dbuild man release \
|
||||
localtest localunittest localintegration \
|
||||
test unittest integration \
|
||||
cross localcross vendor verify-dependencies
|
||||
|
||||
CONTAINER_ENGINE := docker
|
||||
GO := go
|
||||
|
||||
SOURCES := $(shell find . 2>&1 | grep -E '.*\.(c|h|go)$$')
|
||||
PREFIX := $(DESTDIR)/usr/local
|
||||
BINDIR := $(PREFIX)/sbin
|
||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
@@ -35,17 +29,15 @@ SHELL := $(shell command -v bash 2>/dev/null)
|
||||
|
||||
.DEFAULT: runc
|
||||
|
||||
runc: $(SOURCES)
|
||||
runc:
|
||||
$(GO_BUILD) -o runc .
|
||||
|
||||
all: runc recvtty
|
||||
|
||||
recvtty: contrib/cmd/recvtty/recvtty
|
||||
|
||||
contrib/cmd/recvtty/recvtty: $(SOURCES)
|
||||
recvtty:
|
||||
$(GO_BUILD) -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
|
||||
|
||||
static: $(SOURCES)
|
||||
static:
|
||||
$(GO_BUILD_STATIC) -o runc .
|
||||
$(GO_BUILD_STATIC) -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
|
||||
|
||||
@@ -164,3 +156,9 @@ localcross:
|
||||
CGO_ENABLED=1 GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc $(GO_BUILD) -o runc-armhf .
|
||||
CGO_ENABLED=1 GOARCH=arm64 CC=aarch64-linux-gnu-gcc $(GO_BUILD) -o runc-arm64 .
|
||||
CGO_ENABLED=1 GOARCH=ppc64le CC=powerpc64le-linux-gnu-gcc $(GO_BUILD) -o runc-ppc64le .
|
||||
|
||||
.PHONY: runc all recvtty static release dbuild lint man runcimage \
|
||||
test localtest unittest localunittest integration localintegration \
|
||||
rootlessintegration localrootlessintegration shell install install-bash \
|
||||
install-man uninstall uninstall-bash uninstall-man clean validate ci \
|
||||
vendor verify-dependencies cross localcross
|
||||
|
||||
Reference in New Issue
Block a user