in reply to stuck in perlxstut, example 4

Unindent the chunk of hardcoded Makefile in both Makefile.PL files.
sub MY::postamble { ' $(MYEXTLIB): mylib/Makefile cd mylib && $(MAKE) $(PASSTHRU) '; }
sub MY::top_targets { ' all :: static pure_all :: static static :: libmylib$(LIB_EXT) libmylib$(LIB_EXT): $(O_FILES) $(AR) cr libmylib$(LIB_EXT) $(O_FILES) $(RANLIB) libmylib$(LIB_EXT) '; }

(Replace the leading spaces with a tab)

The command to build the library doesn't work with MS's compiler, but it should work on Cygwin. For MS's compiler, the command needs to be changed from

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

to

$(AR) /out:$(LIB_EXT) $(O_FILES)

I don't know how to do this portably.

Replies are listed 'Best First'.
Re^2: stuck in perlxstut, example 4 (portability)
by ikegami (Patriarch) on Jun 29, 2009 at 04:06 UTC

    I don't know how to do this portably.

    To make the makefile portable, it seems all you need to do is use the default action. Change

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

    to

    libmylib$(LIB_EXT): $(O_FILES)
Re^2: stuck in perlxstut, example 4
by fugazi (Novice) on Jun 29, 2009 at 01:03 UTC
    Hi ikegami - thanks! That solved the problem. I hate to admit it, but a few tab's cost me about 7 hrs! Bernd.