c++ - Boost python extract module name during compilation -
what best way extract name of boost module i'm compiling makefile? i'm afraid might have practically write crude c compiler in order extract pattern matching.
the basic hard-coded version have (i haven't tested it. i'm using example):
sources=test.cpp boost_features.cpp util.cpp objects=$(sources:.cpp=.o) # extract module name here \/\/\/ lib=$(patsubst ') {',,$(patsubst 'boost_python_module(',,$($(shell grep 'boost_python_module(*) {' $(sources))))) cflags=-fpic -wall .phony: clean $(lib): $(objects) g++ -shared -o $@ $(objects) -i/usr/include/python2.6 -lboost_python -lpython2.6 $(cflags) @echo done compiling! boost_features.o: util.h $(objects): %.o : %.cpp g++ -c $< -o $@ -i/usr/include/python2.6 -lboost_python -lpython2.6 $(cflags) clean: rm -rf $(objects) $(lib)
Comments
Post a Comment