Joey Armstrong | a3d896a | 2023-02-17 08:33:46 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | ## ----------------------------------------------------------------------- |
| 3 | ## Intent: Generate an RST formatted table with URLs given a list of |
| 4 | ## voltha resource names. |
| 5 | ## ----------------------------------------------------------------------- |
| 6 | ## .. list-table:: VOLTHA Docker Images |
| 7 | ## :widths: 20, 5, 40 |
| 8 | ## :header-rows: 1 |
| 9 | ## |
| 10 | ## * - Image |
| 11 | ## - Date |
| 12 | ## - Description |
| 13 | # * - `voltha/voltha-envoy <https://hub.docker.com/r/voltha/voltha-envoy>`_ |
| 14 | ## ----------------------------------------------------------------------- |
| 15 | |
| 16 | ##-------------------## |
| 17 | ##---] GLOBALS [---## |
| 18 | ##-------------------## |
| 19 | HIDE ?= @ |
| 20 | |
| 21 | ## ------------------------------------------------------------------------ |
| 22 | ## Intent: Generate a stream of tokens: |
| 23 | ## o slurp file |
| 24 | ## o remove comments and blank lines |
| 25 | ## ------------------------------------------------------------------------ |
| 26 | format-list = cat "$1" \ |
| 27 | | cut -d'\#' -f1 \ |
| 28 | | grep '[[:alnum:]]' |
| 29 | |
| 30 | ##-------------------## |
| 31 | ##---] TARGETS [---## |
| 32 | ##-------------------## |
| 33 | all: |
| 34 | |
| 35 | ## ----------------------------------------------------------------------- |
| 36 | ## Intent: Invoke all named generate table targets |
| 37 | ## ----------------------------------------------------------------------- |
| 38 | gen-all += docker-gen |
| 39 | gen-all += gerrit-gen |
| 40 | gen-all += github-gen |
| 41 | gen-all : $(gen-all) |
| 42 | |
| 43 | ## ----------------------------------------------------------------------- |
| 44 | ## Intent: Generate an rst table for VOLTHA docker images. |
| 45 | ## ----------------------------------------------------------------------- |
| 46 | docker-src := sources/voltha.docker |
| 47 | docker-url := https://hub.docker.com/r/voltha/{} |
| 48 | docker-gen: |
| 49 | $(HIDE)$(call format-list,$(docker-src)) \ |
| 50 | | xargs -I'{}' echo -e ' * - `{} <$(docker-url)>\n -`_' \ |
| 51 | | tee $@.log |
| 52 | |
| 53 | ## ----------------------------------------------------------------------- |
| 54 | ## Intent: Generate an rst table for VOLTHA gerrit repositories |
| 55 | ## ----------------------------------------------------------------------- |
| 56 | gerrit-src := sources/voltha.gerrit |
| 57 | gerrit-url := https://gerrit.opencord.org/plugins/gitiles/{} |
| 58 | gerrit-gen: |
| 59 | $(HIDE)$(call format-list,$(gerrit-src)) \ |
| 60 | | xargs -I'{}' echo -e ' * - `{} <$(gerrit-url)>`_\n -' \ |
| 61 | | tee $@.log |
| 62 | |
| 63 | ## ----------------------------------------------------------------------- |
| 64 | ## Intent: Generate an rst table for VOLTHA github repositories |
| 65 | ## ----------------------------------------------------------------------- |
| 66 | github-src := sources/voltha.github |
| 67 | github-url := /dev/null |
| 68 | github-gen: |
| 69 | |
| 70 | ## ----------------------------------------------------------------------- |
| 71 | ## Intent: Remove generated targets |
| 72 | ## ----------------------------------------------------------------------- |
| 73 | clean: |
| 74 | $(RM) *.log |
| 75 | |
| 76 | ## ----------------------------------------------------------------------- |
| 77 | ## Intent: Display help text |
| 78 | ## ----------------------------------------------------------------------- |
| 79 | help :: |
| 80 | @echo "Usage: $(MAKE) [options] [target] ..." |
| 81 | @echo "Targets:" |
| 82 | @echo " clean Remove generated targets" |
| 83 | |
| 84 | @echo |
| 85 | @echo "[RST GEN] - Generate an rst table containing" |
| 86 | @echo " gen-all Generate all VOLTHA rst tables" |
| 87 | @echo " gen-docker VOLTHA Docker images" |
| 88 | @echo " gen-gerrit VOLTHA Gerrit Repositories" |
| 89 | @echo " gen-github VOLTHA Github Repositories" |
| 90 | |
| 91 | # [EOF] |