2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-12 16:26:34 +00:00
restic/vendor/google.golang.org/api/google-api-go-generator/Makefile
2017-09-13 14:09:48 +02:00

35 lines
1.1 KiB
Makefile

# This Makefile is for library maintainers, not end-developers.
# All the generated code is already checked in.
API_JSON = $(wildcard ../*/*/*-api.json ../*/*/*/*-api.json)
GENERATOR=./google-api-go-generator
# Download all API specifications and rebuild Go bindings.
# All downloaded files are cached in $TMPDIR for reuse with 'cached' below.
all: $(GENERATOR)
$(GENERATOR) -cache=false -install -api=*
# Reuse cached API specifications in $TMPDIR and rebuild Go bindings.
cached: $(GENERATOR)
$(GENERATOR) -cache=true -install -api=*
# Only rebuild Go bindings, do not modify API specifications.
# For every existing */*/*-api.json file, */*/*-gen.go will be built.
local: $(API_JSON:-api.json=-gen.go)
# Pattern rule for the 'local' target.
# Translates otherwise unnamed targets with a -gen.go suffix into the
# matching input file with a -api.json suffix. $< is the input file.
%-gen.go: %-api.json $(GENERATOR)
$(GENERATOR) -api_json_file=$<
# Alias to rebuild and install $(GENERATOR)
generator: $(GENERATOR)
# Marked as .PHONY so that make always invokes go build.
$(GENERATOR):
go build -o $@
.PHONY: all cached local generator $(GENERATOR)