google-api-go-generator: move Makefile up from root

Having Makefile at root has caused some confusion, see this thread:
https://twitter.com/_zombiezen_/status/898027880101232642

Change-Id: I4f862cbc30b89840562d0145b2e6740fafd014e8
Reviewed-on: https://code-review.googlesource.com/15932
Reviewed-by: JBD <jbd@google.com>
diff --git a/.gitignore b/.gitignore
index 9dbf1b6..50d2a9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@
 *_testmain.go
 clientid.dat
 clientsecret.dat
-/google-api-go-generator/google-api-go-gen
+/google-api-go-generator/google-api-go-generator
 
 *.6
 *.8
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 0d841b1..0000000
--- a/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-API_JSON = $(wildcard */*/*-api.json */*/*/*-api.json)
-
-# Download all API specifications and rebuild Go bindings.
-# All downloaded files are cached in $TMPDIR for reuse with 'cached' below.
-all: generator
-	$(GOPATH)/bin/google-api-go-generator -cache=false -install -api=*
-
-# Reuse cached API specifications in $TMPDIR and rebuild Go bindings.
-cached: generator
-	$(GOPATH)/bin/google-api-go-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
-	$(GOPATH)/bin/google-api-go-generator -api_json_file=$<
-
-# Rebuild and install $(GOPATH)/bin/google-api-go-generator
-generator:
-	go install google.golang.org/api/googleapi
-	go install google.golang.org/api/google-api-go-generator
-
-.PHONY: all cached local generator
diff --git a/google-api-go-generator/Makefile b/google-api-go-generator/Makefile
new file mode 100644
index 0000000..a85d523
--- /dev/null
+++ b/google-api-go-generator/Makefile
@@ -0,0 +1,34 @@
+# 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)