在makefile目标中运行python脚本以并行生成源文件

2024-10-06 08:04:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个makefile,其中一个目标是一个python脚本,它遍历n个txt文件并连续生成相应的源文件。我正在尝试将此执行并行化。这是生成文件-

.PHONY: all
 all: target1 target2 target3

.PHONY: target1
target1: 
    ##recipe_target1

.PHONY: target2 
target2: target2_pyscript_dependency
    ##recipe_target2

.PHONY: target2_pyscript_dependency
target2_pyscript_dependency:
     python.exe *<some_python_script.py>* *<txt_files> <output_dir>*  
     ## execute this in parallel so the source files get generated in parallel

.PHONY: target3
target3:
    ##recipe_target3 

对如何实现这一目标有何建议


Tags: 文件intxt目标parallelrecipefilesall