日期:2014-05-16  浏览次数:20685 次

请教makefile文件的%号的问题!
看不懂这段,默认目标all跳到dist之后,是如何执行的?

实际执行是组成了install-xen等等,去install-xen开始执行。

这段是如何进行的?那%号怎么组合成那几个关键字的?在哪个教程的哪张有提到呢?我好像没找到呢?

.PHONY: all
all: dist

# build and install everything into local dist directory
.PHONY: dist
dist: DESTDIR=$(DISTDIR)/install
dist: dist-xen dist-kernels dist-tools dist-stubdom dist-docs
$(INSTALL_DIR) $(DISTDIR)/check
@echo '21111111111111111111'
$(INSTALL_DATA) ./COPYING $(DISTDIR)
$(INSTALL_DATA) ./README $(DISTDIR)
$(INSTALL_PROG) ./install.sh $(DISTDIR)
$(INSTALL_PROG) tools/check/chk tools/check/check_* tools/check/funcs.sh $(DISTDIR)/check
dist-%: DESTDIR=$(DISTDIR)/install
dist-%: install-%
@: # do nothing

# Legacy dist targets
.PHONY: xen tools stubdom kernels docs
xen: dist-xen
tools: dist-tools
kernels: dist-kernels
stubdom: dist-stubdom
docs: dist-docs

.PHONY: prep-kernels
prep-kernels:
for i in $(XKERNELS) ; do $(MAKE) $$i-prep || exit 1; done

.PHONY: install-xen
install-xen:
$(MAKE) -C xen install

.PHONY: install-tools
install-tools: tools/ioemu-dir
@echo 'target = $@'
$(MAKE) -C tools install

------解决方案--------------------
假设你在命令行当中make dist-kernels
dist-kernels: DESTDIR=$(DISTDIR)/install
dist-kernels: install-kernels