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 '.' '_'` |
7e73a980 |
37 | dllname=`echo $libperl|sed -e s,^lib,cyg,``echo $vers|sed -e s,_[0-9]$,,` |
38 | # append "d" suffix to -DDEBUGGING build: cygperl5_10d.dll |
39 | case $config_args in |
40 | *DEBUGGING*) |
41 | dllname="${dllname}"d |
42 | ;; |
43 | esac |
44 | # added -mms-bitfields to be able to link to MSVC win32 bitfields libs |
45 | # (4 byte instead of 2 byte alignment) |
8736538c |
46 | |
47 | $spitshell >>Makefile <<!GROK!THIS! |
48 | LIBPERL = $libperl |
49 | LLIBPERL= $linklibperl |
4f3b19ea |
50 | DLLNAME= $dllname |
8736538c |
51 | CLDFLAGS= -L$addtopath $ldflags |
4f3b19ea |
52 | LDDLFLAGS = --shared -L$addtopath $ldflags |
7e73a980 |
53 | CCFLAGS=$ccflags -mms-bitfields |
4f3b19ea |
54 | PLDLFLAGS = |
8736538c |
55 | CAT = $cat |
56 | AWK = $awk |
57 | !GROK!THIS! |
58 | |
59 | case "$useshrplib" in |
60 | true) |
61 | $spitshell >>Makefile <<'!NO!SUBS!' |
f89d6eaa |
62 | cwobj = $(obj) |
8736538c |
63 | |
64 | # override default rule (NB: make croaks!) to force dll usage |
65 | perlmain$(OBJ_EXT): perlmain.c |
1cab015a |
66 | $(CCCMD) $(PLDLFLAGS) -DUSEIMPORTLIB $*.c |
8736538c |
67 | |
68 | # library used to make statically linked executables |
69 | # miniperl is linked against it to avoid libperl.dll locking |
52ef5499 |
70 | $(LIBPERL)$(LIB_EXT): $& $(cwobj) |
71 | $(AR) rcu $@ $(cwobj) |
8736538c |
72 | |
8736538c |
73 | # dll and import library |
4f3b19ea |
74 | $(LIBPERL).dll$(LIB_EXT): $& $(cwobj) |
75 | $(LDLIBPTH) $(CC) $(SHRPLDFLAGS) -o $(DLLNAME)$(DLSUFFIX) -Wl,--out-implib=$@ \ |
52ef5499 |
76 | $(cwobj) $(libs) |
8736538c |
77 | |
78 | # How to build executables. |
79 | |
80 | # The miniperl -w -MExporter line is a basic cheap test to catch errors |
81 | # before make goes on to run preplibrary and then MakeMaker on extensions. |
82 | # This is very handy because later errors are often caused by miniperl |
83 | # build problems but that's not obvious to the novice. |
84 | # The Module used here must not depend on Config or any extensions. |
85 | |
30f43356 |
86 | miniperl.exe \ |
b53432e4 |
87 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT) |
4f3b19ea |
88 | $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(libs) |
bd0dd1d8 |
89 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest |
8736538c |
90 | |
b53432e4 |
91 | perl.exe \ |
92 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
93 | $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
94 | |
95 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
96 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
97 | |
98 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
99 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
100 | |
101 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL).dll$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
102 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
103 | |
8736538c |
104 | !NO!SUBS! |
105 | ;; |
106 | *) |
107 | $spitshell >>Makefile <<'!NO!SUBS!' |
d493b042 |
108 | cwobj = $(obj) |
8736538c |
109 | |
110 | # perl library |
52ef5499 |
111 | $(LIBPERL)$(LIB_EXT): $& $(cwobj) |
112 | $(AR) rcu $@ $(cwobj) |
8736538c |
113 | |
114 | # How to build executables. |
115 | |
116 | # The miniperl -w -MExporter line is a basic cheap test to catch errors |
117 | # before make goes on to run preplibrary and then MakeMaker on extensions. |
118 | # This is very handy because later errors are often caused by miniperl |
119 | # build problems but that's not obvious to the novice. |
120 | # The Module used here must not depend on Config or any extensions. |
121 | |
30f43356 |
122 | miniperl.exe \ |
bd0dd1d8 |
123 | miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) opmini$(OBJ_EXT) |
74294fdf |
124 | $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs) |
bd0dd1d8 |
125 | $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest |
8736538c |
126 | |
b53432e4 |
127 | perl.exe \ |
128 | perl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
129 | $(SHRPENV) $(LDLIBPTH) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) -Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic `cat ext.libs` $(libs) |
130 | |
131 | pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
132 | $(SHRPENV) $(LDLIBPTH) purify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
133 | |
134 | purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
135 | $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
136 | |
137 | quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL)$(LIB_EXT) $(DYNALOADER) $(static_ext) ext.libs |
138 | $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) |
139 | |
8736538c |
140 | !NO!SUBS! |
141 | ;; |
142 | esac |
143 | |
144 | # libperl.a is _the_ library both in dll and static cases |
145 | # $(LIBPERL)$(LIB_EXT) expands to this name dependless of build model |
146 | # |
b250498f |
147 | # NOTE: The "-Wl,-Bstatic $(LLIBPERL) -Wl,-Bdynamic" is required to give |
148 | # the import library linking priority over the dynamic library, since both |
149 | # the .dll and .a are in the same directory. When the new standard for |
150 | # naming import/dynamic/static libraries emerges this should be updated. |
151 | # |
8736538c |
152 | $spitshell >>Makefile <<'!NO!SUBS!' |
153 | |
8736538c |
154 | |
155 | !NO!SUBS! |
156 | |
157 | # suid perl is removed - i've never seen suid scripts for win32 |
158 | |
159 | ############################################## |
160 | # additional targets |
161 | |
162 | $spitshell >>Makefile <<'!NO!SUBS!' |
163 | |
164 | DIST_DIRECTORY = .dist |
165 | |
166 | distdir: miniperl |
167 | -mkdir $(DIST_DIRECTORY) |
90e2bcf9 |
168 | ./miniperl -Ilib '-MExtUtils::Manifest' \ |
8736538c |
169 | -e "ExtUtils::Manifest::manicopy(ExtUtils::Manifest::maniread(),'$(DIST_DIRECTORY)')" |
170 | |
4f3b19ea |
171 | test_prep: |
2d4c99b6 |
172 | |
8736538c |
173 | !NO!SUBS! |