English 中文(简体)
因此:强迫使用规则
原标题:make: forcing a rule to be used
  • 时间:2011-11-23 15:28:56
  •  标签:
  • makefile

Typping make/code> (Gnu Making) with the following Makefile (assuming file x and foo.y are Disappearance

all: foo.z

foo.z: foo.x foo.y
  cat foo.x foo.y > foo.z

生成错误信息:

make: *** No rule to make target `foo.x , needed by `foo.z .  Stop.

但是,Makefile :

all: foo.z

%.z: %.x %.y
  cat %.x %.y > %.z

产生这一错误信息:

make: *** No rule to make target `foo.z , needed by `all .  Stop.

In the first case, the rule is applied, and a dependency if found to be missing. In the second case, the rule is found to be not appropriate, and that is a rule that is missing.

我想使用第二个<代码>Makefile(我有许多条码>*.z的标语,但有一个象第一个<代码>Makefile那样的错误信息。 我的<代码>make输出被封不动,而扩大的缺失档案名称将有助于分解。

是否可能? 或许是强迫使用该规则的一种方式?

当然,Im没有编造档案,这只是一个例子。

最佳回答

我刚刚发现:

all: foo.z

OBJ=foo.z

$(OBJ): %.z: %.x %.y
   cat %.x %.y > %.z

http://www.gnu.org/software/make/manual/make.html#Static-Pattern” rel=“nofollow” Amazing make...

问题回答

暂无回答




相关问题
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 ...

热门标签