# Rerun `sh Makefile.SH; make depend' after making any change.
-# Additional rules supported: libperls.a (for static linking),
-# ld2, perlld (dynamic linking tools)
+# Additional rules supported: libperl.a (for static linking),
+# ld2 and perlld removed
#
#! /bin/sh
cygwin.c: cygwin/cygwin.c
\$(LNS) cygwin/cygwin.c
-# shell script feeding perlld to decent perl
-ld2: $& Makefile perlld ${src}/cygwin/ld2.in
- @echo "extracting ld2 (with variable substitutions)"
- @$sed s,@buildpath@,$addtopath,g <${src}/cygwin/ld2.in >ld2
- @chmod a+x ld2
- @echo "installing ld2 into $installbin"
-# install is included in Cygwin distributions, and we make a note of the
-# requirement in the README.cygwin file. However, let's give them
-# a warning.
- @test -d ${installbin} || mkdir -p ${installbin}
- @/usr/bin/install -c -m 755 ld2 ${installbin}/ld2
- @if test ! -f ${installbin}/ld2; then \
- echo "*************************************************" ; \
- echo "Make will probably fail in a few more steps." ; \
- echo "When it does, copy \"ld2\" to a directory in" ; \
- echo "your path, other than \".\"." ; \
- echo "\"/usr/local/bin\" or something similar will do." ; \
- echo "Then restart make." ; \
- echo "*************************************************" ; \
- fi
-
-!GROK!THIS!
-
-$spitshell >>Makefile <<!GROK!THIS!
-
-# perlld parameters
-#
-# these ones are mandatory
-VERSION = '$version'
-
-# following are optional.
-EXPORT_ALL = 1
-
-# if some of extensions are empty,
-# no corresponding output will be done.
-# most probably, you'd like to have an export library
-DEF_EXT = .def
-EXP_EXT = .exp
-
-perlld: $& Makefile ${src}/cygwin/perlld.in
- @echo "extracting perlld (with variable substitutions)"
- @$sed -e s,@CC@,\${CC}, -e s,@EXPORT_ALL@,\${EXPORT_ALL},g \\
- -e s,@DEF_EXT@,\${DEF_EXT},g -e s,@EXP_EXT@,\${EXP_EXT},g \\
- -e s,@LIB_EXT@,\${LIB_EXT},g -e s,@VERSION@,\${VERSION},g \\
- ${src}/cygwin/perlld.in >perlld
-
!GROK!THIS!
# make sure that all library names are not malformed
libperl=`echo $libperl|sed -e s,\\\..*,,`
-
linklibperl=-l`echo $libperl|sed -e s,^lib,,`
+vers=`echo $version|tr '.' '_'`
+dllname=`echo $libperl|sed -e s,^lib,cyg,`$vers
$spitshell >>Makefile <<!GROK!THIS!
LIBPERL = $libperl
LLIBPERL= $linklibperl
+DLLNAME= $dllname
CLDFLAGS= -L$addtopath $ldflags
+LDDLFLAGS = --shared -L$addtopath $ldflags
+PLDLFLAGS =
CAT = $cat
AWK = $awk
!GROK!THIS!
$(AR) rcu $@ $(cwobj)
# dll and import library
-$(LIBPERL).dll$(LIB_EXT): $& $(cwobj) ld2
- $(LDLIBPTH) ld2 $(SHRPLDFLAGS) -o $(LIBPERL)$(DLSUFFIX) \
+$(LIBPERL).dll$(LIB_EXT): $& $(cwobj)
+ $(LDLIBPTH) $(CC) $(SHRPLDFLAGS) -o $(DLLNAME)$(DLSUFFIX) -Wl,--out-implib=$@ \
$(cwobj) $(libs)
# How to build executables.
miniperl.exe \
miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
- $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
+ $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(libs)
$(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
perl.exe \
./miniperl -Ilib '-MExtUtils::Manifest' \
-e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')"
-cygwin1.dll: /bin/cygwin1.dll
- cp /bin/cygwin1.dll .
-
-cygcrypt-0.dll: /bin/cygcrypt-0.dll
- cp /bin/cygcrypt-0.dll .
-
-test_prep: cygwin1.dll cygcrypt-0.dll
+test_prep:
!NO!SUBS!
-#
-# Perl script being a wrapper around the gnu ld. When a dll is specified to
-# to be built, special processing is done, else the standard ld is called.
-#
-
-# these are pretty mandatory
-my $CC = '@CC@';
-my $EXPORT_ALL = @EXPORT_ALL@;
-
-# if some of extensions are undefined,
-# no corresponding output will be done.
-# most probably, you'd like to have an export library
-# my $DEF_EXT = '@DEF_EXT@';
-# my $EXP_EXT = '@EXP_EXT@';
-my $LIB_EXT = '@LIB_EXT@';
-
-#my $DEBUG ="perlld.out";
-my $DEBUG =undef;
-
-my $args = join(" ",@ARGV); # get args
-my $verbose =grep(/^\-(v|\-verbose)$/, @ARGV);
-
-sub shellexec;
-
-if ($DEBUG) {
- open DEBUGFILE, ">>$DEBUG";
- print DEBUGFILE "\n--- " .localtime() ."\nargs:\n$args\n\nenvironment:\n";
- foreach (keys(%ENV)) { print DEBUGFILE $_, "=", $ENV{$_}, "\n"; };
-}
-
-if ($args !~ /\-o (\S+)/) {
- print DEBUGFILE "+ no dll output -- passing to gcc\n\n" if $DEBUG;
- shellexec("$CC $args\n");
-} else {
- my ($path, $command, $dllname, $libname) ='';
-
- $dllname =$1;
- print DEBUGFILE "output file: $dllname\n" if $DEBUG;
- # remove -o from args
- $args =~ s/(^| )\-o \S+/$1/;
-
- # Check for path:
- if( $dllname =~ /.*[\/\\]/){
- $dllname = $';
- $path = $&;
- $path =~ s,[/\\](\.[/\\])*,/,g;
- }
- if ($dllname =~ /\./) { $libname =$`; } else { $libname =$dllname; };
- my $v_e_r_s = '@VERSION@';
- $v_e_r_s =~ tr/./_/;
- if ( $dllname =~ /libperl.*/) {
- $dllname ="cygperl$v_e_r_s.dll";
- } else {
- $dllname ="$libname.dll";
- }
- $libname ="lib$libname" unless ($libname =~ /^lib/);
- print DEBUGFILE "dll name: $dllname\nimport library: $libname\npath: $path\n" if $DEBUG;
-
- $command ="$CC -shared -o $dllname";
-# $command .=" --verbose" if $verbose;
-
- $command .=" -Wl,--output-def=$libname$DEF_EXT" if $DEF_EXT;
- $command .=" -Wl,--output-exp=$libname$EXP_EXT" if $EXP_EXT;
- $command .=" -Wl,--out-implib=$libname.dll$LIB_EXT" if $LIB_EXT;
- $command .=" -Wl,--export-all-symbols" if $EXPORT_ALL;
- $command .=" -Wl,--enable-auto-import -Wl,--stack,8388608"; # always
- $command .=" -Wl,--enable-auto-image-base"; # always
-
- # other args are passed through
- shellexec("$command \\\n$args\n");
-
- if ($path) {
- $command ="mv $dllname";
- $command .=" $libname.dll$LIB_EXT" if $LIB_EXT;
- shellexec("$command $path\n");
- };
-};
-close DEBUGFILE if $DEBUG;
-
-#---------------------------------------------------------------------------
-sub shellexec {
- my $command = shift;
- print $command;
- print DEBUGFILE $command if $DEBUG;
- system($command) == 0
- or die "perlld: *** system() failed to execute\n$command\n";
-};
-
-1;