Skip to content

Commit cc8b948

Browse files
committed
Makefile: build proto files unconditionally
Ditch the makefile pattern rule which simply doesn't work in scenarios where both the source and the build targets are stored in the git repo (as git operations mangle the time stamps). So much grey hair avoided when the stuff just force generates everything instead of leaving you wonder why the tools didn't work as expected.
1 parent 3c85968 commit cc8b948

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Makefile

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
PROTO_SOURCES = $(shell find . -name '*.proto' | grep -v /vendor/)
16-
PROTO_GOFILES = $(patsubst %.proto,%.pb.go,$(PROTO_SOURCES))
1716
PROTO_INCLUDE = -I$(PWD):/usr/local/include:/usr/include
1817
PROTO_OPTIONS = --proto_path=. $(PROTO_INCLUDE) \
1918
--go_opt=paths=source_relative --go_out=. \
@@ -77,11 +76,15 @@ FORCE:
7776
# build targets
7877
#
7978

80-
build-proto: $(PROTO_GOFILES)
79+
build-proto:
80+
for src in $(PROTO_SOURCES); do \
81+
$(PROTO_COMPILE) $$src; \
82+
done
83+
sed -i '1s;^;//go:build !wasip1\n\n;' pkg/api/api_ttrpc.pb.go
8184

8285
.PHONY: build-proto-dockerized
8386
build-proto-dockerized:
84-
$(Q)docker build --build-arg ARTIFACTS="$(dir $(PROTO_GOFILES))" --target final \
87+
$(Q)docker build --build-arg ARTIFACTS="$(dir $(PROTO_SOURCES))" --target final \
8588
--output type=local,dest=$(RESOLVED_PWD) \
8689
-f hack/Dockerfile.buildproto .
8790
$(Q)tar xf artifacts.tgz && rm -f artifacts.tgz
@@ -173,15 +176,6 @@ validate-repo-no-changes:
173176
exit 1; \
174177
}
175178

176-
#
177-
# proto generation targets
178-
#
179-
180-
%.pb.go: %.proto
181-
$(Q)echo "Generating $@..."; \
182-
$(PROTO_COMPILE) $<
183-
sed -i '1s;^;//go:build !wasip1\n\n;' pkg/api/api_ttrpc.pb.go
184-
185179
#
186180
# targets for installing dependencies
187181
#

0 commit comments

Comments
 (0)