bash - Make variable treated as command and ifeq-statement syntax error with parentheses -


i want create variable in makefile. compared in ifeq-statement. variable name treated command:

make: dif: command not found 

i have:

dif := $(shell diff file1 <(./myprog < file2)) 

i've been reading manuals , testing, nothing worked. non-working effects of seen above.

edit:

made progress, second problem ifeq-statement

$(eval dif = diff ./test0.out <(./rozwiązanie < ./test0.in)) // ok  ifeq ($(dif),null) 

gives error:

ifeq (diff ./test0.out <(./rozwiązanie < ./test0.in),null) syntax error: word unexpected (expecting ")") makefile:18: recipe target 'test' failed 

there many issues here. first, please specify operating system you're using , version of make; of above errors don't appear have been generated gnu make (which makefile syntax you're using) while others were. that's strange. please run make --version , show output.

second, syntax you're using shell function specific bash shell, default gnu make (like versions of make) use posix sh shell. output redirection syntax you're using there (<(./myprog <file2)) not support in sh. if must use non-standard, bash-specific syntax you'll have invoke bash directly; like:

dif := $(shell bash -c 'diff file1 <(./myprog <file2)') 

third, use of eval incorrect. eval used expand makefile syntax, not shell syntax. statement:

$(eval dif = diff ./test0.out <(./rozwiązanie < ./test0.in)) 

is absolutely identical in every way statement:

dif = diff ./test0.out <(./rozwiązanie < ./test0.in) 

so you're not running shell command @ all, you're setting variable dif static string.

finally, output diff never string null, if-statement:

ifeq ($(dif),null) 

will never true.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -