Skip to content

Commit a41ba0a

Browse files
committed
Makefile: unconditionally build plugins
Changes the build targets of plugins to effectively "phony", always unconditionally running the build without trying to check dependencies. The previous make targets were faulty, e.g. changing something in the library didn't rebuild the plugins. This is a simple and stupid fix that I believe is good enough - building the plugins is really fast and go compiler caching makes it super fast for "unnecessary" builds. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
1 parent 65eda50 commit a41ba0a

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

Makefile

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ BIN_PATH := $(BUILD_PATH)/bin
4040
COVERAGE_PATH := $(BUILD_PATH)/coverage
4141

4242
PLUGINS := \
43-
$(BIN_PATH)/logger \
44-
$(BIN_PATH)/device-injector \
45-
$(BIN_PATH)/hook-injector \
46-
$(BIN_PATH)/differ \
47-
$(BIN_PATH)/ulimit-adjuster \
48-
$(BIN_PATH)/v010-adapter \
49-
$(BIN_PATH)/template \
50-
$(BIN_PATH)/wasm \
51-
$(BIN_PATH)/network-device-injector \
52-
$(BIN_PATH)/network-logger
43+
logger \
44+
device-injector \
45+
hook-injector \
46+
differ \
47+
ulimit-adjuster \
48+
v010-adapter \
49+
template \
50+
wasm \
51+
network-device-injector \
52+
network-logger
5353

5454
ifneq ($(V),1)
5555
Q := @
@@ -75,7 +75,7 @@ test: test-gopkgs
7575

7676
build-proto: $(PROTO_GOFILES)
7777

78-
build-plugins: $(PLUGINS)
78+
build-plugins: $(foreach plugin,$(PLUGINS),build-plugin-$(plugin))
7979

8080
build-check:
8181
$(Q)$(GO_BUILD) -v $(GO_MODULES)
@@ -89,7 +89,7 @@ mod-tidy:
8989
#
9090

9191
clean-plugins:
92-
$(Q)rm -f $(PLUGINS)
92+
$(Q)rm -f $(foreach plugin,$(PLUGINS),$(BIN_PATH)/$(plugin))
9393

9494
clean-cache:
9595
$(Q)$(GO_CMD) clean -cache -testcache
@@ -98,14 +98,15 @@ clean-cache:
9898
# plugins build targets
9999
#
100100

101-
$(BIN_PATH)/%: plugins/%/*
102-
$(Q)echo "Building $@..."; \
103-
cd $(dir $<) && $(GO_BUILD) -o $@ .
101+
build-plugin-%:
102+
$(Q)echo "Building plugin $*..."; \
103+
cd plugins/$* && $(GO_BUILD) -o $(BIN_PATH)/$* .
104104

105-
$(BIN_PATH)/wasm: plugins/wasm/
106-
$(Q)echo "Building $@..."; \
105+
.PHONY: build-plugin-wasm
106+
build-plugin-wasm:
107+
$(Q)echo "Building plugin wasm..."; \
107108
mkdir -p $(BIN_PATH) && \
108-
cd $(dir $<) && GOOS=wasip1 GOARCH=wasm $(GO_BUILD) -o $@ -buildmode=c-shared .
109+
cd plugins/wasm && GOOS=wasip1 GOARCH=wasm $(GO_BUILD) -o $(BIN_PATH)/wasm -buildmode=c-shared .
109110

110111
#
111112
# test targets

plugins/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN --mount=type=cache,target=/go/pkg/mod/ go mod download
2727
COPY . .
2828

2929
RUN --mount=type=cache,target=/go/pkg/mod/ \
30-
make /go/src/build/bin/${PLUGIN} \
30+
make build-plugin-${PLUGIN} \
3131
GO_BUILD="CGO_ENABLED=0 go build -ldflags '-extldflags=-static'"
3232

3333
# Construct final image

0 commit comments

Comments
 (0)