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

MakeMaker: handling source files in subdirs

Thread Next
From:
Sven Verdoolaege
Date:
September 25, 2001 23:09
Subject:
MakeMaker: handling source files in subdirs
Message ID:
20010925132158.A8531@pool.kotnet.org
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

.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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About