【问题标题】:Why does GNU make think that the target is always out of date?为什么 GNU make 认为目标总是过时的?
【发布时间】:2015-11-29 21:46:19
【问题描述】:

这是preeny的Makefile:

COMMON_DEPS=logging.c
PLATFORM?=

all: desock.so defork.so dealarm.so patch.so derand.so desrand.so deptrace.so desock_dup.so

desock.so: desock.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^ -lpthread

desock_dup.so: desock_dup.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^ -ldl

defork.so: defork.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^

dealarm.so: dealarm.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^

derand.so: derand.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^

desrand.so: desrand.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^ -ldl

deptrace.so: deptrace.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^

patch.so: patch.c $(COMMON_DEPS)
    bash build_so.sh $@ $(PLATFORM) $^ -lini_config

clean:
    rm -f *.o
    rm -f *.so

由于某种原因,每次我调用make 时都会重建所有 .so 文件,即使我没有对源文件进行任何更改。这是为什么呢?

来源:https://github.com/zardus/preeny/blob/b5d8b9/src/Makefile

【问题讨论】:

    标签: makefile gnu-make


    【解决方案1】:

    这是因为目标不存在。结果立即移至 ../$ARCH 并且目标提及当前目录。

    【讨论】:

    • 确实如此。这是Rules of Makefiles 的第 2 条规则(来自 GNU make 维护者的规则)。
    猜你喜欢
    • 1970-01-01
    • 2014-07-08
    • 1970-01-01
    • 2011-04-25
    • 2013-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多