Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2017 The LUCI Authors. | |
| 2 # | |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 # you may not use this file except in compliance with the License. | |
| 5 # You may obtain a copy of the License at | |
| 6 # | |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 # | |
| 9 # Unless required by applicable law or agreed to in writing, software | |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 # See the License for the specific language governing permissions and | |
| 13 # limitations under the License. | |
| 14 | |
| 15 # This Makefile (GNU) controls the construction and deployment of the | |
| 16 # "luci-logdog" application. This is a common Makefile, and is expected to be | |
| 17 # imported by an implementation-specific Makefile. The implementation-specific | |
| 18 # Makefile must supply the following variables: | |
| 19 # | |
| 20 # - CLOUD_PROJECT | |
| 21 # | |
| 22 # The Makefile may supply the following optional variables: | |
| 23 # - TAG: The AppEngine tag. If not specified, let "gae.py" choose a | |
| 24 # tag (default, important for production). | |
| 25 | |
| 26 .PHONY: default | |
| 27 default: help | |
| 28 | |
| 29 # Assert that all required variables are provided. | |
| 30 ifndef CLOUD_PROJECT | |
| 31 $(error Missing required variable: CLOUD_PROJECT) | |
| 32 endif | |
| 33 | |
| 34 # Determine "luci-go" repository paths. | |
| 35 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | |
| 36 APP_DIR := $(dir $(mkfile_path)) | |
| 37 LUCI_GO_DIR := $(abspath $(APP_DIR)/../../../..) | |
| 38 | |
| 39 # VPATH determines the relative paths of Makefile targets. We need to set it | |
| 40 # here, since we're expecting to be invoked from a Makefile in a different | |
| 41 # directory. This allows our relative paths to be resolved by `make`. | |
| 42 VPATH := $(APP_DIR) | |
| 43 | |
| 44 # If a tag was provided, add it to the "GAE_PY" args. | |
| 45 export LUCI_PY_USE_GCLOUD=1 | |
| 46 GAE_PY_EXTRA_ARGS = | |
| 47 ifdef TAG | |
| 48 GAE_PY_EXTRA_ARGS := $(GAE_PY_EXTRA_ARGS) -t $(TAG) | |
| 49 endif | |
| 50 | |
| 51 ALL_SERVICES = default services backend static | |
| 52 | |
| 53 help: | |
| 54 echo "Manage LogDog distributions." | |
| 55 echo "$(CURDIR) $(PWD)." | |
|
Ryan Tseng
2017/08/01 17:25:50
Whats this for?
dnj
2017/08/01 17:37:58
Debugging, made help a lot better.
| |
| 56 | |
| 57 .PHONY: yamls | |
| 58 yamls: vmuser/app.yaml vmuser/dispatch.yaml vmuser/index.yaml | |
|
Ryan Tseng
2017/08/01 17:25:50
What's this for? (I don't see the deps)
dnj
2017/08/01 17:37:58
This says that the "yamls" target depends on these
Ryan Tseng
2017/08/01 17:42:12
They always exist? (by virtue of being in the repo
| |
| 59 | |
| 60 .PHONY: web | |
| 61 web: | |
| 62 -rm -rf $(APP_DIR)static/dist | |
| 63 $(LUCI_GO_DIR)/web/web.py build \ | |
| 64 --build-dir $(APP_DIR)static \ | |
| 65 logdog-app \ | |
| 66 logdog-view \ | |
| 67 rpcexplorer | |
| 68 | |
| 69 # Default resources definition. | |
| 70 .PHONY: $(addsuffix -resources,$(ALL_SERVICES)) | |
| 71 $(addsuffix -resources,$(ALL_SERVICES)):: | |
| 72 | |
| 73 # The "static" module requires additional resources. | |
| 74 static-resources:: web | |
| 75 | |
| 76 ## | |
| 77 # Per-module Build Rules | |
| 78 # | |
| 79 # upload-<module>: Uploads the module, but doesn't set it to be default. | |
| 80 # deploy-<module>: Uploads the module and sets it to be default. | |
| 81 ## | |
| 82 | |
| 83 .PHONY: $(addprefix upload-,$(ALL_SERVICES)) | |
| 84 $(addprefix upload-,$(ALL_SERVICES)): upload-%: %-resources yamls | |
| 85 cd $(APP_DIR) && \ | |
| 86 gae.py upload \ | |
| 87 -A $(CLOUD_PROJECT) \ | |
| 88 $(GAE_PY_EXTRA_ARGS) \ | |
| 89 --force \ | |
| 90 $* | |
| 91 | |
| 92 .PHONY: upload | |
| 93 upload: $(addsuffix -resources,$(ALL_SERVICES)) | |
| 94 cd $(APP_DIR) && \ | |
| 95 gae.py upload \ | |
| 96 -A $(CLOUD_PROJECT) \ | |
| 97 $(GAE_PY_EXTRA_ARGS) \ | |
| 98 --force \ | |
| 99 $(ALL_SERVICES) | |
| 100 | |
| 101 .PHONY: $(addprefix deploy-,$(ALL_SERVICES)) | |
| 102 $(addprefix deploy-,$(ALL_SERVICES)): deploy-%: %-resources yamls | |
| 103 cd $(APP_DIR) && \ | |
| 104 gae.py upload \ | |
| 105 -A $(CLOUD_PROJECT) \ | |
| 106 $(GAE_PY_EXTRA_ARGS) \ | |
| 107 --force \ | |
| 108 --switch \ | |
| 109 $* | |
| 110 | |
| 111 .PHONY: deploy | |
| 112 deploy: $(addsuffix -resources,$(ALL_SERVICES)) | |
| 113 cd $(APP_DIR) && \ | |
| 114 gae.py upload \ | |
| 115 -A $(CLOUD_PROJECT) \ | |
| 116 $(GAE_PY_EXTRA_ARGS) \ | |
| 117 --force \ | |
| 118 --switch \ | |
| 119 $(ALL_SERVICES) | |
| OLD | NEW |