I'm creating a Makefile, and in one of my targets, i need an IF statement to determine if two things are equal... but, I can't get it to run. Any ideas what is wrong?
It helps if you say more than: I can't get it to run, versions, etc.
So, for this script:
#!/usr/bin/env bash
# @(#) s1 Demonstrate ifeq in make, with, without parens.
echo
set +o nounset
LC_ALL=C ; LANG=C ; export LC_ALL LANG
echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) make
set -o nounset
echo
FILE=${1-Makefile}
echo " Data file $FILE:"
cat $FILE
echo
echo " Results:"
make
exit 0
We get:
% ./s1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.11-x1, i686
Distribution : Xandros Desktop 3.0.3 Business
GNU bash 2.05b.0
GNU Make 3.80
Data file Makefile:
# Sat Jan 24 11:25:44 CST 2009
file:
@echo
@echo " No parens, whitespace ignored."
ifeq "a" "a"
@echo " Strings are equal."
else
@echo " Strings differ."
endif
@echo
@echo " With parens -- tricky comparison of whitespace."
ifeq ( "a", "a" )
@echo " Strings are equal."
else
@echo " Strings differ."
endif
Results:
No parens, whitespace ignored.
Strings are equal.
With parens -- tricky comparison of whitespace.
Strings differ.