Commit | Line | Data |
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 |
11 | case $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 | ;; |
23 | esac |
24 | |
d7d7d533 |
25 | addtopath=`pwd | sed -e 's/ /\\\ /g'` |
8736538c |
26 | $spitshell >>Makefile <<!GROK!THIS! |
27 | |
5db16f6a |
28 | cygwin.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 |
34 | libperl=`echo $libperl|sed -e s,\\\..*,,` |
8736538c |
35 | linklibperl=-l`echo $libperl|sed -e s,^lib,,` |
4f3b19ea |
36 | vers=`echo $version|tr '.' '_'` |
37 | dllname=`echo $libperl|sed -e s,^lib,cyg,`$vers |
8736538c |
38 | |
39 | $spitshell >>Makefile <<!GROK!THIS! |
40 | LIBPERL = $libperl |
41 | LLIBPERL= $linklibperl |
4f3b19ea |
42 | DLLNAME= $dllname |
8736538c |
43 | CLDFLAGS= -L$addtopath $ldflags |
4f3b19ea |
44 | LDDLFLAGS = --shared -L$addtopath $ldflags |
45 | PLDLFLAGS = |
8736538c |
46 | CAT = $cat |
47 | AWK = $awk |
48 | !GROK!THIS! |
49 | |
50 | case "$useshrplib" in |
51 | true) |
52 | $spitshell >>Makefile <<'!NO!SUBS!' |
f89d6eaa |
53 | cwobj = $(obj) |
8736538c |
54 | |
55 | # override default rule (NB: make croaks!) to force dll usage |
56 | perlmain$(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 |
77 | miniperl.exe \ |
b53432e4 |
78 | miniperl: $& 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 |
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 | |
8736538c |
95 | !NO!SUBS! |
96 | ;; |
97 | *) |
98 | $spitshell >>Makefile <<'!NO!SUBS!' |
d493b042 |
99 | cwobj = $(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 |
113 | miniperl.exe \ |
bd0dd1d8 |
114 | miniperl: $& 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 |
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 | |
8736538c |
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 | # |
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 | |
155 | DIST_DIRECTORY = .dist |
156 | |
157 | distdir: miniperl |
158 | -mkdir $(DIST_DIRECTORY) |
90e2bcf9 |
159 | ./miniperl -Ilib '-MExtUtils::Manifest' \ |
8736538c |
160 | -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')" |
161 | |
4f3b19ea |
162 | test_prep: |
2d4c99b6 |
163 | |
8736538c |
164 | !NO!SUBS! |