help-make
[Top][All Lists]
Advanced

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

Re: MAKEFLAGS (Was: forcing a rule)


From: Boris Kolpackov
Subject: Re: MAKEFLAGS (Was: forcing a rule)
Date: Fri, 2 Apr 2004 19:28:15 -0600
User-agent: Mutt/1.5.4i

Hi Noel,

> >>I haven't tried it, but I'm thinking of something like:
> >>
> >> # bootstrap.mk
> >> ifeq ($(MAKELEVEL),0)
> >>   # re-exec make with new MAKEFLAGS
> >> endif
> >
> >
> >It is easy to say "re-exec make with new MAKEFLAGS. How are you
> >going to reliably achieve this if it's not the only code in the
> >makefile? What if I say
> >
> >make foo.o
> 
> I don't understand what the problem is.  The "gmake self wrapper" trick 
> deals with whatever target you give gmake.

I think it only deals with them when there are no actual rules
defined for such targets. Let's consider a concrete example:

# file : bootstrap.mk
#
ifeq ($(MAKELEVEL),0)
  # use .DEFAULT: trickery or some other tech. to re-execute make
endif


# file : makefile
#

foo.o : foo.c
        $(CC) -c $< -o $@

$ export MAKEFILES=bootstrap.mk
$ make foo.o

In this case no re-execution happens unless you are using some
really cool technique inside 
 
ifeq ($(MAKELEVEL),0)
endif

that I am not aware of (and you've got to tell me about it).


> >Also it means that the whole makefile is going to be read before 
> >re-execution. This could be unacceptable like in my case. So the 
> >only viable solution I can see is by bloating every makefile with
 
> Are you using recursive make?

No I am not and that's exactly why my makefiles are big (well, actually
they are not that big, there are just hundreds or even thousands of them)
and reading them all in just to re-execute is not an option.


> >Set where? in environment? No, thank you! ;-)
> 
> One idea, from an offline thread, is to have a configuration file similar 
> to CVS's .cvsrc.  One thought is to have a global configuration file that 
> can set MAKEFILES.


Anything global would be a bad thing because people use make to build
a lot of different things. What may be useful for one build system can
render the others completely broken (-r comes to mind).
 
> Of course, this all depends on what sort of project you're supporting.

Well, it is a general-purpose build system for configuring/building/installing
c/c++ applications. One day, when things settle a bit, I will make it
publicly available.

hth,
-boris

Attachment: signature.asc
Description: Digital signature


reply via email to

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