I wrote a simple make file
test : main.cpp
g++ -Wall -o $@ $^ -lhello_ext -L. -I/usr/include/python2.7/ -lboost_regex -lpython2.7 -ggdb
libhello_ext.so : hello_ext.o
g++ -shared -o $@ $^ -Lboost-lib-path -I/usr/include/python2.7/ -lboost_regex -lpython2.7 -ggdb
hello_ext.o : hello_ext.cpp
g++ -c -Wall -Werror -fpic -o $@ $^ -I/usr/include/python2.7/ -lboost_regex -lpython2.7 -ggdb
.PHONY : clean
clean:
rm -rf test lib* *.o *.swf
But when I do a make I get an error
/usr/bin/ld: cannot find -lhello_ext
collect2: error: ld returned 1 exit status
make: *** [test] Error 1
Тhe problem in the first two rows and when I delete these commands from a make file and write the manual way to the terminal, it works fine. Тhat is, from the terminal I do
g++ -Wall -o $@ $^ -lhello_ext -L. -I/usr/include/python2.7/ -lboost_regex -lpython2.7 -ggdb
and everything works fine. What's the problem ?