This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
typo in perl5100delta.pod
[perl5.git] / cygwin / Makefile.SHs
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
6 # Additional rules supported: libperl.a (for static linking),
7 # ld2 and perlld removed
8 #
9
10 #! /bin/sh
11 case $PERL_CONFIG_SH in
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         ;;
23 esac
24
25 addtopath=`pwd | sed -e 's/ /\\\ /g'`
26 $spitshell >>Makefile <<!GROK!THIS!
27
28 cygwin.c: cygwin/cygwin.c
29         \$(LNS) cygwin/cygwin.c
30
31 !GROK!THIS!
32
33 # make sure that all library names are not malformed
34 libperl=`echo $libperl|sed -e s,\\\..*,,`
35 linklibperl=-l`echo $libperl|sed -e s,^lib,,`
36 vers=`echo $version|tr '.' '_'`
37 dllname=`echo $libperl|sed -e s,^lib,cyg,`$vers
38
39 $spitshell >>Makefile <<!GROK!THIS!
40 LIBPERL = $libperl
41 LLIBPERL= $linklibperl
42 DLLNAME= $dllname
43 CLDFLAGS= -L$addtopath $ldflags
44 LDDLFLAGS = --shared -L$addtopath $ldflags
45 PLDLFLAGS = 
46 CAT = $cat
47 AWK = $awk
48 !GROK!THIS!
49
50 case "$useshrplib" in
51 true)
52         $spitshell >>Makefile <<'!NO!SUBS!'
53 cwobj = $(obj)
54
55 # override default rule (NB: make croaks!) to force dll usage
56 perlmain$(OBJ_EXT): perlmain.c
57         $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c
58
59 # library used to make statically linked executables
60 # miniperl is linked against it to avoid libperl.dll locking
61 $(LIBPERL)$(LIB_EXT): $& $(cwobj)
62         $(AR) rcu $@ $(cwobj)
63
64 # dll and import library
65 $(LIBPERL).dll$(LIB_EXT): $& $(cwobj)
66         $(LDLIBPTH) $(CC) $(SHRPLDFLAGS) -o $(DLLNAME)$(DLSUFFIX) -Wl,--out-implib=$@ \
67         $(cwobj) $(libs)
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
77 miniperl.exe \
78 miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
79         $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(libs)
80         $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
81
82 perl.exe \
83 perl: $& 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
86 pureperl: $& 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
89 purecovperl: $& 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
92 quantperl: $& 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
95 !NO!SUBS!
96         ;;
97 *)
98 $spitshell >>Makefile <<'!NO!SUBS!'
99 cwobj = $(obj)
100
101 # perl library
102 $(LIBPERL)$(LIB_EXT): $& $(cwobj)
103         $(AR) rcu $@ $(cwobj)
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
113 miniperl.exe \
114 miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT)
115         $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
116         $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
117
118 perl.exe \
119 perl: $& 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
122 pureperl: $& 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
125 purecovperl: $& 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
128 quantperl: $& 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
131 !NO!SUBS!
132         ;;
133 esac
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 #
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 #
143 $spitshell >>Makefile <<'!NO!SUBS!'
144
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
155 DIST_DIRECTORY = .dist
156
157 distdir: miniperl
158         -mkdir $(DIST_DIRECTORY)
159         ./miniperl -Ilib '-MExtUtils::Manifest' \
160         -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')"
161
162 test_prep: 
163
164 !NO!SUBS!