Skip to content

Commit ff224f8

Browse files
authored
Merge pull request #28 from wking/makefile-pattern-rule
Makefile: Add a pattern rule for oci-* commands
2 parents bf96365 + 2d06368 commit ff224f8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ export GO15VENDOREXPERIMENT
44
COMMIT=$(shell git rev-parse HEAD 2> /dev/null || true)
55

66
EPOCH_TEST_COMMIT ?= v0.2.0
7+
TOOLS := \
8+
oci-create-runtime-bundle \
9+
oci-image-validate \
10+
oci-unpack
711

812
default: help
913

@@ -20,10 +24,10 @@ check-license:
2024
@echo "checking license headers"
2125
@./.tool/check-license
2226

23-
tools:
24-
go build -ldflags "-X main.gitCommit=${COMMIT}" ./cmd/oci-create-runtime-bundle
25-
go build -ldflags "-X main.gitCommit=${COMMIT}" ./cmd/oci-unpack
26-
go build -ldflags "-X main.gitCommit=${COMMIT}" ./cmd/oci-image-validate
27+
tools: $(TOOLS)
28+
29+
$(TOOLS): oci-%:
30+
go build -ldflags "-X main.gitCommit=${COMMIT}" ./cmd/$@
2731

2832
lint:
2933
@echo "checking lint"
@@ -69,13 +73,11 @@ install.tools: .install.gitvalidation .install.glide .install.glide-vc .install.
6973
gometalinter --install --update
7074

7175
clean:
72-
rm -rf *~ $(OUTPUT_DIRNAME)
73-
rm -f oci-create-runtime-bundle
74-
rm -f oci-unpack
75-
rm -f oci-image-validate
76+
rm -rf *~ $(OUTPUT_DIRNAME) $(TOOLS)
7677

7778
.PHONY: \
7879
tools \
80+
$(TOOLS) \
7981
check-license \
8082
clean \
8183
lint \

0 commit comments

Comments
 (0)