You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.1 KiB

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