1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
# This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
# some additional rules as well).
# Rerun `sh Makefile.SH; make depend' after making any change.
# Additional rules supported: perl_, aout_test, aout_install, use them
# for a.out style perl (which may fork).
perl_fullversion="5.00${PERL_VERSION}_$PERL_SUBVERSION"
case "$archname" in
*-thread*) perl_fullversion="${perl_fullversion}-threaded";;
esac
dll_post="`echo $perl_fullversion | sum | sed -e 's/^0*//' | awk '{print $1}'`"
dll_post="`printf '%x' $dll_post | tr '[a-z]' '[A-Z]'`"
aout_extra_libs=''
aout_extra_sep=''
for xxx in $aout_extra_static_ext; do
aout_extra_dir=`echo "$xxx" | sed -e 's/::/\//g'`
aout_extra_lib="lib/auto/$aout_extra_dir/"`basename "$aout_extra_dir"`
aout_extra_libs="$aout_extra_libs$aout_extra_sep$aout_extra_lib$aout_lib_ext"
aout_extra_sep=' '
done
$spitshell >>Makefile <<!GROK!THIS!
PERL_FULLVERSION = $perl_fullversion
OPTIMIZE = $optimize
AOUT_OPTIMIZE = \$(OPTIMIZE)
AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE)
AOUT_AR = $aout_ar
AOUT_OBJ_EXT = $aout_obj_ext
AOUT_LIB_EXT = $aout_lib_ext
AOUT_LIBPERL = libperl$aout_lib_ext
AOUT_CLDFLAGS = $aout_ldflags
AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000
LD_OPT = \$(OPTIMIZE)
PERL_DLL_BASE = perl$dll_post
PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
TEST_PERL_DLL = perl_dll_t
CONFIG_ARGS = $config_args
AOUT_EXTRA_LIBS = $aout_extra_libs
!GROK!THIS!
$spitshell >>Makefile <<'!NO!SUBS!'
$(LIBPERL): perl.imp $(PERL_DLL) perl5.def libperl_override.lib
emximp -o $(LIBPERL) perl.imp
libperl_override.imp: os2/os2add.sym
./miniperl -wnle 'print "$$_\t$(PERL_DLL_BASE)\t$$_\t?"' os2/os2add.sym > tmp.imp
echo 'strdup $(PERL_DLL_BASE) Perl_strdup ?' >> tmp.imp
echo 'putenv $(PERL_DLL_BASE) Perl_putenv ?' >> tmp.imp
sh mv-if-diff tmp.imp $@
libperl_override.lib: libperl_override.imp
emximp -o $@ libperl_override.imp
$(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
emximp -o $(AOUT_LIBPERL_DLL) perl.imp
perl.imp: perl5.def
emximp -o perl.imp perl5.def
echo 'emx_calloc emxlibcm 400 ?' >> $@
echo 'emx_free emxlibcm 401 ?' >> $@
echo 'emx_malloc emxlibcm 402 ?' >> $@
echo 'emx_realloc emxlibcm 403 ?' >> $@
perl_dll: $(PERL_DLL)
perl_dll_t: t/$(PERL_DLL)
t/$(PERL_DLL): $(PERL_DLL)
$(LNS) $(PERL_DLL) t/$(PERL_DLL)
$(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
$(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
perl5.olddef: perl.linkexp
echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated'" >>$@
echo STACKSIZE 32768 >>$@
echo CODE LOADONCALL >>$@
echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
echo EXPORTS >>$@
!NO!SUBS!
if [ ! -z "$myttyname" ] ; then
$spitshell >>Makefile <<'!NO!SUBS!'
echo ' "ttyname"' >>$@
!NO!SUBS!
fi
$spitshell >>Makefile <<'!NO!SUBS!'
cat perl.linkexp >>$@
# grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
perl.exports: perl.exp EXTERN.h perl.h
(echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
echo "malloc\nrealloc\ncalloc\nfree") | \
$(CC) -DEMBED -E - | \
awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
perl.linkexp: perl.exports perl.map os2/os2.sym
cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
# We link miniperl statically, since .DLL depends on $(DYNALOADER)
miniperl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
$(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) `echo $(obj)|sed -e 's/\bop\./opmini./g'` $(libs) -Zmap -Zlinker /map/PM:VIO
@./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
depend: os2ish.h dlfcn.h os2thread.h os2.c
# Stupid make? Needed...
os2$(OBJ_EXT) : os2.c
os2.c: os2/os2.c os2ish.h
cp -f $< $@
dl_os2.c: os2/dl_os2.c os2ish.h
cp -f $< $@
os2ish.h: os2/os2ish.h
cp -f $< $@
os2thread.h: os2/os2thread.h
cp -f $< $@
dlfcn.h: os2/dlfcn.h
cp -f $< $@
# This one is compiled OMF, so cannot fork():
perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
$(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
# This one is compiled -Zsys, so cannot do many things:
# Remove -Zcrtdll, add -Zsys
SYS_CLDFLAGS = -Zexe -Zomf -Zmt -Zsys -Zstack 32000
perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
$(SHRPENV) $(CC) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o perl_sys perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
installcmd :
@perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
./miniperl -Ilib os2/perl2cmd.pl $(INSTALLCMDDIR)
# Aout section:
aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
aout_ext = $(dynamic_ext) $(AOUT_EXTRA_LIBS)
aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(aout_ext)))
aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(aout_ext)))
aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
$(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
emxaout -o $@ $<
$(DYNALOADER_OBJ) : $(DYNALOADER)
@sh -c true
$(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
rm -f $@
$(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
.c$(AOUT_OBJ_EXT):
$(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
opmini$(AOUT_OBJ_EXT): op.c
$(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c
perlmain(AOUT_OBJ_EXT): perlmain.c
$(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
sh mv-if-diff tmp aout_perlmain.c
miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT)
$(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
$(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
perl : perl__ perl___
perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
$(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
# Forking dynamically loaded perl:
perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
$(CC) $(AOUT_CLDFLAGS_DLL) $(CCDLFLAGS) -o perl perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) `cat ext.libs` $(libs)
clean: aout_clean
aout_clean:
-rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
aout_install: perl_ aout_install.perl
aout_install.perl: perl_ installperl
./perl_ installperl
aout_test: perl_
- cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
# To test with harness, set HARNESS_BAD_EXITCODE=2
sys_test: perl_sys
- cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
sys_harness: perl_sys
- cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && env HARNESS_BAD_EXITCODE=2 ./perl harness </dev/tty
!NO!SUBS!
# Now we need to find directories in ./ext/ which are up to 3 level deep
# Currently (2001/06) there is no directories 4 levels deep.
# (Only directories so that there is no Makefile.PL some levels up matter.)
dirs=''
ddirs=''
preci='ext/%/Makefile.aout '
for d in ext/*
do
# echo "...Checking '$d'..."
# skip the kid if the parent exists: cmp SDBFile/sdbm, done by MakeMaker
if test ! -e "$d/Makefile.PL"; then
# Need to treat subdirectories manually
# echo "...Checking subdirs of '$d'..."
d_treated=''
for dd in $d/*
do
if test ! -d $dd; then
continue
fi
if test -e "$dd/Makefile.PL"; then
if test "X$d_treated" = "X"; then
d_treated=1
# echo "...Found parentless 2-level deep Makefile.PL's in $d/*/:" $d/*/Makefile.PL
dirs="$dirs $d"
preci="$preci $d/%/Makefile.aout"
fi
else
# Need to treat subsubdirectories manually
dd_treated=''
for ddd in $dd/*
do
if test ! -d $ddd; then
continue
fi
if test -e "$ddd/Makefile.PL"; then
if test "X$dd_treated" = "X"; then
dd_treated=1
# echo "...Found parentless 3-level deep Makefile.PL's in $dd/*/:" $dd/*/Makefile.PL
ddirs="$ddirs $dd"
preci="$preci $dd/%/Makefile.aout"
fi
fi
done
fi
done
fi
done
$spitshell >>Makefile <<!GROK!THIS!
.PRECIOUS : $preci
!GROK!THIS!
for d in $ddirs
do
# Remove the leading component ext/
dd=`dirname $d`
pp=`basename $dd`
p=$pp/`basename $d`
$spitshell >>Makefile <<!GROK!THIS!
lib/auto/$p/*/%.a : $d/%/Makefile.aout
@cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
$d/%/Makefile.aout : miniperl_
cd \$(dir \$@) ; ../../../../miniperl_ -I ../../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
!GROK!THIS!
done
for d in $dirs
do
p=`basename $d`
$spitshell >>Makefile <<!GROK!THIS!
lib/auto/$p/*/%.a : $d/%/Makefile.aout
@cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
$d/%/Makefile.aout : miniperl_
cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
!GROK!THIS!
done
$spitshell >>Makefile <<'!NO!SUBS!'
lib/auto/*/%.a : ext/%/Makefile.aout
@cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
ext/%/Makefile.aout : miniperl_
cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
!NO!SUBS!
|