Makefile 1.1 KB

123456789101112131415161718192021222324252627
  1. API_JSON = $(wildcard */*/*-api.json */*/*/*-api.json)
  2. # Download all API specifications and rebuild Go bindings.
  3. # All downloaded files are cached in $TMPDIR for reuse with 'cached' below.
  4. all: generator
  5. $(GOPATH)/bin/google-api-go-generator -cache=false -install -api=*
  6. # Reuse cached API specifications in $TMPDIR and rebuild Go bindings.
  7. cached: generator
  8. $(GOPATH)/bin/google-api-go-generator -cache=true -install -api=*
  9. # Only rebuild Go bindings, do not modify API specifications.
  10. # For every existing */*/*-api.json file, */*/*-gen.go will be built.
  11. local: $(API_JSON:-api.json=-gen.go)
  12. # Pattern rule for the 'local' target.
  13. # Translates otherwise unnamed targets with a -gen.go suffix into the
  14. # matching input file with a -api.json suffix. $< is the input file.
  15. %-gen.go: %-api.json generator
  16. $(GOPATH)/bin/google-api-go-generator -api_json_file=$<
  17. # Rebuild and install $(GOPATH)/bin/google-api-go-generator
  18. generator:
  19. go install google.golang.org/api/googleapi
  20. go install google.golang.org/api/google-api-go-generator
  21. .PHONY: all cached local generator