【发布时间】:2019-05-06 15:16:31
【问题描述】:
有没有人可以帮我把这个命令行转换成makefile:
gcc -o hello_ps hello_ps.c -DMODELDIR=\"pkg-config --variable=modeldir pocketsphinx\" pkg-config --cflags --libs pocketsphinx sphinxbase
谢谢。
【问题讨论】:
有没有人可以帮我把这个命令行转换成makefile:
gcc -o hello_ps hello_ps.c -DMODELDIR=\"pkg-config --variable=modeldir pocketsphinx\" pkg-config --cflags --libs pocketsphinx sphinxbase
谢谢。
【问题讨论】:
在源代码和可执行文件之间创建依赖关系:
hello_ps: hello_ps.c
gcc -o hello_ps hello_ps.c -DMODELDIR=\"pkg-config --variable=modeldir pocketsphinx\" pkg-config --cflags --libs pocketsphinx sphinxbase
警告 gcc 之前有一个 tab,而不是空格
示例(我没有使用这些选项进行编译的环境):
pi@raspberrypi:/tmp $ echo "whatever I do not compile" > hello_ps.c
pi@raspberrypi:/tmp $ make -n
gcc -o hello_ps hello_ps.c -DMODELDIR=\"pkg-config --variable=modeldir pocketsphinx\" pkg-config --cflags --libs pocketsphinx sphinxbase
pi@raspberrypi:/tmp $ touch hello_ps
pi@raspberrypi:/tmp $ make -n
make: « hello_ps » is up to date.
pi@raspberrypi:/tmp $ touch hello_ps.c
pi@raspberrypi:/tmp $ make -n
gcc -o hello_ps hello_ps.c -DMODELDIR=\"pkg-config --variable=modeldir pocketsphinx\" pkg-config --cflags --libs pocketsphinx sphinxbase
当然,您可以添加更多依赖项,包括头文件、库等。
【讨论】: