%% Bhaskar G <[EMAIL PROTECTED]> writes: bg> I have a simple makefile as below. Even though the $(STATUS) value is 1 bg> the ifeq doesnot gothrough this condition. I am using Gmake 3.80 bg> on linux.
bg> all: bg> $(eval STATUS := $(shell ls blahblah> nul 2>&1 ;echo $$?)) bg> @echo $(STATUS) bg> ifeq ($(strip $(STATUS)),1) bg> @echo "FAIL" bg> @echo "$(STATUS) --BG1" bg> else bg> @echo "PASS" bg> @echo "$(STATUS) --BG" bg> endif Sorry, this won't do what you expect. You are mixing and matching make conditionals (evaluated as the makefile is read in) with command scripts (not evaluated until the command is invoked). This is similar to trying to check a C runtime variable in a preprocessor #ifdef; it can't work. The #ifdef is parsed as the source is read in and controls what the parser sees and what is compiled, while the runtime variable is not evaluated until the program is run. Make conditionals work the same way. The most critical thing to keep in mind when writing makefiles is when things are evaluated. If you don't have a solid foundation in that you'll forever be running into issues and misunderstandings. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
