Python Script Executed with Makefile

后端 未结 3 1598
自闭症患者
自闭症患者 2021-02-14 12:41

I am writing python scripts and execute them in a Makefile. The python script is used to process data in a pipeline. I would like Makefile to execute the script every time I mak

3条回答
  •  悲&欢浪女
    2021-02-14 12:51

    That's not a lot of information, so this answer is a bit vague. The basic principle of Makefiles is to list dependencies for each target; in this case, your target (let's call it foo) depends on your python script (let's call it do-foo.py):

    foo: do-foo.py
        python do-foo.py > foo
    

    Now foo will be rerun whenever do-foo.py changes (provided, of course, you call make).

提交回复
热议问题