File: Makefile

package info (click to toggle)
golang-google-api 0.61.0-6
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 209,156 kB
  • sloc: sh: 183; makefile: 22; python: 4
file content (37 lines) | stat: -rw-r--r-- 1,269 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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: SHELL:=/bin/bash
all: $(GENERATOR)
	cd ../internal/version; go generate
	$(GENERATOR) -cache=false -install -api=* -gendir=..
	go test . -v

# Reuse cached API specifications in $TMPDIR and rebuild Go bindings.
cached: $(GENERATOR)
	$(GENERATOR) -cache=true -install -api=* -gendir=..

# 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=$< -output=$@

# 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)