CC: | skimo [...] kotnet.org |
Subject: | [RT #7742] MakeMaker: handling source files in subdirs |
What follows is a ticket which has been languishing in the Perl 5 RT
queue since being filed by Sven Verdoolaege in Sept 2001. It seems to
me to be more of a user question than a bug report. I am duplicating it
here in this queue in the hope that someone can respond and enable us to
close the original ticket.
Thank you very much.
Jim Keenan
##########
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
.c$(OBJ_EXT):
$(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"; }
@dist2;
eval 'package MY; sub postamble { $extrarules; }';
Is there a better way ?
skimo