List Info

Thread: Problem using -R in MAKEFLAGS




Problem using -R in MAKEFLAGS
user name
2006-11-06 16:38:00
Hi John,

I tried using ".SUFFIXES:".
Its a lot better but it still doesn't stop all of the built
in rules.

For the simple makefile:
.SUFFIXES:   

%.exe : %.c
    gcc -o $(F) $<
 
I still get:
  Considering target file `helloworld.c'.
   Looking for an implicit rule for `helloworld.c'.
   Trying pattern rule with stem `helloworld'.
   Trying implicit prerequisite `helloworld.w'.
   Trying pattern rule with stem `helloworld.c'.
   Trying implicit prerequisite `helloworld.c,v'.
   Trying pattern rule with stem `helloworld.c'.
   Trying implicit prerequisite `RCS/helloworld.c,v'.
   Trying pattern rule with stem `helloworld.c'.
   Trying implicit prerequisite `RCS/helloworld.c'.
   Trying pattern rule with stem `helloworld.c'.
   Trying implicit prerequisite `s.helloworld.c'.
   Trying pattern rule with stem `helloworld.c'.
   Trying implicit prerequisite `SCCS/s.helloworld.c'.
   Trying pattern rule with stem `helloworld'.
   Trying implicit prerequisite `helloworld.w'.
   Looking for a rule with intermediate file `helloworld.w'.
    Avoiding implicit rule recursion.
    Trying pattern rule with stem `helloworld.w'.
    Trying implicit prerequisite `helloworld.w,v'.
    Trying pattern rule with stem `helloworld.w'.
    Trying implicit prerequisite `RCS/helloworld.w,v'.
    Trying pattern rule with stem `helloworld.w'.
    Trying implicit prerequisite `RCS/helloworld.w'.
    Trying pattern rule with stem `helloworld.w'.
    Trying implicit prerequisite `s.helloworld.w'.
    Trying pattern rule with stem `helloworld.w'.
    Trying implicit prerequisite `SCCS/s.helloworld.w'.
   No implicit rule found for `helloworld.c'.
   Finished prerequisites of target file `helloworld.c'.
  No need to remake target `helloworld.c'.

Regards

Colm A

John Graham-Cumming wrote:
> Philip Guenther wrote:
>> You can't affect how make processes a makefile by
setting MAKEFLAGS in
>> the makefile itself.  Currently, make sets all the
built-in variables
>> and rules before parsing the makefile, and that can
be tested by the
>> makefile itself, so changing it would create all
sorts of problems.
>
> That's not actually totally true.  Page 50 of the GNU
Make manual 
> states: 'You can also set MAKEFLAGS in a makefile, to
specify 
> additional flags that should be in effect for that
makefile.'
>
> For example,
>
>     MAKEFLAGS += -n
>
>     .PHONY: all
>     all:
>         echo Doing all
>
> will print 'echo Doing all' because the -n is in effect
for that 
> Makefile.  Unfortunately, as you do state, there are
some flags that 
> will not work when MAKEFLAGS is set inside a Makefile. 
The source of 
> GNU Make shows that MAKEFLAGS is actually parsed twice:
once before 
> handling the Makefile and once after:
>
>   /* Decode switches again, in case the variables were
set by the 
> makefile.  */
>   decode_env_switches (STRING_SIZE_TUPLE
("MAKEFLAGS"));
>
> The flag you want to set for no built in rules is -r
(note that the 
> original message errorneously talked about -R which is
for built in 
> variables although it does force -r).  This translates
to the 
> no_builtin_rules_flag variable in GNU Make's source.
>
> Unfortunately, this flag is used to control the setting
up of the 
> built in rules BEFORE the Makefiles are parsed (as you
state) and 
> hence you can't add -r to MAKEFLAGS in a Makefile and
have it affect 
> that Makefile.  This is done so that new rules in the
Makefile can 
> override the default rules as necessary.
>
> Most of the command-line switches will work if
specified in MAKEFLAGS 
> in the Makefile and affect that Makefile (you can try
out silly 
> examples like -v and -p to see the effect).
>
> Now, to actually solve your problem (disabling default
rules in a 
> Makefile), there's a simple technique: you clear the
default suffix 
> list for built-in rules.  This will prevent any of the
built-in rules 
> from being searched and you can go ahead and define
your own pattern 
> rules.
>
> So simply write:
>
>     .SUFFIXES:
>
> in the Makefile where you want to disable built-in
rules.  This won't 
> kill the built-in variables, but they are probably less
of a worry.
>
> John.

-- 
------------------------------------------------------------
---------
 Colm Aengus Murphy,                Tel       : +353 1
2911000
 Senior Hardware Design Engineer,   Direct Tel: +353 1
2911373
 Silicon & Software Systems,        Fax       : +353 1
2911001
 South County Business Park,
 Leopardstown,                      E-mail: colm.murphys3group.com
 Dublin 18.                         WWW   : www.s3group.com
 Ireland
------------------------------------------------------------
---------


The information contained in this e-mail and in any
attachments is confidential and is designated solely for the
attention of the intended recipient(s). If you are not an
intended recipient, you must not use, disclose, copy,
distribute or retain this e-mail or any part thereof. If you
have received this e-mail in error, please notify the sender
by return e-mail and delete all copies of this e-mail from
your computer system(s).
Please direct any additional queries to: communicationss3group.com.
Thank You.


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )