我们可以在 make 中运行一个 python 脚本来生成一些 .c 和 .h 文件,然后构建一个镜像吗?

标签 c linux makefile cmake

我有一个 json 文件,我需要从中生成 .c 和 .h 文件,然后构建我的图像。

有什么方法可以让我先运行 python 脚本,然后在开发人员运行 Make 时构建 c 文件吗?

最佳答案

在CMAKE中,您可以通过这种方式使用add_custom_command,请参阅cmake文档

add_custom_command(OUTPUT ${YOUR_OUTPUT_FILE} COMMAND your_generate_command --outputfile=${YOUR_OUTPUT_FILE} --inputfile=${YOUR_JSON_FILE} DEPENDS ${YOUR_JSON_FILE} VERBATIM)

关于我们可以在 make 中运行一个 python 脚本来生成一些 .c 和 .h 文件,然后构建一个镜像吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37181761/

相关文章:

C 可执行文件不能在 linux Mint 上运行

c - 使用命令行参数执行位于内存中的程序

具有远程 (AWS S3) 目标的 Makefile

c++ - 错误 : expected class-name before '{' token - can't seem to find any circular includes

c - 在C编程语言中,通过将本地char[]变量转换为const char *来返回它是否正确?

cuda - 零拷贝内存,内存映射文件

c - Mergesort 中的段错误分配数组时 - c

linux - 当我在内核命令中添加选项 net.ifnames=0 biosdevname=0 时,IP 路由错误

linux - Eiffel:有没有办法将彩色字符打印到终端(控制台)

linux - Debian执行'make'命令时出错