Skip to content

Commit 0179710

Browse files
committed
Makefile: Add a pattern rule for oci-* commands
Make it easy to (re)build a single command without building all of them. Using main.go as the only prerequisite cuts some corners, but prerequisites for this are hard ;). With this commit, you can touch main.go to force a rebuild. If that ends up being too awkward, we can make these .PHONY targets. Signed-off-by: W. Trevor King <[email protected]>
1 parent 853746e commit 0179710

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ GO15VENDOREXPERIMENT=1
22
export GO15VENDOREXPERIMENT
33

44
EPOCH_TEST_COMMIT ?= v0.2.0
5+
TOOLS := \
6+
oci-create-runtime-bundle \
7+
oci-image-validate \
8+
oci-unpack
59

610
default: help
711

@@ -18,10 +22,10 @@ check-license:
1822
@echo "checking license headers"
1923
@./.tool/check-license
2024

21-
tools:
22-
go build ./cmd/oci-create-runtime-bundle
23-
go build ./cmd/oci-unpack
24-
go build ./cmd/oci-image-validate
25+
tools: $(TOOLS)
26+
27+
oci-%: cmd/oci-%/main.go
28+
go build ./cmd/$@
2529

2630
lint:
2731
@echo "checking lint"
@@ -67,10 +71,7 @@ install.tools: .install.gitvalidation .install.glide .install.glide-vc .install.
6771
gometalinter --install --update
6872

6973
clean:
70-
rm -rf *~ $(OUTPUT_DIRNAME)
71-
rm -f oci-create-runtime-bundle
72-
rm -f oci-unpack
73-
rm -f oci-image-validate
74+
rm -rf *~ $(OUTPUT_DIRNAME) $(TOOLS)
7475

7576
.PHONY: \
7677
tools \

0 commit comments

Comments
 (0)