Makefile

 
一些选项的解释:
CC=gcc
CFLAGS= -Iinclude -Wall  -g -DDEBUG
LDFLAGS=-L./lib -Wl,-rpath=./lib -Wl,-rpath=/usr/local/lib

ttorrent: main.o parse_metafile.o tracker.o bitfield.o sha1.o message.o peer.o data.o policy.o torrent.o bterror.o log.o signal_hander.o
$(CC) -o $@ $(LDFLAGS) $^ -ldl

clean:
rm -rf *.o ttorrent

1.第二句的那个-DDEBUG是什么意思,干么用的.
2.第三句的-Wl和,-rpath是什么意思,干么的?
3.第6句的-ldl是什么意思,干么的.


|

1、-DDEBUG 定义宏 DEBUG,类似于在 .c 或 .h 中 #define DEBUG
2、-Wl 将后面跟的参数传递给连接器 ld;-rpath 添加运行时库的搜索路径
3、-ldl 连接库 libdl.so 或 libdl.a
原文地址:https://www.cnblogs.com/jingzhishen/p/5639532.html