Pre-build step in makefile

前端 未结 5 1132
广开言路
广开言路 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条回答
  •  我在风中等你
    2021-01-31 09:37

    What you are proposing seems a bit "un-make-like". Why not just run the command in whatever makefile target you need it to go before?

    Example, if you need it to run before linking foo:

    foo: ${OBJS}
        my-command-goes-here
        ${CC} -o $@ ${OBJS} ${LIBS}
    

提交回复
热议问题