help-make
[Top][All Lists]
Advanced

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

Re: Equivalent Makefile setting for 'make -r' option?


From: Paul D. Smith
Subject: Re: Equivalent Makefile setting for 'make -r' option?
Date: Fri, 8 Nov 2002 19:58:33 -0500

%% gk <address@hidden> writes:

  g> Is there any way besides command line option to invoke:
  g> `--no-builtin-rules'?

No.

  g> I was hoping for something like:
  g> .SUFFIXES:
  g> Does the above do the same as 'make -r'?

Close, but not exactly.

  g> The manual is rather unclear on the difference between 'suffix
  g> rules' and 'implicit rules' and 'pattern rules' Are they the same?

No.  Suffix rules look like:

 .c.o

where both .c and .o are prerequisites of the .SUFFIXES special target.

Pattern rules look like:

  %.o : %.c

Implicit rules encompass both suffix rules and pattern rules: implicit
rules are rules that _implicitly_ define a command to build a class of
targets from a class of prerequisites, as opposed to explicit rules
which list an _explicit_ target and prerequisite that a command should
apply to.

If you use "make -p -f/dev/null" you can tell which rules will and won't
be removed by clearing .SUFFIXES prerequisite list fairly easily: any
pattern rule (that contains % patterns) will _NOT_ be disabled by using
an empty .SUFFIXES; any suffix rule (that contains no % and only .x or
.x.y) _WILL_ be disabled.

  g> The manual implies they are differerent when it says:
  >> "Suffix rules" are a more limited way to define implicit rules.
  >> Pattern rules are more general and clearer, but suffix rules are
  >> retained for compatibility.

See above.

  g> Obviously the presence of builtin rules affects how a makefile
  g> works.  I do not want any built-in rules or suffix rules. I want to
  g> write all my own pattern rules and I don't want them to conflict
  g> with any existing suffix/pattern rules and I don't want to depend
  g> on users knowing that they must always type 'make -r' to build a
  g> project either.

You're out of luck, short of hacks.

Note that there's no issue of "conflicting"; you will never get an error
from make if you write an implicit rule that overrides an existing one;
your rule will always silently take precedence.

The only issue with builtin rules that don't get removed is that they
might cause extra links to be made in your implicit rule searches that
you didn't intend (because there are builtin pattern rules you didn't
know about).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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