Hello Folks,
I would very much appreciate if I could get help/suggestions on a particular sed usage. I have to write a script to take version info from a version file, compute the image name, print error if the image does not exist.
The version file looks like below:
"
#
# version.cfg
#
version = 4.2.1.1.10 #
"
The script seems to get the image name right but does not expand correctly in "ifeq ($(wildcard $(IMAGE_FILE)), )"
This is what I get:
"
IMAGE_FILE = ./images/release-4.2.1.1.10.tar.gz
Makefile:19: *** No image file "./images"/release-`grep version ./version.cfg | grep "=" | cut -d'=' -f2 | sed -e 's/#.*//' -e 's/[ ^ ]*//' -e 's/\ .*//'`.tar.gz. Stop.
"
This is my script:
==================
"
.PHONY: chkImage
VERSION_FILE := ./version.cfg
ifeq ($(wildcard $(VERSION_FILE)),)
$(error $(nl-ht)No Version File $(VERSION_FILE) Exists)
endif
ImageRoot := "./images"
Version := `grep version $(VERSION_FILE) | grep "=" | cut -d'=' -f2 | \
sed -e 's/\#.*//' -e 's/[ ^ ]*//' -e 's/\ .*//'`
Image := release-$(Version).tar.gz
IMAGE_FILE := $(ImageRoot)/$(Image)
all: chkImage
chkImage:
@printf "IMAGE_FILE = $(IMAGE_FILE) \n"
ifeq ($(wildcard $(IMAGE_FILE)), )
$(error $(nl-ht)No image file $(IMAGE_FILE))
endif
"
Your help in resolving this issue would be greatly appreciated.