擅长:python、mysql、java
<p>您需要在<code>make</code>时间进行替换。在C语言中这更容易,在C中可以设置<code>#define</code>,但是对于Python,我可以尝试如下方法:</p>
<pre><code>foo.py: foo.py.in
[ -f $@ ] && rm -f $@
$(SED) -e "s:[@]datarootdir@:$(datarootdir):" $< > $@
chmod a-w $@
</code></pre>
<p>(将<code>AC_PROG_SED</code>添加到<code>configure.ac</code>)</p>