Pre-build step in makefile

前端 未结 5 1037
广开言路
广开言路 2021-01-31 09:04

How can I run a script, which must execute before all other makefile commands? And it will be nice (but not mandatory) to the script is not executed if there is nothing to build

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-31 09:39

    Depending on your make version, something like the following should at least avoid running dozens of times if CFLAGS and AFLAGS are evaluated dozens of times:

    CHEAT_ARG := $(shell myscript)
    

    Note the colon.

    This runs exactly once. Never more than once, but also never less than once. Choose your own tradeoffs.

提交回复
热议问题