[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: reparsing makefile
From: |
Warlich, Christof |
Subject: |
RE: reparsing makefile |
Date: |
Fri, 16 Dec 2011 07:09:29 +0100 |
> > Warlich, Christof wrote:
> >
> > > > > Thus, I need to reparse the Makefile whenever mounting was
> > > > > needed.
> > >
> > >> An include file might help you with that.
> > >
> > > I reread the section about the include directive in the manual,
> > > but I'm not sure if I really understand: As the whole point is
> > > about reparsing, I assume you refer to make's ability to generate
> > > non-existing include files? An if I got the idea behind that right,
> > > Make will then repase its Makefile (and the newly generated include
> > > file)?
> >
> > I haven't thought it through, but yes, something like that. IIRC, Make
> > will first check for dependencies on include files, and do any
> > rebuilds. If an include file is update, Make will start over and
> > reparse the Makefile.
>
> If you create a sentinel makefile that exists on the filesystem and you
> "include" it (it can even be empty), and your makefile has a rule to
> build it and that rule involves mounting the partition then touching the
> file for example, then:
>
> make will try to include the file, see that it doesn't exist, run the
> rule to create it (which will mount the partition), then re-exec itself
> to re-read the makefile.
>
> Should work.
Just to wrap up: It does work, and the resulting code looks much better:
/mnt/xxx:
touch $@
/mnt/mounted:
mount -t cifs //localhost/share /mnt
touch $@
-include /mnt/mounted
Thanks for the excellent idea.