QQ_Sprite

导航

< 2025年5月 >
27 28 29 30 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
1 2 3 4 5 6 7

统计

Makefile 一点一滴(三)—— 尝试简单的变量替换

上一版的 makefile:

TestCpp : ./debug/TestCpp.o
    g++ -o TestCpp ./debug/TestCpp.o

./debug/TestCpp.o : ./src/TestCpp.cpp
    g++ -c -o ./debug/TestCpp.o ./src/TestCpp.cpp
    
clean : 
    rm -rf ./debug/TestCpp.o

这次尝试,用一些 makefile 函数对其进行替换,方便修改和移植。

复制代码
TARGET= ./bin/TestCpp

$(TARGET): ./debug/TestCpp.o
    g++ -o $(TARGET) ./debug/TestCpp.o

# $@ —— 冒号前面的变量 $< —— 冒号后面的变量
./debug/TestCpp.o : ./src/TestCpp.cpp
    g++ -c -o $@ $<
    
clean : 
    rm -rf ./debug/TestCpp.o
复制代码

这次总算是一次成功了。。。输出和前一版本一致

posted on   QQ_Sprite  阅读(324)  评论(0)    收藏  举报

努力加载评论中...
点击右上角即可分享
微信分享提示