MickeyTheMouse
MickeyTheMouse

Reputation: 419

Makefile doesn't detect Python

I've got the following in my Makefile,

dosomething:
    ifeq (, $(shell which python))
        $(error "Python not installed, please download and install Python to create database")
    else
        cd myfolder; python myfile.py
    endif

When I run make dosomething, it throws the error telling me to download and install python. But when I do which python in my shell, it says /usr/bin/python

Not sure what is going on here

Upvotes: 0

Views: 304

Answers (1)

G.M.
G.M.

Reputation: 12879

I'm guessing the indented lines begin with a tab character? If so then the ifeq, else and endif directives will be considered to be part of the command and passed to the shell for execution.

To ensure make evaluates those directives remove the leading tabs...

dosomething:
ifeq (, $(shell which python))
        $(error "Python not installed, please download and install Python to create database")
else
        cd myfolder; python myfile.py
endif

Upvotes: 2

Related Questions