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

MakeMaker makefiles not portable enough for perlxstut

Thread Previous
From:
Ilya Zakharevich
Date:
April 11, 2003 13:27
Subject:
MakeMaker makefiles not portable enough for perlxstut
Message ID:
20030411202613.GA4200@math.berkeley.edu
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)

	$(AR) $(ADD_AR_OPT) $(AR_PRE_TARGET)libmylib$(LIB_EXT) $(AR_OBJECT)

[$(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
	$(CCCMD) $(CCCDLFLAGS) $(DEFINE) $(CC_PRE_TARGET)$@ $(mp)

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

Yours,
Ilya

Thread Previous


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