...
1# This Makefile is for library maintainers, not end-developers.
2# All the generated code is already checked in.
3
4API_JSON = $(wildcard ../*/*/*-api.json ../*/*/*/*-api.json)
5
6GENERATOR=./google-api-go-generator
7
8# Download all API specifications and rebuild Go bindings.
9# All downloaded files are cached in $TMPDIR for reuse with 'cached' below.
10all: SHELL:=/bin/bash
11all: $(GENERATOR)
12 $(GENERATOR) -cache=false -install -api=* -gendir=..
13 go test . -v
14
15# Reuse cached API specifications in $TMPDIR and rebuild Go bindings.
16cached: $(GENERATOR)
17 $(GENERATOR) -cache=true -install -api=* -gendir=..
18
19# Only rebuild Go bindings, do not modify API specifications.
20# For every existing */*/*-api.json file, */*/*-gen.go will be built.
21local: $(API_JSON:-api.json=-gen.go)
22
23# Pattern rule for the 'local' target.
24# Translates otherwise unnamed targets with a -gen.go suffix into the
25# matching input file with a -api.json suffix. $< is the input file.
26%-gen.go: %-api.json $(GENERATOR)
27 $(GENERATOR) -api_json_file=$< -output=$@
28
29# Alias to rebuild and install $(GENERATOR)
30generator: $(GENERATOR)
31
32# Marked as .PHONY so that make always invokes go build.
33$(GENERATOR):
34 go build -o $@
35
36.PHONY: all cached local generator $(GENERATOR)
View as plain text