I have a Makefile in which I need to pass an image name to another script but the issue is, Image Name has : and - in its line for eg: image.name-v1:latest. As per google make file having : in variable causes issue. How to resolve this issue in Makefile. Below is the sample code that I am trying in which IMAGE has image.name-v1:latest
IMAGE2 ?= ''
.PHONY: image
image:
IMAGE2 := $(subst :,\:,$(IMAGE_R)) ## IMAGE_R is a run time variable for make target
rr/image.sh $(IMAGE2)
Error:
IMAGE2 := docker-rs\:latest ## Test Image using Image Reference
/bin/sh: 1: IMAGE2: not found
Makefile:75: recipe for target 'image' failed
make: *** [image] Error 127
SHELL SCRIPT: image.sh
#!/bin/bash
set -ex
IMAGE="$1"
echo "Image: $IMAGE"