Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax error in Makefile: end of file unexpected (expecting "fi")

Here is my make target:

copy_python:
    if test -d $(VIRTUAL_ENV)/lib; then \
        cp -a $(VIRTUAL_ENV)/lib/python2.7/site-packages/. ./package/tmp/; \
    fi
    if test -d $(VIRTUAL_ENV)/lib64; then \
        cp -a $(VIRTUAL_ENV)/lib64/python2.7/site-packages/. ./package/tmp/; \ 
    fi

Here is the error:

/bin/sh: 2: Syntax error: end of file unexpected (expecting "fi")
Makefile:28: recipe for target 'copy_python' failed
make: *** [copy_python] Error 2

Why does this error occur?

like image 673
Kyle Joseph Green Avatar asked Jan 03 '23 09:01

Kyle Joseph Green


1 Answers

You have an extra space after the ending backslash, at the end of the second cp command. For this reason, \ no longer acts as a line continuation and the fi on the next line is not passed to sh

like image 145
xhienne Avatar answered Jan 14 '23 08:01

xhienne