执行make时没有规则来制作目标

时间:2014-07-09 14:38:29

标签: makefile boost-python

使用下面的makefile我得到了这个答案:

>> make makefile_hello_py hello_py.so
make: Nothing to be done for `makefile_hello_py'.
make: *** No rule to make target `hello_py.so'.  Stop.

此makefile已从here

修改
# location of the Python header files

PYTHON_VERSION = 2.6
PYTHON_INCLUDE = /XXX/include/python$(PYTHON_VERSION)

# location of the Boost Python include files and library

BOOST_INC = /YYY/boost/boost_1_54_0
BOOST_LIB = /YYY/boost/boost_bin/lib

# compile mesh classes
TARGET = hello_py

hello_py.so: hello_py.o
    g++ -shared -Wl,--export-dynamic $(TARGET).o -L$(BOOST_LIB) -lboost_python-$(PYTHON_VERSION) -L/usr/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) -o hello_py.so

hello_py.o: hello_py.cpp
    g++ -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c hello_py.cpp

注意:hello_py.cpp文件确实存在。我在每个规则开头的选项卡上检查了两次。我错过了什么?

1 个答案:

答案 0 :(得分:1)

如果makefile_hello_py是你在问题中包含其内容的makefile,那么你需要使用-f参数告诉make'您的命令行告诉make它是一个构建的目标。

尝试make -f makefile_hello_py hello_py.so