Hi,

In one of my projects I've written a small make script which includes given
makefiles and then prints out valid make code with definitions of all new
variables found in the included makefiles (based on the value of
$(.VARIABLES)).

You can see the source code of the script here:
http://code.google.com/p/embox/source/browse/trunk/embox/mk/script/mk-cache.mk?r=4825

And a usage example:
http://code.google.com/p/embox/source/browse/trunk/embox/mk/load.mk?r=4827

Hope this will help.

2012/2/18 Torbjörn Svensson <az...@svenskalinuxforeningen.se>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello list,
>
>
> The short version
> Is there any way to make make dump it's database to a makefile and
> then reuse that dumped makefile to build the source?
>
>
>
> The long version
> In one of our projects at work, we use a rather complex set of
> macros[1] to make it easier for the developers to define how a
> component is to be built. The developer creates a file called
> 'makerules.mk' and enters data into a few predefined variable names,
> like $(component1_SRCS), $(component1_INCL), $(component1_LIBS) where
> "component1" is the name of the resulting executable of library. When
> invoking make, the macros are expanded based on the data in those
> variables to a set of rules and then make just does it's magic on
> those. As the source code usually is put in a tree, the number of
> makerules.mk files that the developers are entering data into can be
> rather large and as a result, the part of the build process that
> expands the macros takes a lot of time. For example, for one of our
> components, the expansion takes roughly 40 seconds even as there is
> nothing to left to do.
>
> To save some time, I'm now thinking that our build process could be
> divided into a few stages.
>
> Stage 1
> Verify the timestamps on each and every makerules.mk file and if any
> of the timestamps is newer than the complete makefile, it needs to be
> regenerated.
> Possible way to implement: Could be resolved with another temporary
> makefile that just sets the complete makefile as target and have all
> the makerules.mk files as dependencies.
>
> Stage 2
> Generate the complete makefile and expand all the macros.
> Possible way to implement: The option -p sounds interesting. The
> problem with -p is that the dumped database also includes -p in MFLAGS
> and MAKEFLAGS so it's not possible to just invoke make on the complete
> makefile without first stripping of this option. At first glans, I
> would like an option like -p but it should not be added to the dumped
> database, but I'm a bit worried that not adding it there would screw
> up recursive make. I also would like the option to print to a file
> rather than stdout as stdout could be used in the makefile that you
> build and thus make will be confused if invoked on the dumped file.
>
> Stage 3
> Execute make on the complete makefile.
>
>
> To sum up this question, is it possible to do this without patching
> make? If not, is it something that you would be interested in
> including in an official version of make?
>
>
> Thank you in advance.
>
> // Torbjörn
>
>
> [1] http://gitorious.org/bobuild/bob/trees/master
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk8/3CUACgkQeY7jmtvbDP2S6gCgyOrwVsZVUy2x0gQ4gDb6G4qd
> 2coAoI2QgDNAHX84hNy2RArrPd7liSE4
> =rnlv
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Bug-make mailing list
> Bug-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-make
>



-- 
Best regards,
Eldar Sh. Abusalimov
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to