English 中文(简体)
全球需求评估能否制定目标,取决于能否完成其他文件的目标?
原标题:Can GNU make have targets that depend on the completion of targets from other makefiles?

I have several directories representing subparts of a project, each with its own Makefile.
I want to create a master Makefile with targets for each of those subparts, each target satisfying the following:

  • depend on a certain target from that subproject s Makefile.
    This is the tricky part.
  • copy some resulting library/executable build by the subproject into a central directory (kind of like "make install"-ing it).
    This I can already achieve using simple commands.

I could only find information about the include directive of GNU make, but that doesn t help me much as it seems not to encapsulate the rules (and execution) of the included makefile in its own directory, but instead just #includes them C-style (rather that thinking of them as packages with separate scopes).

INSTALLDIR := build
SRCDIR := src

TARGETS := projA projB
.PHONY: $(TARGETS)
TARGETS_PATH := $(addprefix $(SRCDIR)/, $(TARGETS))
MAKEFILES := $(addsuffix /osx.mak, $(TARGETS_PATH))
# include them somehow?

对于上文定义的这种设置,我现在想到的是$>(TARGETS) to depend<>> on the release的对应清单指标(如projA:$(SRCDIR)/projA/osx.mak @ release,用于支持jA,用我自己的语言表示该指标是赞成j A取决于能否成功执行具体清单中的<代码>release指标。

Is there any way to achieve this?
You can suggest other tools apart from GNU make, but the subproject makefiles are already written as makefiles.

最佳回答
问题回答

暂无回答




相关问题
makefile: how to show line numbers for debugging?

Is there a way to have make display the line number where it declares an error? The -d switch doesn t seem to cut it. Updated: Example output: Reaping winning child 0x08aa8648 PID 9381 /bin/sh: ...

What is the reasoning behind the Makefile whitespace syntax?

I m revisiting Python after Michael Sparks s excellent walk through of Peter Norvig s Python spell checker at the SO DevDay in London. One of the points he highlighted was how clean Python is to look ...

Debugging GNU make

Is there a command line way in make to find out which of the prerequisites of a target is not updated?

How to add an all rule to this Makefile?

I want to just type make all and have the following Makefile do everything it s supposed to do: LEX = lex YACC = yacc CC = gcc calcu: y.tab.o lex.yy.o $(CC) -o calcu y.tab.o lex.yy.o -ly -lfl ...

How to discover number of *logical* cores on Mac OS X?

How can you tell, from the command line, how many cores are on the machine when you re running Mac OS X? On Linux, I use: x=$(awk /^processor/ {++n} END {print n+1} /proc/cpuinfo) It s not ...

Using extern in C doesn t work as expected

I have created two files: tunables.h #ifndef TUNABLES_H #define TUNABLES_H void tunables_load_conservative(); void tunables_load_aggressive(); extern int timer_x; #endif /*TUNABLES_H */ and ...