Some escapes were mentioned twice, although they're not qr//-specific
[p5sagit/p5-mst-13.2.git] / cygwin / Makefile.SHs
CommitLineData
8736538c 1# This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
2# some additional rules as well).
3
4# Rerun `sh Makefile.SH; make depend' after making any change.
5
4f3b19ea 6# Additional rules supported: libperl.a (for static linking),
7# ld2 and perlld removed
8736538c 8#
9
10#! /bin/sh
8b56a609 11case $PERL_CONFIG_SH in
8736538c 12'')
13 if test -f config.sh; then TOP=.;
14 elif test -f ../config.sh; then TOP=..;
15 elif test -f ../../config.sh; then TOP=../..;
16 elif test -f ../../../config.sh; then TOP=../../..;
17 elif test -f ../../../../config.sh; then TOP=../../../..;
18 else
19 echo "Can't find config.sh."; exit 1
20 fi
21 . $TOP/config.sh
22 ;;
23esac
24
d7d7d533 25addtopath=`pwd | sed -e 's/ /\\\ /g'`
8736538c 26$spitshell >>Makefile <<!GROK!THIS!
27
5db16f6a 28cygwin.c: cygwin/cygwin.c
6b49d266 29 \$(LNS) cygwin/cygwin.c
5db16f6a 30
8736538c 31!GROK!THIS!
32
33# make sure that all library names are not malformed
34libperl=`echo $libperl|sed -e s,\\\..*,,`
8736538c 35linklibperl=-l`echo $libperl|sed -e s,^lib,,`
4f3b19ea 36vers=`echo $version|tr '.' '_'`
37dllname=`echo $libperl|sed -e s,^lib,cyg,`$vers
8736538c 38
39$spitshell >>Makefile <<!GROK!THIS!
40LIBPERL = $libperl
41LLIBPERL= $linklibperl
4f3b19ea 42DLLNAME= $dllname
8736538c 43CLDFLAGS= -L$addtopath $ldflags
4f3b19ea 44LDDLFLAGS = --shared -L$addtopath $ldflags
45PLDLFLAGS =
8736538c 46CAT = $cat
47AWK = $awk
48!GROK!THIS!
49
50case "$useshrplib" in
51true)
52 $spitshell >>Makefile <<'!NO!SUBS!'
f89d6eaa 53cwobj = $(obj)
8736538c 54
55# override default rule (NB: make croaks!) to force dll usage
56perlmain$(OBJ_EXT): perlmain.c
1cab015a 57 $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c
8736538c 58
59# library used to make statically linked executables
60# miniperl is linked against it to avoid libperl.dll locking
52ef5499 61$(LIBPERL)$(LIB_EXT): $& $(cwobj)
62 $(AR) rcu $@ $(cwobj)
8736538c 63
8736538c 64# dll and import library
4f3b19ea 65$(LIBPERL).dll$(LIB_EXT): $& $(cwobj)
66 $(LDLIBPTH) $(CC) $(SHRPLDFLAGS) -o $(DLLNAME)$(DLSUFFIX) -Wl,--out-implib=$@ \
52ef5499 67 $(cwobj) $(libs)
8736538c 68
69# How to build executables.
70
71# The miniperl -w -MExporter line is a basic cheap test to catch errors
72# before make goes on to run preplibrary and then MakeMaker on extensions.
73# This is very handy because later errors are often caused by miniperl
74# build problems but that's not obvious to the novice.
75# The Module used here must not depend on Config or any extensions.
76
30f43356 77miniperl.exe \
b53432e4 78miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
4f3b19ea 79 $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(libs)
bd0dd1d8 80 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
8736538c 81
b53432e4 82perl.exe \
83perl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
84 $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
85
86pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
87 $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
88
89purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
90 $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
91
92quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
93 $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
94
8736538c 95!NO!SUBS!
96 ;;
97*)
98$spitshell >>Makefile <<'!NO!SUBS!'
d493b042 99cwobj = $(obj)
8736538c 100
101# perl library
52ef5499 102$(LIBPERL)$(LIB_EXT): $& $(cwobj)
103 $(AR) rcu $@ $(cwobj)
8736538c 104
105# How to build executables.
106
107# The miniperl -w -MExporter line is a basic cheap test to catch errors
108# before make goes on to run preplibrary and then MakeMaker on extensions.
109# This is very handy because later errors are often caused by miniperl
110# build problems but that's not obvious to the novice.
111# The Module used here must not depend on Config or any extensions.
112
30f43356 113miniperl.exe \
bd0dd1d8 114miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
74294fdf 115 $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
bd0dd1d8 116 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
8736538c 117
b53432e4 118perl.exe \
119perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
120 $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs)
121
122pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
123 $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
124
125purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
126 $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
127
128quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs
129 $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
130
8736538c 131!NO!SUBS!
132 ;;
133esac
134
135# libperl.a is _the_ library both in dll and static cases
136# $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model
137#
b250498f 138# NOTE: The "-Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic" is required to give
139# the import library linking priority over the dynamic library, since both
140# the .dll and .a are in the same directory. When the new standard for
141# naming import/dynamic/static libraries emerges this should be updated.
142#
8736538c 143$spitshell >>Makefile <<'!NO!SUBS!'
144
8736538c 145
146!NO!SUBS!
147
148# suid perl is removed - i've never seen suid scripts for win32
149
150##############################################
151# additional targets
152
153$spitshell >>Makefile <<'!NO!SUBS!'
154
155DIST_DIRECTORY = .dist
156
157distdir: miniperl
158 -mkdir $(DIST_DIRECTORY)
90e2bcf9 159 ./miniperl -Ilib '-MExtUtils::Manifest' \
8736538c 160 -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')"
161
4f3b19ea 162test_prep:
2d4c99b6 163
8736538c 164!NO!SUBS!