Check if a program exists from a Makefile

后端 未结 12 1093
时光取名叫无心
时光取名叫无心 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:38

    You can use bash built commands such as type foo or command -v foo, as below:

    SHELL := /bin/bash
    all: check
    
    check:
            @type foo
    

    Where foo is your program/command. Redirect to > /dev/null if you want it silent.

提交回复
热议问题