Internals folks--
I'm trying to add something...complicated to a PECL extension, and I need to add some custom dependency rules to the Makefile.
Specifically, I'm compiling a manifest file using 'mc', which produces both a .h file and a .rc file. I need to ensure the 'mc' command runs before the compilation of the .c files that depend upon the header being generated.
With the Config.m4, there's the PHP_ADD_MAKEFILE_FRAGMENT directive, that magically pulls in the Makefile.frag in the same directory as the extension. Is there an equivalent directive for Config.w32?
Thx!
--E.
On Thu, May 21, 2015 at 1:12 AM, Eric Stenson ericsten@microsoft.com
wrote:
Internals folks--
I'm trying to add something...complicated to a PECL extension, and I need
to add some custom dependency rules to the Makefile.Specifically, I'm compiling a manifest file using 'mc', which produces
both a .h file and a .rc file. I need to ensure the 'mc' command runs
before the compilation of the .c files that depend upon the header being
generated.With the Config.m4, there's the PHP_ADD_MAKEFILE_FRAGMENT directive, that
magically pulls in the Makefile.frag in the same directory as the
extension. Is there an equivalent directive for Config.w32?Thx!
--E.
CC'ing the internals-win@ mailing list for better visibility.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu
Hi Eric,
-----Original Message-----
From: Ferenc Kovacs [mailto:tyra3l@gmail.com]
Sent: Thursday, May 21, 2015 10:29 AM
To: Eric Stenson; internals-win@lists.php.net
Cc: internals@lists.php.net
Subject: [INTERNALS-WIN] Re: [PHP-DEV] Q: What is the Config.w32 equivalent
of PHP_ADD_MAKEFILE_FRAGMENT?On Thu, May 21, 2015 at 1:12 AM, Eric Stenson ericsten@microsoft.com
wrote:Internals folks--
I'm trying to add something...complicated to a PECL extension, and I
need to add some custom dependency rules to the Makefile.Specifically, I'm compiling a manifest file using 'mc', which produces
both a .h file and a .rc file. I need to ensure the 'mc' command runs
before the compilation of the .c files that depend upon the header
being generated.With the Config.m4, there's the PHP_ADD_MAKEFILE_FRAGMENT directive,
that magically pulls in the Makefile.frag in the same directory as the
extension. Is there an equivalent directive for Config.w32?
Regarding manifests I'm currently investigating as well. Basically because of the win10 versioning which now might require us to include manifests. Please read here https://bugs.php.net/bug.php?id=69642 . Generally I see, that manifests will be already picked up when they exist. You can inspect the makefile currently generated to see how it is done.
But there's no functionality to include fragments. There is just a template in win32\build\Makefile which is then extended by the configure.js run. Can you please share what exactly you need it to do? Like the command sequence or alike, maybe there is already a way to do that. Of course we can also implement embedding fragments. Though that might most likely require slightly different code for PHP 5/7 and won't be available in earlier releases.
Regards
Anatol
-----Original Message-----
From: Anatol Belski [mailto:anatol.php@belski.net]
[...]
Can you please share what exactly you need it to do? Like the
command sequence or alike, maybe there is already a way to do that.
I need to run the $(MC) command, with the '-um' option, which will create ETW message macros & binary resources. The output is a .h, a .rc and a couple of .BIN files.
e.g.:
$(MC) -um -e h -h ..\pecl\wincache -r ..\pecl\wincache wincache_etw.man
I'm working around the lack of a fragment by running the $(MC) command by hand, an checking in the results to the pecl\wincache directory, and hand-hacking the template.rc to #include the resulting wincache_etw.rc. It kinda works, but it would be better if the building of the ETW resources was automatic with make/nmake.
Even better would be to put the rendered .h, .rc & .bin files in the same directory as the .obj's, so they could be cleaned up. The problem there is no way to pass an include directory arg (-I<dir>) to the $(RC) command used for template.rc.
Thx!
--E.
Hi Eric,
-----Original Message-----
From: Eric Stenson [mailto:ericsten@microsoft.com]
Sent: Tuesday, May 26, 2015 6:18 PM
To: Anatol Belski; 'Ferenc Kovacs'; internals-win@lists.php.net
Cc: internals@lists.php.net
Subject: RE: [INTERNALS-WIN] Re: [PHP-DEV] Q: What is the Config.w32
equivalent of PHP_ADD_MAKEFILE_FRAGMENT?-----Original Message-----
From: Anatol Belski [mailto:anatol.php@belski.net]
[...]
Can you please share what exactly you need it to do? Like the command
sequence or alike, maybe there is already a way to do that.I need to run the $(MC) command, with the '-um' option, which will create ETW
message macros & binary resources. The output is a .h, a .rc and a couple of
.BIN files.e.g.:
$(MC) -um -e h -h ..\pecl\wincache -r ..\pecl\wincache wincache_etw.manI'm working around the lack of a fragment by running the $(MC) command by
hand, an checking in the results to the pecl\wincache directory, and hand-
hacking the template.rc to #include the resulting wincache_etw.rc. It kinda
works, but it would be better if the building of the ETW resources was automatic
with make/nmake.Even better would be to put the rendered .h, .rc & .bin files in the same directory
as the .obj's, so they could be cleaned up. The problem there is no way to pass
an include directory arg (-I<dir>) to the $(RC) command used for template.rc.
I was just checking, one possibility were to make use of the variable called MFO which is globally available. Here for example what happens when you call EXTENSION(...) in the config.w32 http://git.php.net/?p=php-src.git;a=blob;f=win32/build/confutils.js;h=9a7b3fa5ac990899189d537f8295a98be3b7f89c;hb=HEAD#l1290 . So this gives possibility to implement custom targets adding them through the javascript API. However I'm not sure one can add those targets as dependency to the main ext dll target, and this is neglecting almost any effect of creating a custom build target. What one could theoretically do is reading the whole Makefile and extending the target of the interest, then writing the whole back. However tricky it is and might break other exts, so should be done with care.
A bit another story is in master, there the objects are put into the response file, so theoretically one could do the necessary operation already when configure runs and extend the response file. But that doesn't really help globally. However it's tricky as well. We can do the necessary implementations in master and maybe backport it, it were an improvement, but it were still missing in the already done releases. I'm going to put this on my todo at least for master. However don't expect coming to it very soon. Probably the simplest implementation were the possibility to add fragments as whole, disregarding the JS functionality. Maybe also you could play with the MFO possibility I've mentioned, I could have overseen something.
Regards
Anatol