日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

makefile中使用变量

發布時間:2025/6/15 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 makefile中使用变量 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? ? ? ? ? ? ? ? ? 直接看代碼:

?

[xxx@localhost makefile]$ ls makefile test1.cpp test2.cpp [xxx@localhost makefile]$ cat makefile all:test1 test2 XX=g++ CFLAGS=-Wall -O -gtest1:test1.o $(XX) test1.o -o test1 test2:test2.o$(XX) test2.o -o test2 test1.o:test1.cpp$(XX) $(CFLAGS) -c test1.cpp -o test1.o test2.o:test2.cpp$(XX) $(CFLAGS) -c test2.cpp -o test2.oclean:rm -fr *.o [xxx@localhost makefile]$ cat test1.cpp #include<stdio.h>int main() {printf("this is test1\n");return 0; } [xxx@localhost makefile]$ cat test2.cpp #include<stdio.h>int main() {printf("this is test2\n");return 0; } [xxx@localhost makefile]$

?

執行make:

?

[xxx@localhost makefile]$ make g++ -Wall -O -g -c test1.cpp -o test1.o g++ test1.o -o test1 g++ -Wall -O -g -c test2.cpp -o test2.o g++ test2.o -o test2 [xxx@localhost makefile]$ ls makefile test1 test1.cpp test1.o test2 test2.cpp test2.o [xxx@localhost makefile]$ ./test1 this is test1 [xxx@localhost makefile]$ ./test2 this is test2 [xxx@localhost makefile]$ make clean rm -fr *.o [xxx@localhost makefile]$

-Wall表示輸出所以警告信息,-O表示編譯時進行優化,-g表示編譯debug版本
?

?

?

?

?

?

總結

以上是生活随笔為你收集整理的makefile中使用变量的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。