Makefile If-Then Else and Loops

前端 未结 4 1549
青春惊慌失措
青春惊慌失措 2020-12-24 10:18

Can someone explain how to use if-then statements and for loops in Makefiles? I can\'t seem to find any good documentation with examples.

4条回答
  •  無奈伤痛
    2020-12-24 11:10

    Here's an example if:

    ifeq ($(strip $(OS)),Linux)
            PYTHON = /usr/bin/python
            FIND = /usr/bin/find
    endif
    

    Note that this comes with a word of warning that different versions of Make have slightly different syntax, none of which seems to be documented very well.

提交回复
热议问题