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 | 88270df | 2024-08-23 11:46:15 -0400 | [diff] [blame^] | 18 | $(if $(DEBUG),$(warning ENTER)) |
| 19 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 20 | .PHONY: test |
Joey Armstrong | 88270df | 2024-08-23 11:46:15 -0400 | [diff] [blame^] | 21 | .DEFAULT_GOAL := test |
| 22 | MAKECMDGOALS ?= test |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 23 | |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 24 | ##-------------------## |
| 25 | ##---] GLOBALS [---## |
| 26 | ##-------------------## |
Joey Armstrong | 88270df | 2024-08-23 11:46:15 -0400 | [diff] [blame^] | 27 | $(if $(findstring joey,$(USER)),\ |
| 28 | $(eval USE_LF_MK := 1)) # special snowflake |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 29 | |
Joey Armstrong | 88270df | 2024-08-23 11:46:15 -0400 | [diff] [blame^] | 30 | ##--------------------## |
| 31 | ##---] INCLUDES [---## |
| 32 | ##--------------------## |
| 33 | ifdef USE_LF_MK |
| 34 | include lf/include.mk |
| 35 | else |
| 36 | include lf/transition.mk |
| 37 | include $(legacy-mk)/include.mk |
| 38 | endif # ifdef USE_LF_MK |
| 39 | |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 40 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 41 | ##-------------------------- |
| 42 | ## Enable setup.py debugging |
| 43 | ##-------------------------- |
| 44 | # https://docs.python.org/3/distutils/setupscript.html#debugging-the-setup-script |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 45 | # export DISTUTILS_DEBUG := 1 # verbose: pip |
| 46 | export DOCKER_DEBUG := 1 # verbose: docker |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [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 | |
Joey Armstrong | 66bb4c4 | 2024-07-31 12:35:45 -0400 | [diff] [blame] | 76 | # ----------------------------------------------------------------------- |
| 77 | # Force pb file to be regenerated every time. Otherwise the make process |
| 78 | # assumes generated version is still valid. |
| 79 | # ----------------------------------------------------------------------- |
| 80 | # [TODO] |
| 81 | # - Revisit: fix target to be dependency driven. |
| 82 | # - When source not modified make "voltha.pb" behavior always a NOP |
| 83 | # ----------------------------------------------------------------------- |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 84 | .PHONY: voltha.pb |
Matt Jeanneret | 15249fa | 2019-04-12 20:25:31 -0400 | [diff] [blame] | 85 | |
Joey Armstrong | e0c1a8d | 2023-04-13 15:16:21 -0400 | [diff] [blame] | 86 | ##----------------## |
| 87 | ##---] DEPS [---## |
| 88 | ##----------------## |
| 89 | infra-deps := $(null) |
| 90 | infra-deps += Makefile |
| 91 | infra-deps += $(venv-activate-script) |
| 92 | |
| 93 | ## ----------------------------------------------------------------------- |
| 94 | ## ----------------------------------------------------------------------- |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 95 | print: |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 96 | @echo "Proto files: $(PROTO_FILES)" |
| 97 | @echo "Python PB2 files: $(PROTO_PYTHON_PB2)" |
| 98 | @echo "Go PB files: $(PROTO_GO_PB)" |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 99 | @echo "JAVA PB files: $(PROTO_JAVA_PB)" |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 100 | |
| 101 | # Generic targets |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 102 | protos: python-protos go-protos java-protos |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 103 | |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 104 | build: protos python-build go-protos java-protos |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 105 | |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 106 | test: python-test go-test java-test |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 107 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 108 | clean :: python-clean java-clean go-clean |
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 | sterile :: clean |
Joey Armstrong | c227765 | 2023-01-11 17:41:36 -0500 | [diff] [blame] | 111 | |
Joey Armstrong | e0c1a8d | 2023-04-13 15:16:21 -0400 | [diff] [blame] | 112 | ## ----------------------------------------------------------------------- |
| 113 | ## Python targets |
| 114 | ## ----------------------------------------------------------------------- |
| 115 | python-protos: $(infra-deps) $(PROTO_PYTHON_PB2) |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 116 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 117 | ## ----------------------------------------------------------------------- |
| 118 | ## ----------------------------------------------------------------------- |
| 119 | $(PROTO_PYTHON_DEST_DIR)/%_pb2.py: \ |
| 120 | protos/voltha_protos/%.proto \ |
| 121 | Makefile \ |
| 122 | $(venv-activate-script) |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 123 | |
| 124 | @echo |
| 125 | @echo "** -----------------------------------------------------------------------" |
| 126 | @echo "** $(MAKE): processing target [$@]" |
| 127 | @echo "** -----------------------------------------------------------------------" |
| 128 | |
| 129 | $(activate) && python -m grpc_tools.protoc \ |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 130 | -I protos \ |
| 131 | --python_out=python \ |
| 132 | --grpc_python_out=python \ |
| 133 | --descriptor_set_out=$(PROTO_PYTHON_DEST_DIR)/$(basename $(notdir $<)).desc \ |
| 134 | --include_imports \ |
| 135 | --include_source_info \ |
| 136 | $< |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 137 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 138 | ## ----------------------------------------------------------------------- |
| 139 | ## Intent: |
| 140 | ## ----------------------------------------------------------------------- |
| 141 | show: |
| 142 | $(call banner-enter,target $@) |
| 143 | @echo |
| 144 | $(call banner-leave,target $@) |
| 145 | |
| 146 | ## ----------------------------------------------------------------------- |
| 147 | ## Intent: |
| 148 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 149 | python-build: setup.py python-protos |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 150 | |
| 151 | $(call banner-enter,target $@) |
| 152 | |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 153 | $(RM) -r dist/ |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 154 | python ./setup.py sdist |
| 155 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 156 | $(call banner-leave,target $@) |
| 157 | |
| 158 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 159 | ## Intent: Invoke tox to install a python interpreter then run tests. |
| 160 | ## ----------------------------------------------------------------------- |
| 161 | ## See Also: |
| 162 | ## o https://tox.wiki/en/latest/cli_interface.html#tox-verbosity |
| 163 | ## every -v increases, every -q decreases verbosity level, |
| 164 | ## default WARNING (level:2) |
| 165 | ## map 0=CRITICAL|1=ERROR|2=WARNING|3=INFO|4=DEBUG|5=NOTSET |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 166 | ## ----------------------------------------------------------------------- |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 167 | python-test: tox.ini setup.py python-protos |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 168 | $(call banner-enter,target $@) |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 169 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 170 | $(activate) && python --version |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 171 | tox -vvv |
| 172 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 173 | $(call banner-leave,target $@) |
| 174 | |
| 175 | ## ----------------------------------------------------------------------- |
| 176 | ## Intent: |
| 177 | ## ----------------------------------------------------------------------- |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 178 | python-clean: |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 179 | find python -name '__pycache__' -type d -print0 \ |
| 180 | | xargs -0 --no-run-if-empty $(RM) -r |
Joey Armstrong | c227765 | 2023-01-11 17:41:36 -0500 | [diff] [blame] | 181 | find python -name '*.pyc' -type f -print0 \ |
| 182 | | xargs -0 --no-run-if-empty $(RM) |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 183 | $(RM) -r \ |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 184 | .coverage \ |
| 185 | .tox \ |
| 186 | coverage.xml \ |
| 187 | dist \ |
| 188 | nose2-results.xml \ |
| 189 | python/__pycache__ \ |
| 190 | python/test/__pycache__ \ |
| 191 | python/voltha_protos.egg-info \ |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 192 | "$(venv-abs-path)" \ |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 193 | $(PROTO_PYTHON_DEST_DIR)/*.desc \ |
| 194 | $(PROTO_PYTHON_PB2) \ |
| 195 | $(PROTO_PYTHON_PB2_GRPC) |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 196 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 197 | ## ----------------------------------------------------------------------- |
| 198 | ## Intent: Revert go to a clean state. |
| 199 | ## o TODO - go/ directory should not be placed under revision control. |
| 200 | ## o Build should retrieve versioned sources from a central repo. |
| 201 | ## ----------------------------------------------------------------------- |
khenaidoo | 5fc5cea | 2021-08-11 17:39:16 -0400 | [diff] [blame] | 202 | go-clean: |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 203 | $(RM) -r go/* |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 204 | $(HIDE)$(MAKE) repair |
| 205 | |
| 206 | ## ----------------------------------------------------------------------- |
| 207 | ## Intent: Recover from a fatal failed build state: |
| 208 | ## o build removes go/ while regenerating prototypes. |
| 209 | ## o chicken-n-egg: make becomes fatal when go/ is removed and proten fails. |
| 210 | ## ----------------------------------------------------------------------- |
| 211 | repair: |
| 212 | /usr/bin/env git checkout go |
| 213 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 214 | ## ----------------------------------------------------------------------- |
| 215 | ## Intent: Go targets |
| 216 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 217 | go-protos: voltha.pb |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 218 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 219 | $(call banner-enter,target $@) |
Joey Armstrong | 5008009 | 2023-07-06 15:18:37 -0400 | [diff] [blame] | 220 | @echo "** Creating *.go.pb files" |
Joey Armstrong | 1ff23e9 | 2023-07-13 16:24:32 -0400 | [diff] [blame] | 221 | |
Joey Armstrong | ba3d9d1 | 2024-01-15 14:22:11 -0500 | [diff] [blame] | 222 | $(if $(LOCAL_FIX_PERMS),chmod -R o+w $(PROTO_GO_DEST_DIR)) |
| 223 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 224 | ${PROTOC_SH} $(quote-double)\ |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 225 | set -e -o pipefail; \ |
| 226 | for x in ${PROTO_FILES}; do \ |
| 227 | echo \$$x; \ |
| 228 | protoc --go_out=plugins=grpc:/go/src -I protos \$$x; \ |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 229 | done\ |
| 230 | $(quote-double) |
| 231 | |
Joey Armstrong | ba3d9d1 | 2024-01-15 14:22:11 -0500 | [diff] [blame] | 232 | $(if $(LOCAL_FIX_PERMS),chmod -R o-w $(PROTO_GO_DEST_DIR)) |
| 233 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 234 | $(call banner-leave,target $@) |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 235 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 236 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 66bb4c4 | 2024-07-31 12:35:45 -0400 | [diff] [blame] | 237 | ## Intent: Regenerate voltha.pb |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 238 | ## ---------------------------------------------------------------------- |
Joey Armstrong | 66bb4c4 | 2024-07-31 12:35:45 -0400 | [diff] [blame] | 239 | voltha-pb += show-proto-files |
| 240 | voltha-pb += docker-debug-joey |
| 241 | |
| 242 | voltha.pb: $(voltha-pb) |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 243 | $(call banner-enter,target $@) |
| 244 | |
| 245 | ${PROTOC} \ |
| 246 | -I protos \ |
| 247 | -I protos/google/api \ |
| 248 | --include_imports \ |
| 249 | --include_source_info \ |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 250 | --descriptor_set_out=$@ \ |
| 251 | ${PROTO_FILES} |
Zack Williams | 43bfd9e | 2019-04-12 13:09:31 -0700 | [diff] [blame] | 252 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 253 | $(call banner-leave,target $@) |
| 254 | |
| 255 | ## ----------------------------------------------------------------------- |
| 256 | ## Intent: |
| 257 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 258 | go-test: |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 259 | $(call banner-enter,target $@) |
| 260 | |
William Kurkian | ad74565 | 2019-03-20 08:45:51 -0400 | [diff] [blame] | 261 | test/test-go-proto-consistency.sh |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 262 | ${GO} mod verify |
Zack Williams | 5220966 | 2019-02-07 10:15:31 -0700 | [diff] [blame] | 263 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 264 | $(call banner-leave,target $@) |
| 265 | |
| 266 | ## ----------------------------------------------------------------------- |
| 267 | ## Intent: Java targets |
| 268 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 269 | |
| 270 | java-protos-dirs += java_temp/src/main/java |
| 271 | java-protos-dirs += java_temp/src/main/java/org |
| 272 | # local docker problem |
| 273 | java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter |
| 274 | java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter_service |
| 275 | |
| 276 | mkdir-args += -vp |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 277 | |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 278 | java-protos: voltha.pb |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 279 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 280 | $(call banner-enter,target $@) |
| 281 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 282 | mkdir $(mkdir-args) $(java-protos-dirs) |
Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 283 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 284 | $(docker-sh) $(quote-double) find $(java-protos-dirs) -print0 \ |
| 285 | | xargs -0 -n1 /bin/ls -ld $(quote-double) |
| 286 | |
Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 287 | $(if $(LOCAL_FIX_PERMS),chmod -R o+w java_temp) |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 288 | @${PROTOC_SH} $(quote-double) \ |
Kent Hagerman | 868dc38 | 2020-01-20 11:24:09 -0500 | [diff] [blame] | 289 | set -e -o pipefail; \ |
| 290 | for x in ${PROTO_FILES}; do \ |
| 291 | echo \$$x; \ |
| 292 | protoc --java_out=java_temp/src/main/java -I protos \$$x; \ |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 293 | done\ |
| 294 | $(quote-double) |
Joey Armstrong | cb986bf | 2023-12-12 17:22:05 -0500 | [diff] [blame] | 295 | $(if $(LOCAL_FIX_PERMS),chmod -R o-w java_temp) |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 296 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 297 | # Move files into place after all prototypes have generated. |
| 298 | # TODO: Remove the extra step, use makefile deps and |
| 299 | # generate in-place as needed. |
| 300 | @mkdir -p java |
Joey Armstrong | 5008009 | 2023-07-06 15:18:37 -0400 | [diff] [blame] | 301 | rsync -r --checksum java_temp/src/main/java/. java/. |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 302 | |
| 303 | $(call banner-leave,target $@) |
| 304 | |
| 305 | ## ----------------------------------------------------------------------- |
| 306 | ## Intent: Tests if the generated java classes are compilable |
| 307 | ## ----------------------------------------------------------------------- |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 308 | java-test: java-protos |
| 309 | cp test/pom.xml java_temp |
| 310 | cd java_temp && mvn compile |
| 311 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 312 | ## ----------------------------------------------------------------------- |
| 313 | ## Intent: Custodial service |
| 314 | ## ----------------------------------------------------------------------- |
Serkant Uluderya | cbcfaa4 | 2019-10-18 13:25:08 +0300 | [diff] [blame] | 315 | java-clean: |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 316 | $(RM) -r java |
| 317 | $(RM) -r java_temp |
| 318 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 319 | ## ----------------------------------------------------------------------- |
| 320 | ## Intent: Placeholder for library targets |
| 321 | ## ----------------------------------------------------------------------- |
Joey Armstrong | e66eaaf | 2023-01-15 18:58:52 -0500 | [diff] [blame] | 322 | lint : |
| 323 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 324 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 5008009 | 2023-07-06 15:18:37 -0400 | [diff] [blame] | 325 | ## Intent: Make sterile is unrecoverable due to handling of java_temp |
| 326 | ## ----------------------------------------------------------------------- |
| 327 | protos-clean: |
| 328 | $(MAKE) sterile |
| 329 | $(MAKE) build |
| 330 | $(MAKE) protos |
| 331 | $(MAKE) test |
| 332 | |
| 333 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 334 | ## Intent: Display/debug targets |
| 335 | ## ----------------------------------------------------------------------- |
| 336 | .PHONY: show-proto-files |
| 337 | show-proto-files: |
Joey Armstrong | 1ff23e9 | 2023-07-13 16:24:32 -0400 | [diff] [blame] | 338 | |
| 339 | $(call banner-enter,Target $@) |
| 340 | @echo -e "PROTO_FILES:\n$(PROTO_FILES)" | tr ' ' '\n' |
| 341 | $(call banner-leave,Target $@) |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 342 | |
Joey Armstrong | 66bb4c4 | 2024-07-31 12:35:45 -0400 | [diff] [blame] | 343 | ## ----------------------------------------------------------------------- |
| 344 | ## Intent: Debug mode |
| 345 | ## - New image not logging ssh connections while job is running (?!?) |
| 346 | ## - We should be on label=voltha-1804-micro. |
| 347 | ## - Let(s) see what the reality is while checking configs. |
| 348 | ## ----------------------------------------------------------------------- |
| 349 | .PHONY: docker-debug-joey |
| 350 | docker-debug-joey: |
| 351 | |
| 352 | $(call banner-enter,Target $@) |
| 353 | ip --brief addr |
| 354 | $(call banner-leave,Target $@) |
| 355 | |
Joey Armstrong | e6cdd8e | 2022-12-29 11:58:15 -0500 | [diff] [blame] | 356 | # [EOF] |