Check if a program exists from a Makefile

后端 未结 12 1087
时光取名叫无心
时光取名叫无心 2020-12-12 20:20

How can I check if a program is callable from a Makefile?

(That is, the program should exist in the path or otherwise be callable.)

It could be used to chec

12条回答
  •  抹茶落季
    2020-12-12 20:43

    Solved by compiling a special little program in another makefile target, whose sole purpose is to check for whatever runtime stuff I was looking for.

    Then, I called this program in yet another makefile target.

    It was something like this if I recall correctly:

    real: checker real.c
        cc -o real real.c `./checker`
    
    checker: checker.c
        cc -o checker checker.c
    

提交回复
热议问题