Kyle Joseph Green
Kyle Joseph Green

Reputation: 129

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?

Upvotes: 7

Views: 7379

Answers (1)

xhienne
xhienne

Reputation: 6144

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

Upvotes: 11

Related Questions