Makefile中的ifeq 多條件使用

2021-10-22 05:54:29 字數 588 閱讀 7503

網上關於makefile中ifeq的介紹已經很多了,為什麼我還要在寫這篇文章,因為他們只說了if else兩種條件的情況,並沒有講多於兩種條件情況的使用。多於兩種情況的使用很簡單,害我嘗試很多種方法,如ifeq elifeq等等這些。其實就如同c中的if [else if] [else if]...else的使用一樣,舉個我使用的例子,android中的ndk程式android.mk判斷當前是哪種cpu架構:

ifeq ($(target_arch), arm)

local_src_files := ...

else ifeq ($(target_arch), x86)

local_src_files := ...

else ifeq ($(target_arch), mips)

local_src_files := ...

else 

local_src_files := ...

endif

很簡單有木有,但網上的資料都沒有去涉及,可能大多數**都一樣,呵呵,這是我看makefile標準文件中得到了。希望給同樣困惑的人一點幫助。

Makefile中的ifeq 多條件使用

makefile中的ifeq 多條件使用 網上關於makefile中ifeq的介紹已經很多了,為什麼我還要在寫這篇文章,因為他們只說了if else兩種條件的情況,並沒有講多於兩種條件情況的使用。多於兩種情況的使用很簡單,害我嘗試很多種方法,如ifeq elifeq等等這些。其實就如同c中的if e...

makefile中的多target混亂依賴模式

來看個例子,makefile內容為 test1 test2 test1.cpp test2.cpp clean rm f test1 test2這是一種非常懶散的寫法,雖然可以work taoge localhost desktop make clean rm f test1 test2 taoge...

Makefile多檔案編譯

include test.h main main.c makefile makefile obj makefile src eat eat.c eat.h makefile makefile test.c test.htest.件 include includeint testprint 將test...