|
| 1 | +# It's necessary to set this because some environments don't link sh -> bash. |
| 2 | +SHELL := /bin/bash |
| 3 | + |
| 4 | +#----------------------------------------------------------------------------- |
| 5 | +# VERBOSE target |
| 6 | +#----------------------------------------------------------------------------- |
| 7 | + |
| 8 | +# When you run make VERBOSE=1 (the default), executed commands will be printed |
| 9 | +# before executed. If you run make VERBOSE=2 verbose flags are turned on and |
| 10 | +# quiet flags are turned off for various commands. Use V_FLAG in places where |
| 11 | +# you can toggle on/off verbosity using -v. Use Q_FLAG in places where you can |
| 12 | +# toggle on/off quiet mode using -q. Use S_FLAG where you want to toggle on/off |
| 13 | +# silence mode using -s... |
| 14 | +VERBOSE ?= 1 |
| 15 | +Q = @ |
| 16 | +Q_FLAG = -q |
| 17 | +QUIET_FLAG = --quiet |
| 18 | +V_FLAG = |
| 19 | +VERBOSE_FLAG = |
| 20 | +S_FLAG = -s |
| 21 | +X_FLAG = |
| 22 | +ifeq ($(VERBOSE),1) |
| 23 | + Q = |
| 24 | +endif |
| 25 | +ifeq ($(VERBOSE),2) |
| 26 | + Q = |
| 27 | + Q_FLAG = |
| 28 | + QUIET_FLAG = |
| 29 | + S_FLAG = |
| 30 | + V_FLAG = -v |
| 31 | + VERBOSE_FLAG = --verbose |
| 32 | + X_FLAG = -x |
| 33 | +endif |
| 34 | + |
| 35 | +#----------------------------------------------------------------------------- |
| 36 | +# Examples Commons |
| 37 | +#----------------------------------------------------------------------------- |
| 38 | +EC=$(SHELL) -c '. ../../hack/examples-commons.sh && $$1' EC |
| 39 | + |
| 40 | +export HACK_YAMLS=../../hack/yamls |
| 41 | + |
| 42 | +## -- Commmon Utility targets -- |
| 43 | + |
| 44 | +## Print help message for all Makefile targets |
| 45 | +## Run `make` or `make help` to see the help |
| 46 | +.PHONY: help |
| 47 | +help: ## Credit: https://gist.github.com/prwhite/8168133#gistcomment-2749866 |
| 48 | + |
| 49 | + @printf "Usage:\n make <target>"; |
| 50 | + |
| 51 | + @awk '{ \ |
| 52 | + if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \ |
| 53 | + helpCommand = substr($$0, index($$0, ":") + 2); \ |
| 54 | + if (helpMessage) { \ |
| 55 | + printf "\033[36m%-20s\033[0m %s\n", \ |
| 56 | + helpCommand, helpMessage; \ |
| 57 | + helpMessage = ""; \ |
| 58 | + } \ |
| 59 | + } else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \ |
| 60 | + helpCommand = substr($$0, 0, index($$0, ":")); \ |
| 61 | + if (helpMessage) { \ |
| 62 | + printf "\033[36m%-20s\033[0m %s\n", \ |
| 63 | + helpCommand, helpMessage; \ |
| 64 | + helpMessage = ""; \ |
| 65 | + } \ |
| 66 | + } else if ($$0 ~ /^##/) { \ |
| 67 | + if (helpMessage) { \ |
| 68 | + helpMessage = helpMessage"\n "substr($$0, 3); \ |
| 69 | + } else { \ |
| 70 | + helpMessage = substr($$0, 3); \ |
| 71 | + } \ |
| 72 | + } else { \ |
| 73 | + if (helpMessage) { \ |
| 74 | + print "\n "helpMessage"\n" \ |
| 75 | + } \ |
| 76 | + helpMessage = ""; \ |
| 77 | + } \ |
| 78 | + }' \ |
| 79 | + $(MAKEFILE_LIST) |
| 80 | + |
| 81 | +## -- Common Cluster Admin Targets -- |
| 82 | + |
| 83 | +# === Service Bidining Operator === |
| 84 | + |
| 85 | +.PHONY: install-service-binding-operator-source |
| 86 | +## Install the Service Binding Operator Source |
| 87 | +install-service-binding-operator-source: |
| 88 | + ${Q}${EC} install_service_binding_operator_source |
| 89 | + |
| 90 | +.PHONY: install-service-binding-operator-subscription |
| 91 | +## Install the Service Binding Operator Subscription |
| 92 | +install-service-binding-operator-subscription: |
| 93 | + ${Q}${EC} install_service_binding_operator_subscription |
| 94 | + |
| 95 | +.PHONY: install-service-binding-operator |
| 96 | +## Install the Service Binding Operator |
| 97 | +install-service-binding-operator: install-service-binding-operator-source install-service-binding-operator-subscription |
| 98 | + |
| 99 | +.PHONY: uninstall-service-binding-operator-source |
| 100 | +## Uninstall the Service Binding Operator Source |
| 101 | +uninstall-service-binding-operator-source: |
| 102 | + ${Q}${EC} uninstall_service_binding_operator_source |
| 103 | + |
| 104 | +.PHONY: uninstall-service-binding-operator-subscription |
| 105 | +## Uninstall the Service Binding Operator Subscription |
| 106 | +uninstall-service-binding-operator-subscription: |
| 107 | + ${Q}${EC} uninstall_service_binding_operator_subscription |
| 108 | + |
| 109 | +.PHONY: uninstall-service-binding-operator |
| 110 | +## Uninstall the Service Binding Operator |
| 111 | +uninstall-service-binding-operator: uninstall-service-binding-operator-source uninstall-service-binding-operator-subscription |
| 112 | + |
| 113 | +# === Backing Service DB (PostgreSQL) Operator === |
| 114 | + |
| 115 | +.PHONY: install-backing-db-operator-source |
| 116 | +## Install the Backing Service DB Operator Source |
| 117 | +install-backing-db-operator-source: |
| 118 | + ${Q}${EC} install_postgresql_operator_source |
| 119 | + |
| 120 | +.PHONY: install-backing-db-operator-subscription |
| 121 | +## Install the Backing Service DB Operator Subscription |
| 122 | +install-backing-db-operator-subscription: |
| 123 | + ${Q}${EC} install_postgresql_operator_subscription |
| 124 | + |
| 125 | +.PHONY: install-backing-db-operator |
| 126 | +## Install the Backing Service DB Operator |
| 127 | +install-backing-db-operator: install-backing-db-operator-source install-backing-db-operator-subscription |
| 128 | + |
| 129 | +.PHONY: uninstall-backing-db-operator-source |
| 130 | +## Uninstall the Backing Service DB Operator Source |
| 131 | +uninstall-backing-db-operator-source: |
| 132 | + ${Q}${EC} uninstall_postgresql_operator_source |
| 133 | + |
| 134 | +.PHONY: uninstall-backing-db-operator-subscription |
| 135 | +## Uninstall the Backing Service DB Operator Subscription |
| 136 | +uninstall-backing-db-operator-subscription: |
| 137 | + ${Q}${EC} uninstall_postgresql_operator_subscription |
| 138 | + |
| 139 | +.PHONY: uninstall-backing-db-operator |
| 140 | +## Uninstall the Backing Service DB Operator |
| 141 | +uninstall-backing-db-operator: uninstall-backing-db-operator-source uninstall-backing-db-operator-subscription |
| 142 | + |
| 143 | +# === Serverless Operator === |
| 144 | + |
| 145 | +.PHONY: install-serverless-operator-source |
| 146 | +## Install the Serverless Operator Source |
| 147 | +install-serverless-operator-source: |
| 148 | + ${Q}${EC} install_postgresql_operator_source |
| 149 | + |
| 150 | +.PHONY: install-serverless-operator-subscription |
| 151 | +## Install the Serverless Operator Subscription |
| 152 | +install-serverless-operator-subscription: |
| 153 | + ${Q}${EC} install_postgresql_operator_subscription |
| 154 | + |
| 155 | +.PHONY: install-serverless-operator |
| 156 | +## Install the Serverless Operator |
| 157 | +install-serverless-operator: install-serverless-operator-source install-serverless-operator-subscription |
| 158 | + |
| 159 | +.PHONY: uninstall-serverless-operator-source |
| 160 | +## Uninstall the Serverless Operator Source |
| 161 | +uninstall-serverless-operator-source: |
| 162 | + ${Q}${EC} uninstall_postgresql_operator_source |
| 163 | + |
| 164 | +.PHONY: uninstall-serverless-operator-subscription |
| 165 | +## Uninstall the Serverless Operator Subscription |
| 166 | +uninstall-serverless-operator-subscription: |
| 167 | + ${Q}${EC} uninstall_postgresql_operator_subscription |
| 168 | + |
| 169 | +.PHONY: uninstall-serverless-operator |
| 170 | +## Uninstall the Serverless Operator |
| 171 | +uninstall-serverless-operator: uninstall-serverless-operator-source uninstall-serverless-operator-subscription |
| 172 | + |
| 173 | +# === Service Mesh Operator === |
| 174 | + |
| 175 | +.PHONY: install-service-mesh-operator-source |
| 176 | +## Install the Service Mesh Operator Source |
| 177 | +install-service-mesh-operator-source: |
| 178 | + ${Q}${EC} install_postgresql_operator_source |
| 179 | + |
| 180 | +.PHONY: install-service-mesh-operator-subscription |
| 181 | +## Install the Service Mesh Operator Subscription |
| 182 | +install-service-mesh-operator-subscription: |
| 183 | + ${Q}${EC} install_postgresql_operator_subscription |
| 184 | + |
| 185 | +.PHONY: install-service-mesh-operator |
| 186 | +## Install the Service Mesh Operator |
| 187 | +install-service-mesh-operator: install-service-mesh-operator-source install-service-mesh-operator-subscription |
| 188 | + |
| 189 | +.PHONY: uninstall-service-mesh-operator-source |
| 190 | +## Uninstall the Service Mesh Operator Source |
| 191 | +uninstall-service-mesh-operator-source: |
| 192 | + ${Q}${EC} uninstall_postgresql_operator_source |
| 193 | + |
| 194 | +.PHONY: uninstall-service-mesh-operator-subscription |
| 195 | +## Uninstall the Service Mesh Operator Subscription |
| 196 | +uninstall-service-mesh-operator-subscription: |
| 197 | + ${Q}${EC} uninstall_postgresql_operator_subscription |
| 198 | + |
| 199 | +.PHONY: uninstall-service-mesh-operator |
| 200 | +## Uninstall the Service Mesh Operator |
| 201 | +uninstall-service-mesh-operator: uninstall-service-mesh-operator-source uninstall-service-mesh-operator-subscription |
| 202 | + |
| 203 | +# === Knative Serving (Serverless UI) === |
| 204 | + |
| 205 | +.PHONY: install-knative-serving |
| 206 | +## Install Knative Serving |
| 207 | +install-knative-serving: |
| 208 | + ${Q}${EC} install_knative_serving |
| 209 | + |
| 210 | +.PHONY: uninstall-knative-serving |
| 211 | +## Uninstall Knative Serving |
| 212 | +uninstall-knative-serving: |
| 213 | + ${Q}-${EC} uninstall_knative_serving |
| 214 | + |
| 215 | +# === Quarkus Native S2i Buider Image === |
| 216 | + |
| 217 | +.PHONY: install-quarkus-native-s2i-builder |
| 218 | +## Install ubi-quarkus-native-s2i builder |
| 219 | +install-quarkus-native-s2i-builder: |
| 220 | + ${Q}${EC} install_ubi_quarkus_native_s2i_builder_image |
| 221 | + |
| 222 | +## -- Common Application Developer Targets -- |
| 223 | + |
| 224 | +.PHONY: create-project |
| 225 | +## Create the OpenShift project/namespace |
| 226 | +create-project: |
| 227 | + ${Q}-${EC} create_project |
| 228 | + |
| 229 | +.PHONY: delete-project |
| 230 | +## Delete the OpenShift project/namespace |
| 231 | +delete-project: |
| 232 | + ${Q}${EC} delete_project |
| 233 | + |
| 234 | +.PHONY: create-backing-db-instance |
| 235 | +## Create the Backing Service DB Operator |
| 236 | +create-backing-db-instance: |
| 237 | + ${Q}${EC} install_postgresql_db_instance |
0 commit comments