develooper Front page | perl.perl5.porters | Postings from September 2001

MakeMaker: handling source files in subdirs

Thread Next
Sven Verdoolaege
September 25, 2001 23:09
MakeMaker: handling source files in subdirs
Message ID:
The makemaker mailing list seems to be dead.

What is the correct way of dealing with source files in 
other directories with MakeMaker ?

Makefile.PL in the Gtk subdir of the Gtk-Perl package,
passes a bunch of "xs/file.o"s as OBJECT to MakeMaker,
but the only rule it generates for these files is

        $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c

But that basically amounts to "cc -c xs/file.c" with a bunch
of defines, which will create a file.o in the current directory
and not in the xs directory, whereas to make the rule specifies
a dependency of xs/file.o on xs/file.c .
(This is with perl 5.7.2, btw)
What is the best way to resolve this ?

Similarly, in my own module (FCGI), I have some *.c files in 
a different directory (../libfcgi) whose object files I would
like to appear in the current directory.
How do I tell MakeMaker about these *.c files ?
Right now I do this:

        my $extrarules = join "\n",
            map { $b = $_; $b =~ s/\.c$//; my $s="$devkit/libfcgi/$b.c";
                  "$b\$(OBJ_EXT): $s\n\t".
                  '$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) '."$s\n"; }
        eval 'package MY; sub postamble { $extrarules; }';

Is there a better way ?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About