On Nov 15, 2005, at 8:29 PM, Marvin Humphrey wrote:

Turns out that things are quite hunky-dory yet. We're compiling, at least -- but the behavior isn't what I thought it was, and it's not optimum.

[snip informative description]

I think it boils down to conflict between the two Makefile.PLs. In reality, you only need the top one. For example, Gtk2 has a shedload of xs files in a subdirectory, but only one Makefile.PL, in the top directory.

IIRC, the contents are OBJECT are used as the default for LDFROM, which is used as the list of objects to link into the object that will be loaded by your module. That is, you should be able to do this:

  WriteMakefile(
      NAME => 'MyModule',
      ...
      INC => '-Isrc',  # so we can see the extra headers
OBJECT => 'MyModule$(OBJ_EXT) src/extrafile1$(OBJ_EXT) src/ extrafile2$(OBJ_EXT)',
      ...
  );

and it should all Just Work. To clarify, I would expect the example above to build MyModule.so from MyModule.o, src/extrafile1.o, and src/ extrafile2.o after building the .o files from the .c files, and after building MyModule.c from MyModule.xs. No fiddling with extra libs or extra makefiles should be necessary.


Gtk2 uses this scheme to build a single Gtk2.so from almost two hundred xs/*.xs files. We just dump a whole slew of filenames into OBJECT and let MakeMaker and Make do the rest.

On win32 there is(was?) an issue with MakeMaker that resulted in some pain and suffering when building Gtk2 --- the source files in the subdirectory would be compiled into objects in the current directory, so the link command would fail. A bit of extra magic fixed that; you can find it as the const_ccmd() sub in the MY package in Glib::MakeHelper. Look near the end: http://search.cpan.org/src/TSCH/ Glib-1.101/MakeHelper.pm


Hope that helps...


--
How come hair colors for women take an hour, but "wash out the gray" stuff for men only five minutes? This is so unfair!
    -- Elysse, complaining about commercials

Reply via email to