Calling SED for a source in Makefile.am

非 Y 不嫁゛ 提交于 2019-12-05 18:40:34

Don't use in-place sed.

Instead:

gentest_SOURCES = gentest-seded.cc

gentest-seded.cc : gentest.cc
    $(SED) "s|__PREFIX__|@prefix@|" $< >$@

Have you ever considered #define-ing it in config.h (you're using autotools, right?) or passing it using -D when compiling? This is really not the case for sed.

The details from Andrew Y's answer:

in your C++ source, specify:

argv2[0] = SCRIPTPREFIX "/bin/slider3.py";

then compile with

-DSCRIPTPREFIX='"/your/script/prefix"'

Have you considered calling the Python code directly from the C++? Here is a tutorial on using boost to call python functions from C++. The method you are describing here seems very brittle.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!