On 7/26/2003 6:06 PM, Nick Ing-Simmons wrote:

As yet perl on Win32 (as opposed to perl on Cygwin) is _never_ built
with GNU make.


We have yet to figure out how to get GNU make to work round Win32's
command line length issues.

A while back I was experimenting with a GNU make based build system for perl. I got as far as writing a makefile that would run on any Windows version and compile miniperl inside or outside of the source directory. (I stalled on the experiment because I needed an initial batch script to set up some macros for make, and while it was doable it was becoming quite ridiculous. For a laugh see one of my proof of concept batch scripts at <http://www.thepierianspring.org/which.html>.)


I use GNU make macros like the following to get past the length issues.

# $1 filename, $2 string
define WRITE_LINE
@ $(ECHO).$(2) >> $(1)

endef # keep blank line above

# $1 filename
define OPEN_LDSCRIPT
@ $(ECHO).> $(1)
endef

# $1 filename, $2 command, $3 values
define WRITE_LDSCRIPT
@ $(ECHO).$(2)( >> $(1)
  $(foreach value,$(3),$(call WRITE_LINE,$(1),$(value)))
@ $(ECHO).); >> $(1)
@ $(ECHO).>> $(1)
endef

...

miniperl.lds:
         @ $(ECHO) Writing ld script to build miniperl...
           $(call OPEN_LDSCRIPT,  $(LDSCRIPT))
           $(call WRITE_LDSCRIPT, $(LDSCRIPT), INPUT, $(MINI_OBJS))
           $(call WRITE_LDSCRIPT, $(LDSCRIPT), GROUP, $(MINI_LIBS))

$(MINIPERL): $(MINI_OBJS) miniperl.lds
           $(LD) $(LDFLAGS) -mconsole -o $@ $(LDSCRIPT)

The macros used to create the compiler & linker scripts are obviously dependent on $Config{cc}.

This is basically the same technique used in Module::Build::Platform::Windows to avoid commandline length issues, defaulting to using command scripts for compiling and linking.

It's been a while since I've experimented with the various make programs used by perl on MSWin32, but IIRC the only other place that makefiles fail when using GNU make (and pmake) is when invoking Test::Harness with a large number of test files and that is easily fixable.

In all other situations GNU make/MakeMaker works on MSWin32, and the above isssues only come up in a relatively small number of cases.

--
A little learning is a dang'rous thing;
Drink deep, or taste not the Pierian spring;
There shallow draughts intoxicate the brain;
And drinking largely sobers us again.
                - Alexander Pope




Reply via email to