develooper Front page | perl.perl5.porters | Postings from April 2003

MakeMaker makefiles not portable enough for perlxstut

Thread Previous
Ilya Zakharevich
April 11, 2003 13:27
MakeMaker makefiles not portable enough for perlxstut
Message ID:
Currently perlxstut says to use this chunk

	libmylib$(LIB_EXT): $(O_FILES)
		$(AR) cr libmylib$(LIB_EXT) $(O_FILES)
		$(RANLIB) libmylib$(LIB_EXT)

in your Makefile.PL.  But this won't work with non-Unixish compilers.  The
syntax which has a chance to be portable is (quoted from Math::Pari)


[$(ADD_AR_OPT) is optional, but very convenient on OS/2].  MakeMaker defines
$(AR_STATIC_ARGS), but this can't be used as AR_PRE_TARGET, since the latter
one does not have a space between it and the library file name.

Is it possible to make MakeMaker define AR_PRE_TARGET?  Then one can put
portable instructions into perlxstut.

Here is how Math::Pari is doing this (works where it worked before,
AND on Borland/M$ compilers):

    macro	=> {
		    MY_CC_PRE_TARGET => ($Using_ms_vc
					 ? '-Fo'
					 : ($Using_Borland
					    ? '-o': '-o $(MY_EMPTY_STR)')),
		    MY_AR_PRE_TARGET => ($Using_ms_vc
					 ? '-out:'
					 : ($Using_Borland
					    ? '' : 'cr $(MY_EMPTY_STR)')),
		    MY_AR_OBJECT => ($Using_Borland
				     ? '$(OBJECT:^"+")'
				      : '$(OBJECT)'),
		    MY_EMPTY_STR  => '',

(of course, with newer MakeMaker one should use $(AR_STATIC_ARGS)
instead of 'cr').

The macro CC_PRE_TARGET is also very useful, this time for build of object
files.  It is used like this:

  mp$(OBJ_EXT): $(mp) pariinl.h

(as in `cc -c -o file.o some/dir/file.c': portable specification of output
object file name).


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