On Sat, 2 Feb 2008, Felix Fietkau wrote:

> Robert P. J. Day wrote:
> >   i'm just following the logic for the simple clean targets, and i'm
> > confused as to how "make clean" and "make dirclean" work.  in a
> > fully-cleaned openwrt tree, running either of those dumps one into
> > "make menuconfig", which would seem to be a pointless exercise if the
> > tree is already clean.
> clean and dirclean are dependent on the target selection, thus depend on
> the .config file.
>
> > so i can see that either of those targets requires a rebuild of
> > .config if it isn't already there, which strikes me as weird.
> >
> >   i'm also puzzled by that second rule and its command:
> >
> >         @$(MAKE) $@
> >
> > i'm sure i'm just missing something, but doesn't that just reinvoke
> > its own target?  how *does* that work?  thanks for any enlightenment.

> It works like this: When a build system target is called, the OPENWRT_BUILD
> variable is unset and that means, the preparatory work is to be done first.
> Package directories are scanned, prerequisites are checked, the .config is
> checked for if the target requests it, etc.
> At this point, the variable OPENWRT_BUILD is exported and when a real
> target is called, @$(MAKE) $@ will call the Makefile again, but because of
> the different set of variables, the real build system logic is included now
> and thus provides access to the real targets.
> Hope this helps.

sorry, i probably sounded a bit dense when i first asked that
question.  i'm actually familiar with two-pass makefiles, i just
didn't understand that exact rule command:

        @$(MAKE) $@

since $@ does, of course, simply refer to the target of that very
rule, which seemed pointlessly recursive.  but now i'm assuming that
the variable $(MAKE) expands to more than just a simple "make"
invocation -- i'm guessing it has to include a change directory of
some kind, right?  *then* it would make perfect sense.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

Home page:                                         http://crashcourse.ca
Fedora Cookbook:    http://crashcourse.ca/wiki/index.php/Fedora_Cookbook
========================================================================
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to