Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

求教各位Makefile高手

[复制链接]
youkelai 发表于 2007-11-19 21:21:25 | 显示全部楼层 |阅读模式
SOURCE_DIR := . .
BINARY_DIR := ./out .

source-dir-to-binary-dir = $(addprefix $(BINARY_DIR)/, \ .
$(patsubst $(SOURCE_DIR)/%,%,$1)) .
source-to-dependence = $(call source-dir-to-binary-dir, \ .
$(subst .c,.d,$(filter %.c,$1))) .

sources := src/main.c src/sub.c .
dependencies = $(call source-to-dependence,$(sources)) .

include $(dependencies) .


define create-one-dependency .
$2: $1 .
@$(GCC) -MM $(CFLAGS) $< | \ .
sed 's,\($(notdir $*)\.o\) *:,$(dir $@)\1 $@: ,' > $@.tmp .
@$(MV) $@.tmp $@ .
@echo create $@ ... .
endef .

define dependencies-rules .
$(foreach s,$(sources),$(call create-one-dependency,$s, \ .
$(call source-to-dependence, $s))) .
endef .

$(eval $(call dependencies-rules)) .



以上是Makefile代码~~ .
出问题了, .
make[1]:***没有规则创建out/src/main.d .

纳闷阿郁闷阿~~半天都没弄明白 .
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-15 14:33 , Processed in 0.018095 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表