help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preprocessing files with make


From: Michael Chastain
Subject: Re: Preprocessing files with make
Date: Sat, 28 Aug 2004 15:16:37 -0400
User-agent: nail 10.8 6/28/04

"Paul D. Smith" <psmith@gnu.org> wrote:
> In what way does it interact poorly with other dependency rules?

If a static pattern rule matches a target, then it generates warnings
to override the generic static pattern rule with a specialized rule.
For example:

  $(O_FILES): %.o: %c
        cc -c $< -o $@

  alpha.o: %.o
        cc -c $< -o $@ -DFOO

This particular feature of static patterns rules is worse than
implicit rules.

Also, not a question of interaction, but a real limitation
in gnu make 3.79.1 at least: static pattern rules don't allow
free use of the "%" character in constructing dependencies.
For example:

  $(O_FILES): %.o: %.c $(dep_list_%)

Here is a complete sample Makefile attached to illustrate both
these problems.

===

C_FILES := $(wildcard *.c)
O_FILES := $(patsubst %.c,%.o,$(C_FILES))

dep_list_alpha  := alpha.h
dep_list_beta   := beta1.h beta2.h
dep_list_gamma  := gamma.h

a.out: $(O_FILES)
        cc $(O_FILES) -o $@

$(O_FILES): %.o: %.c $(wildcard %*.h) $(dep_list_%)
        cc -c $< -o $@

alpha.o:
        cc -c $< -o $@ -DFOO





reply via email to

[Prev in Thread] Current Thread [Next in Thread]