Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 3 | # Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 16 | # ----------------------------------------------------------------------- |
| 17 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 18 | .PHONY: test |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 19 | .DEFAULT_GOAL := test |
| 20 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 21 | ##-------------------## |
| 22 | ##---] GLOBALS [---## |
| 23 | ##-------------------## |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 24 | TOP ?= . |
| 25 | MAKEDIR ?= $(TOP)/makefiles |
| 26 | |
| 27 | $(if $(VERBOSE),$(eval export VERBOSE=$(VERBOSE))) # visible to include(s) |
| 28 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 29 | ##-------------------------- |
| 30 | ## Enable setup.py debugging |
| 31 | ##-------------------------- |
| 32 | # https://docs.python.org/3/distutils/setupscript.html#debugging-the-setup-script |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 33 | # export DISTUTILS_DEBUG := 1 # verbose: pip |
| 34 | export DOCKER_DEBUG := 1 # verbose: docker |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 35 | |
Joey Armstrong | c227765 | 2023-01-11 17:41:36 -0500 | [diff] [blame] | 36 | # Makefile for voltha-protos |
| 37 | default: test |
| 38 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 39 | ## Library linting |
| 40 | # NO-LINT-MAKEFILE := true # cleanup needed |
| 41 | NO-LINT-SHELL := true # cleanup needed |
| 42 | |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 43 | ##--------------------## |
| 44 | ##---] INCLUDES [---## |
| 45 | ##--------------------## |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 46 | include $(MAKEDIR)/include.mk |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 47 | |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 48 | # Function to extract the last path component from go_package line in .proto files |
| 49 | define go_package_path |
| 50 | $(shell grep go_package $(1) | sed -n 's/.*\/\(.*\)";/\1/p') |
| 51 | endef |
| 52 | |
Joey Armstrong | e05f649 | 2023-05-31 11:27:31 -0400 | [diff] [blame] | 53 | # ----------------------------------------------------------------------- |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 54 | # Function to extract the last path component from package line in .proto files |
Joey Armstrong | e05f649 | 2023-05-31 11:27:31 -0400 | [diff] [blame] | 55 | # % grep 'package' will match: |
| 56 | # o package <name> ; |
| 57 | # o option java_package='<dot-pkg-fqdn> |
| 58 | # ----------------------------------------------------------------------- |
| 59 | # RETURN: protos/voltha_protos/common.proto => common |
| 60 | # ----------------------------------------------------------------------- |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 61 | define java_package_path |
| 62 | $(shell grep package $(1) | sed -n 's/.*\/\(.*\)";/\1/p') |
| 63 | endef |
| 64 | |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 65 | # Variables |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 66 | PROTO_FILES := $(sort $(wildcard protos/voltha_protos/*.proto)) |
| 67 | |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 68 | PROTO_PYTHON_DEST_DIR := python/voltha_protos |
| 69 | PROTO_PYTHON_PB2 := $(foreach f, $(PROTO_FILES), $(patsubst protos/voltha_protos/%.proto,$(PROTO_PYTHON_DEST_DIR)/%_pb2.py,$(f))) |
Matt Jeanneret | 37e0fc6 | 2019-03-07 12:33:21 -0500 | [diff] [blame] | 70 | PROTO_PYTHON_PB2_GRPC := $(foreach f, $(PROTO_FILES), $(patsubst protos/voltha_protos/%.proto,$(PROTO_PYTHON_DEST_DIR)/%_pb2_grpc.py,$(f))) |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 71 | PROTO_GO_DEST_DIR := go |
| 72 | PROTO_GO_PB:= $(foreach f, $(PROTO_FILES), $(patsubst protos/voltha_protos/%.proto,$(PROTO_GO_DEST_DIR)/$(call go_package_path,$(f))/%.pb.go,$(f))) |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 73 | PROTO_JAVA_DEST_DIR := java |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 74 | PROTO_JAVA_PB := $(foreach f, $(PROTO_FILES), $(patsubst protos/voltha_protos/%.proto,$(PROTO_JAVA_DEST_DIR)/$(call java_package_path,$(f))/%.pb.java,$(f))) |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 75 | |
Zack Williams | 25e0a32 | 2019-06-07 14:07:21 -0700 | [diff] [blame] | 76 | # Force pb file to be regenrated every time. Otherwise the make process assumes generated version is still valid |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 77 | .PHONY: voltha.pb |
Matt Jeanneret | 15249fa | 2019-04-12 20:25:31 -0400 | [diff] [blame] | 78 | |
Joey Armstrong | e0c1a8d | 2023-04-13 15:16:21 -0400 | [diff] [blame] | 79 | ##----------------## |
| 80 | ##---] DEPS [---## |
| 81 | ##----------------## |
| 82 | infra-deps := $(null) |
| 83 | infra-deps += Makefile |
| 84 | infra-deps += $(venv-activate-script) |
| 85 | |
| 86 | ## ----------------------------------------------------------------------- |
| 87 | ## ----------------------------------------------------------------------- |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 88 | print: |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 89 | @echo "Proto files: $(PROTO_FILES)" |
| 90 | @echo "Python PB2 files: $(PROTO_PYTHON_PB2)" |
| 91 | @echo "Go PB files: $(PROTO_GO_PB)" |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 92 | @echo "JAVA PB files: $(PROTO_JAVA_PB)" |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 93 | |
| 94 | # Generic targets |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 95 | protos: python-protos go-protos java-protos |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 96 | |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 97 | build: protos python-build go-protos java-protos |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 98 | |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 99 | test: python-test go-test java-test |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 100 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 101 | clean :: python-clean java-clean go-clean |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 102 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 103 | sterile :: clean |
Joey Armstrong | c227765 | 2023-01-11 17:41:36 -0500 | [diff] [blame] | 104 | |
Joey Armstrong | e0c1a8d | 2023-04-13 15:16:21 -0400 | [diff] [blame] | 105 | ## ----------------------------------------------------------------------- |
| 106 | ## Python targets |
| 107 | ## ----------------------------------------------------------------------- |
| 108 | python-protos: $(infra-deps) $(PROTO_PYTHON_PB2) |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 109 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 110 | ## ----------------------------------------------------------------------- |
| 111 | ## ----------------------------------------------------------------------- |
| 112 | $(PROTO_PYTHON_DEST_DIR)/%_pb2.py: \ |
| 113 | protos/voltha_protos/%.proto \ |
| 114 | Makefile \ |
| 115 | $(venv-activate-script) |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 116 | |
| 117 | @echo |
| 118 | @echo "** -----------------------------------------------------------------------" |
| 119 | @echo "** $(MAKE): processing target [$@]" |
| 120 | @echo "** -----------------------------------------------------------------------" |
| 121 | |
| 122 | $(activate) && python -m grpc_tools.protoc \ |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 123 | -I protos \ |
| 124 | --python_out=python \ |
| 125 | --grpc_python_out=python \ |
| 126 | --descriptor_set_out=$(PROTO_PYTHON_DEST_DIR)/$(basename $(notdir $<)).desc \ |
| 127 | --include_imports \ |
| 128 | --include_source_info \ |
| 129 | $< |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 130 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 131 | ## ----------------------------------------------------------------------- |
| 132 | ## Intent: |
| 133 | ## ----------------------------------------------------------------------- |
| 134 | show: |
| 135 | $(call banner-enter,target $@) |
| 136 | @echo |
| 137 | $(call banner-leave,target $@) |
| 138 | |
| 139 | ## ----------------------------------------------------------------------- |
| 140 | ## Intent: |
| 141 | ## ----------------------------------------------------------------------- |
| 142 | python-build: setup.py python-protos |
| 143 | |
| 144 | $(call banner-enter,target $@) |
| 145 | |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 146 | $(RM) -r dist/ |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 147 | python ./setup.py sdist |
| 148 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 149 | $(call banner-leave,target $@) |
| 150 | |
| 151 | ## ----------------------------------------------------------------------- |
| 152 | ## Intent: |
| 153 | ## ----------------------------------------------------------------------- |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 154 | python-test: tox.ini setup.py python-protos |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 155 | $(call banner-enter,target $@) |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 156 | $(activate) && python --version |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 157 | tox |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 158 | $(call banner-leave,target $@) |
| 159 | |
| 160 | ## ----------------------------------------------------------------------- |
| 161 | ## Intent: |
| 162 | ## ----------------------------------------------------------------------- |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 163 | python-clean: |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 164 | find python -name '__pycache__' -type d -print0 \ |
| 165 | | xargs -0 --no-run-if-empty $(RM) -r |
Joey Armstrong | c227765 | 2023-01-11 17:41:36 -0500 | [diff] [blame] | 166 | find python -name '*.pyc' -type f -print0 \ |
| 167 | | xargs -0 --no-run-if-empty $(RM) |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 168 | $(RM) -r \ |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 169 | .coverage \ |
| 170 | .tox \ |
| 171 | coverage.xml \ |
| 172 | dist \ |
| 173 | nose2-results.xml \ |
| 174 | python/__pycache__ \ |
| 175 | python/test/__pycache__ \ |
| 176 | python/voltha_protos.egg-info \ |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 177 | "$(venv-abs-path)" \ |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 178 | $(PROTO_PYTHON_DEST_DIR)/*.desc \ |
| 179 | $(PROTO_PYTHON_PB2) \ |
| 180 | $(PROTO_PYTHON_PB2_GRPC) |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 181 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 182 | ## ----------------------------------------------------------------------- |
| 183 | ## Intent: Revert go to a clean state. |
| 184 | ## o TODO - go/ directory should not be placed under revision control. |
| 185 | ## o Build should retrieve versioned sources from a central repo. |
| 186 | ## ----------------------------------------------------------------------- |
khenaidoo | 5fc5cea | 2021-08-11 17:39:16 -0400 | [diff] [blame] | 187 | go-clean: |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 188 | $(RM) -r go/* |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 189 | $(HIDE)$(MAKE) repair |
| 190 | |
| 191 | ## ----------------------------------------------------------------------- |
| 192 | ## Intent: Recover from a fatal failed build state: |
| 193 | ## o build removes go/ while regenerating prototypes. |
| 194 | ## o chicken-n-egg: make becomes fatal when go/ is removed and proten fails. |
| 195 | ## ----------------------------------------------------------------------- |
| 196 | repair: |
| 197 | /usr/bin/env git checkout go |
| 198 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 199 | ## ----------------------------------------------------------------------- |
| 200 | ## Intent: Go targets |
| 201 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 202 | go-protos: voltha.pb |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 203 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 204 | $(call banner-enter,target $@) |
Joey Armstrong | 5008009 | 2023-07-06 15:18:37 -0400 | [diff] [blame] | 205 | @echo "** Creating *.go.pb files" |
Joey Armstrong | 1ff23e9 | 2023-07-13 16:24:32 -0400 | [diff] [blame] | 206 | |
Joey Armstrong | ba3d9d1 | 2024-01-15 14:22:11 -0500 | [diff] [blame^] | 207 | $(if $(LOCAL_FIX_PERMS),chmod -R o+w $(PROTO_GO_DEST_DIR)) |
| 208 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 209 | ${PROTOC_SH} $(quote-double)\ |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 210 | set -e -o pipefail; \ |
| 211 | for x in ${PROTO_FILES}; do \ |
| 212 | echo \$$x; \ |
| 213 | protoc --go_out=plugins=grpc:/go/src -I protos \$$x; \ |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 214 | done\ |
| 215 | $(quote-double) |
| 216 | |
Joey Armstrong | ba3d9d1 | 2024-01-15 14:22:11 -0500 | [diff] [blame^] | 217 | $(if $(LOCAL_FIX_PERMS),chmod -R o-w $(PROTO_GO_DEST_DIR)) |
| 218 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 219 | $(call banner-leave,target $@) |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 220 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 221 | ## ----------------------------------------------------------------------- |
| 222 | ## Intent: |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 223 | ## ---------------------------------------------------------------------- |
| 224 | voltha.pb: show-proto-files |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 225 | $(call banner-enter,target $@) |
| 226 | |
| 227 | ${PROTOC} \ |
| 228 | -I protos \ |
| 229 | -I protos/google/api \ |
| 230 | --include_imports \ |
| 231 | --include_source_info \ |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 232 | --descriptor_set_out=$@ \ |
| 233 | ${PROTO_FILES} |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 234 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 235 | $(call banner-leave,target $@) |
| 236 | |
| 237 | ## ----------------------------------------------------------------------- |
| 238 | ## Intent: |
| 239 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 240 | go-test: |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 241 | $(call banner-enter,target $@) |
| 242 | |
William Kurkian | ad74565 | 2019-03-20 08:45:51 -0400 | [diff] [blame] | 243 | test/test-go-proto-consistency.sh |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 244 | ${GO} mod verify |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 245 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 246 | $(call banner-leave,target $@) |
| 247 | |
| 248 | ## ----------------------------------------------------------------------- |
| 249 | ## Intent: Java targets |
| 250 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 251 | |
| 252 | java-protos-dirs += java_temp/src/main/java |
| 253 | java-protos-dirs += java_temp/src/main/java/org |
| 254 | # local docker problem |
| 255 | java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter |
| 256 | java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter_service |
| 257 | |
| 258 | mkdir-args += -vp |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 259 | |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 260 | java-protos: voltha.pb |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 261 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 262 | $(call banner-enter,target $@) |
| 263 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 264 | mkdir $(mkdir-args) $(java-protos-dirs) |
Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 265 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 266 | $(docker-sh) $(quote-double) find $(java-protos-dirs) -print0 \ |
| 267 | | xargs -0 -n1 /bin/ls -ld $(quote-double) |
| 268 | |
Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 269 | $(if $(LOCAL_FIX_PERMS),chmod -R o+w java_temp) |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 270 | @${PROTOC_SH} $(quote-double) \ |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 271 | set -e -o pipefail; \ |
| 272 | for x in ${PROTO_FILES}; do \ |
| 273 | echo \$$x; \ |
| 274 | protoc --java_out=java_temp/src/main/java -I protos \$$x; \ |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 275 | done\ |
| 276 | $(quote-double) |
Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 277 | $(if $(LOCAL_FIX_PERMS),chmod -R o-w java_temp) |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 278 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 279 | # Move files into place after all prototypes have generated. |
| 280 | # TODO: Remove the extra step, use makefile deps and |
| 281 | # generate in-place as needed. |
| 282 | @mkdir -p java |
Joey Armstrong | 5008009 | 2023-07-06 15:18:37 -0400 | [diff] [blame] | 283 | rsync -r --checksum java_temp/src/main/java/. java/. |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 284 | |
| 285 | $(call banner-leave,target $@) |
| 286 | |
| 287 | ## ----------------------------------------------------------------------- |
| 288 | ## Intent: Tests if the generated java classes are compilable |
| 289 | ## ----------------------------------------------------------------------- |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 290 | java-test: java-protos |
| 291 | cp test/pom.xml java_temp |
| 292 | cd java_temp && mvn compile |
| 293 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 294 | ## ----------------------------------------------------------------------- |
| 295 | ## Intent: Custodial service |
| 296 | ## ----------------------------------------------------------------------- |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 297 | java-clean: |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 298 | $(RM) -r java |
| 299 | $(RM) -r java_temp |
| 300 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 301 | ## ----------------------------------------------------------------------- |
| 302 | ## Intent: Placeholder for library targets |
| 303 | ## ----------------------------------------------------------------------- |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 304 | lint : |
| 305 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 306 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 5008009 | 2023-07-06 15:18:37 -0400 | [diff] [blame] | 307 | ## Intent: Make sterile is unrecoverable due to handling of java_temp |
| 308 | ## ----------------------------------------------------------------------- |
| 309 | protos-clean: |
| 310 | $(MAKE) sterile |
| 311 | $(MAKE) build |
| 312 | $(MAKE) protos |
| 313 | $(MAKE) test |
| 314 | |
| 315 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 316 | ## Intent: Display/debug targets |
| 317 | ## ----------------------------------------------------------------------- |
| 318 | .PHONY: show-proto-files |
| 319 | show-proto-files: |
Joey Armstrong | 1ff23e9 | 2023-07-13 16:24:32 -0400 | [diff] [blame] | 320 | |
| 321 | $(call banner-enter,Target $@) |
| 322 | @echo -e "PROTO_FILES:\n$(PROTO_FILES)" | tr ' ' '\n' |
| 323 | $(call banner-leave,Target $@) |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 324 | |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 325 | # [EOF] |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 326 | |