This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
s/ar rcu/ar rc/ during linking
[perl5.git] / os2 / Makefile.SHs
CommitLineData
f9c39ab5 1# This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
e95c8f0e
PP
2# some additional rules as well).
3
4# Rerun `sh Makefile.SH; make depend' after making any change.
5
6# Additional rules supported: perl_, aout_test, aout_install, use them
7# for a.out style perl (which may fork).
8
cceca5ed 9perl_fullversion="5.00${PERL_VERSION}_$PERL_SUBVERSION"
3aefca04 10case "$archname" in
cceca5ed 11 *-thread*) perl_fullversion="${perl_fullversion}-threaded";;
3aefca04
IZ
12esac
13
3cfae81b 14dll_post="`echo $perl_fullversion | sum | sed -e 's/^0*//' | awk '{print $1}'`"
017f25f1
IZ
15dll_post="`printf '%x' $dll_post | tr '[a-z]' '[A-Z]'`"
16
b732e2e2
IZ
17aout_extra_libs=''
18aout_extra_sep=''
19for xxx in $aout_extra_static_ext; do
20 aout_extra_dir=`echo "$xxx" | sed -e 's/::/\//g'`
21 aout_extra_lib="lib/auto/$aout_extra_dir/"`basename "$aout_extra_dir"`
22 aout_extra_libs="$aout_extra_libs$aout_extra_sep$aout_extra_lib$aout_lib_ext"
23 aout_extra_sep=' '
24done
25
e95c8f0e
PP
26$spitshell >>Makefile <<!GROK!THIS!
27
cceca5ed 28PERL_FULLVERSION = $perl_fullversion
3aefca04 29
6756f2f0 30AOUT_OPTIMIZE = \$(OPTIMIZE)
0eb4ebd7 31AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE)
e95c8f0e
PP
32AOUT_AR = $aout_ar
33AOUT_OBJ_EXT = $aout_obj_ext
34AOUT_LIB_EXT = $aout_lib_ext
f9c39ab5 35AOUT_LIBPERL = libperl$aout_lib_ext
e95c8f0e
PP
36AOUT_CLDFLAGS = $aout_ldflags
37
dd3366de 38AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
72ea3524 39AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
491527d0 40AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000
dd3366de 41
764df951
IZ
42# No -DPERL_CORE
43SO_CCCMD = \$(CC) $ccflags \$(OPTIMIZE)
44
f07bc2fb 45LD_OPT = \$(OPTIMIZE)
59ad941d 46PERL_DLL_LD_OPT = -Zmap -Zlinker /map/li
84902520 47
3aefca04
IZ
48PERL_DLL_BASE = perl$dll_post
49PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
d6a255e6 50TEST_PERL_DLL = perl_dll_t
017f25f1 51CONFIG_ARGS = $config_args
b732e2e2 52AOUT_EXTRA_LIBS = $aout_extra_libs
3aefca04 53
e95c8f0e 54!GROK!THIS!
82835e01
PP
55
56$spitshell >>Makefile <<'!NO!SUBS!'
a64c954a 57PREPLIBRARY_LIBPERL = $(LIBPERL)
59ad941d 58$(LIBPERL): perl.imp perl5.def libperl_override.lib
f9c39ab5 59 emximp -o $(LIBPERL) perl.imp
dfcfdb64 60 cp $(LIBPERL) perl.lib
82835e01 61
59ad941d 62imp_version: $(FIRSTMAKEFILE)
b7da254d 63 echo $(PERL_DLL_BASE) > $@
59ad941d
IZ
64
65libperl_override.imp: os2/os2add.sym miniperl imp_version
b7da254d
RGS
66 ./miniperl -wnle 'print "$$_\t$(PERL_DLL_BASE)\t$$_\t?"' os2/os2add.sym > $@
67 echo 'strdup $(PERL_DLL_BASE) Perl_strdup ?' >> $@
68 echo 'putenv $(PERL_DLL_BASE) Perl_putenv ?' >> $@
5ba48348
JH
69
70libperl_override.lib: libperl_override.imp
71 emximp -o $@ libperl_override.imp
72
59ad941d 73libperl_dllmain.imp: imp_version
46aae397 74 echo 'main $(PERL_DLL_BASE) dll_perlmain ?' > $@
59ad941d
IZ
75
76libperl_dllmain.lib: libperl_dllmain.imp
77 emximp -o $@ libperl_dllmain.imp
78
79libperl_dllmain.a: libperl_dllmain.imp
80 emximp -o $@ libperl_dllmain.imp
81
3aefca04 82$(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
dd3366de
IZ
83 emximp -o $(AOUT_LIBPERL_DLL) perl.imp
84
59ad941d 85perl.imp: perl5.def imp_version
82835e01 86 emximp -o perl.imp perl5.def
df3ef7a9
IZ
87 echo 'emx_calloc emxlibcm 400 ?' >> $@
88 echo 'emx_free emxlibcm 401 ?' >> $@
89 echo 'emx_malloc emxlibcm 402 ?' >> $@
90 echo 'emx_realloc emxlibcm 403 ?' >> $@
82835e01 91
764df951
IZ
92.PHONY: perl_dll installcmd aout_clean aout_install aout_install.perl \
93 perlrexx test_prep_perl_ test_prep_perl_sys test_prep_perl_stat \
94 test_prep_perl_stat_aout test_prep_various \
95 stat_aout_harness aout_harness stat_harness sys_harness all_harness \
59ad941d
IZ
96 stat_aout_test aout_test stat_test sys_test all_test \
97 perl___harness test_harness_redir
764df951 98
017f25f1
IZ
99perl_dll: $(PERL_DLL)
100
d6a255e6
IZ
101perl_dll_t: t/$(PERL_DLL)
102
103t/$(PERL_DLL): $(PERL_DLL)
104 $(LNS) $(PERL_DLL) t/$(PERL_DLL)
105
59ad941d
IZ
106$(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT) perlmain$(OBJ_EXT) $(DYNALOADER)
107 $(LD) $(LD_OPT) $(LDDLFLAGS) $(PERL_DLL_LD_OPT) -o $@ perl$(OBJ_EXT) $(obj) perlmain$(OBJ_EXT) $(DYNALOADER) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
82835e01 108
3cfae81b 109perl5.olddef: perl.linkexp
3aefca04 110 echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
23da6c43 111 echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated'" >>$@
82835e01
PP
112 echo STACKSIZE 32768 >>$@
113 echo CODE LOADONCALL >>$@
114 echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
115 echo EXPORTS >>$@
82835e01
PP
116!NO!SUBS!
117
118if [ ! -z "$myttyname" ] ; then
119 $spitshell >>Makefile <<'!NO!SUBS!'
120 echo ' "ttyname"' >>$@
121!NO!SUBS!
122fi
123
124$spitshell >>Makefile <<'!NO!SUBS!'
125 cat perl.linkexp >>$@
126
127# grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
128
129
82835e01 130perl.exports: perl.exp EXTERN.h perl.h
ff68c719
PP
131 (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
132 echo "malloc\nrealloc\ncalloc\nfree") | \
82835e01
PP
133 $(CC) -DEMBED -E - | \
134 awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
135
3aefca04 136perl.linkexp: perl.exports perl.map os2/os2.sym
dd96f567 137 cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
82835e01 138
84902520
TB
139# We link miniperl statically, since .DLL depends on $(DYNALOADER)
140
a64c954a
IZ
141miniperl.map: miniperl
142
143miniperl.exe: miniperl
144
145miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
74294fdf 146 $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) `echo $(obj)|sed -e 's/\bop\./opmini./g'` $(libs) -Zmap -Zlinker /map/PM:VIO
bd0dd1d8 147 @./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
82835e01 148
dd96f567 149depend: os2ish.h dlfcn.h os2thread.h os2.c
82835e01
PP
150
151# Stupid make? Needed...
152os2$(OBJ_EXT) : os2.c
153
154os2.c: os2/os2.c os2ish.h
491527d0 155 cp -f $< $@
82835e01 156
e95c8f0e 157dl_os2.c: os2/dl_os2.c os2ish.h
491527d0 158 cp -f $< $@
e95c8f0e 159
82835e01 160os2ish.h: os2/os2ish.h
491527d0 161 cp -f $< $@
82835e01 162
dd96f567 163os2thread.h: os2/os2thread.h
491527d0 164 cp -f $< $@
dd96f567 165
e95c8f0e 166dlfcn.h: os2/dlfcn.h
491527d0 167 cp -f $< $@
e95c8f0e 168
764df951 169# Non-Forking dynamically loaded perl
59ad941d 170# Make many: they are useful in low-memory conditions (floppy boot? Lot of shared memory used?)
dd3366de 171
59ad941d
IZ
172perl___$(EXE_EXT) perl___: $& libperl_dllmain$(LIB_EXT)
173 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
174 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -Zstack 8192 -o perl___8 libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
175 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -Zstack 4096 -o perl___4 libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
176 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -Zstack 2048 -o perl___2 libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
177 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -Zstack 1024 -o perl___1 libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
178 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -Zstack 512 -o perl___05 libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
179 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -Zstack 320 -o perl___03 libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
e95c8f0e 180
53285a48
IZ
181# This one is compiled -Zsys, so cannot do many things:
182
764df951
IZ
183# Remove -Zcrtdll
184STAT_CLDFLAGS = -Zexe -Zomf -Zmt -Zstack 32000
185
186# Non-forking dynamically loaded perl with a wrong CRT library:
187
59ad941d
IZ
188perl_stat perl_stat$(EXE_EXT): $& libperl_dllmain$(LIB_EXT)
189 $(SHRPENV) $(CC) $(STAT_CLDFLAGS) $(CCDLFLAGS) -o perl_stat libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
764df951 190
53285a48 191# Remove -Zcrtdll, add -Zsys
764df951
IZ
192SYS_CLDFLAGS = $(STAT_CLDFLAGS) -Zsys
193
194# Non-Forking dynamically loaded perl without EMX - so with wrong CRT library
53285a48 195
59ad941d
IZ
196perl_sys perl_sys$(EXE_EXT): $& libperl_dllmain$(LIB_EXT)
197 $(SHRPENV) $(CC) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o perl_sys libperl_dllmain$(LIB_EXT) -Zlinker /map/PM:VIO
53285a48 198
82835e01 199installcmd :
e71dd89f
IZ
200 @perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
201 ./miniperl -Ilib os2/perl2cmd.pl $(INSTALLCMDDIR)
82835e01 202
e95c8f0e
PP
203# Aout section:
204
205aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
206AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
8ee276f3 207aout_ext = $(static_ext) $(dynamic_ext) $(AOUT_EXTRA_LIBS)
b732e2e2
IZ
208aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(aout_ext)))
209aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(aout_ext)))
e95c8f0e 210
dd3366de
IZ
211aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
212DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
213aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
214AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
215
216$(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
217 emxaout -o $@ $<
218
219$(DYNALOADER_OBJ) : $(DYNALOADER)
220 @sh -c true
221
9d419b5f
IZ
222# Quick hack to construct directories necessary for /*/% stuff:
223
224$(aout_static_ext) : $(static_ext) $(dynamic_ext)
225
f9c39ab5 226$(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
dd3366de 227 rm -f $@
9b2c64f1 228 $(AOUT_AR) rc $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
59ad941d 229 cp $@ perl$(AOUT_LIB_EXT)
e95c8f0e
PP
230
231.c$(AOUT_OBJ_EXT):
232 $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
233
bd0dd1d8
GS
234opmini$(AOUT_OBJ_EXT): op.c
235 $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c
236
dd3366de
IZ
237perlmain(AOUT_OBJ_EXT): perlmain.c
238 $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
239
59ad941d 240# Assume that extensions are at most 4 deep (this is so with 5.8.1)
8ee276f3 241aout_extlist: $(aout_static_ext) $(AOUT_DYNALOADER)
b7da254d 242 echo lib/auto/*.a lib/auto/*/*.a lib/auto/*/*/*.a lib/auto/*/*/*/*.a | tr ' ' '\n' | grep -v '\*' > $@
59ad941d
IZ
243
244aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit) $(aout_static_ext) writemain aout_extlist
b7da254d 245 sh writemain `cat aout_extlist` > aout_perlmain.c
e95c8f0e 246
764df951
IZ
247_preplibrary = miniperl lib/Config.pm lib/lib.pm lib/re.pm
248
249miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT) $(_preplibrary)
74294fdf 250 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
e95c8f0e 251
764df951
IZ
252# Forking statically loaded perl
253
dfcfdb64
IZ
254# Need a miniperl_ dependency, since $(AOUT_DYNALOADER) is build via implicit
255# rules, thus would not rebuild miniperl_ via an explicit rule
256
59ad941d
IZ
257perl_$(EXE_EXT) perl_: $& miniperl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs aout_extlist
258 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) $(OPTIMIZE) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) `cat aout_extlist` $(AOUT_LIBPERL) `cat ext.libs` $(libs)
e95c8f0e 259
764df951
IZ
260# Remove -Zcrtdll
261STAT_AOUT_CLDFLAGS = -Zexe -Zmt -Zstack 32000
262
263# Forking dynamically loaded perl with a wrong CRT library:
264
59ad941d
IZ
265perl_stat_aout$(EXE_EXT) perl_stat_aout: $& libperl_dllmain$(AOUT_LIB_EXT)
266 $(SHRPENV) $(CC) $(STAT_AOUT_CLDFLAGS) $(CCDLFLAGS) $(OPTIMIZE) -o perl_stat_aout libperl_dllmain$(AOUT_LIB_EXT)
764df951 267
9e2a34c1
IZ
268PERLREXX_DLL = perlrexx.dll
269
59ad941d 270perl perl$(EXE_EXT) : perl__ perl___ $(PERLREXX_DLL) $(PERL_DLL)
760ac839 271
764df951
IZ
272# Dynamically loaded PM-application perl:
273
59ad941d
IZ
274perl__$(EXE_EXT) perl__: $& libperl_dllmain$(LIB_EXT)
275 $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ libperl_dllmain$(LIB_EXT) -Zlinker /PM:PM
760ac839 276
dd3366de
IZ
277# Forking dynamically loaded perl:
278
59ad941d
IZ
279perl$(EXE_EXT) perl: $& libperl_dllmain$(AOUT_LIB_EXT)
280 $(CC) $(AOUT_CLDFLAGS_DLL) $(CCDLFLAGS) -o perl libperl_dllmain$(AOUT_LIB_EXT)
dd3366de
IZ
281
282clean: aout_clean
283
e95c8f0e 284aout_clean:
59ad941d 285 -rm *perl_.* *.o *.a lib/auto/*/*.a lib/auto/*/*/*.a lib/auto/*/*/*/*.a ext/*/Makefile.aout ext/*/*/Makefile.aout ext/*/*/*/Makefile.aout
e95c8f0e
PP
286
287aout_install: perl_ aout_install.perl
288
289aout_install.perl: perl_ installperl
70eaf669 290 ./perl_ installperl --destdir="$(DESTDIR)"
e95c8f0e 291
9e2a34c1 292perlrexx: $(PERLREXX_DLL)
764df951
IZ
293 @sh -c true
294
295perlrexx.c: os2/perlrexx.c
296 @cp -f os2/$@ $@
297
298# Remove -Zexe, add -Zdll -Zso. No stack needed
299SO_CLDFLAGS = -Zdll -Zso -Zomf -Zmt -Zsys
300
301# A callable-from-REXX DLL
302
9e2a34c1 303$(PERLREXX_DLL): perlrexx$(OBJ_EXT) perlrexx.def
764df951
IZ
304 $(SHRPENV) $(CC) $(SO_CLDFLAGS) $(CCDLFLAGS) -o $@ perlrexx$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) perlrexx.def
305
9e2a34c1 306perlrexx.def: miniperl $(_preplibrary)
b7da254d
RGS
307 echo "LIBRARY 'perlrexx' INITINSTANCE TERMINSTANCE" > $@
308 echo "DESCRIPTION '@#perl5-porters@perl.org:`miniperl -Ilib -MConfig -e 'print \$$]'`#@ REXX to Perl `miniperl -Ilib -MConfig -e 'print \$$Config{version}'` interface'" >> $@
309 echo "EXPORTS" >> $@
310 echo ' "PERL"' >> $@
311 echo ' "PERLTERM"' >> $@
312 echo ' "PERLINIT"' >> $@
313 echo ' "PERLEXIT"' >> $@
314 echo ' "PERLEVAL"' >> $@
315 echo ' "PERLLASTERROR"' >> $@
316 echo ' "PERLEVALSUBCOMMAND"' >> $@
317 echo ' "PERLEXPORTALL"' >> $@
318 echo ' "PERLDROPALL"' >> $@
319 echo ' "PERLDROPALLEXIT"' >> $@
764df951
IZ
320
321
322perlrexx$(OBJ_EXT): perlrexx.c
323 $(SO_CCCMD) $(PLDLFLAGS) -c perlrexx.c
324
325# To test with harness, one needed to HARNESS_IGNORE_EXITCODE=2
760ac839 326
764df951
IZ
327# Define to be empty to get a TTY test
328REDIR_TEST = 2>&1 | tee 00_$@
53285a48 329
764df951
IZ
330test_prep_perl_: test_prep_pre miniperl_ ./perl_$(EXE_EXT)
331 PERL=./perl_ $(MAKE) _test_prep
53285a48 332
764df951
IZ
333test_prep_various: test_prep_pre miniperl $(dynamic_ext) $(TEST_PERL_DLL)
334
335test_prep_perl_sys: test_prep_various ./perl_sys$(EXE_EXT)
336 PERL=./perl_sys $(MAKE) _test_prep
337
338test_prep_perl___: test_prep_various ./perl___$(EXE_EXT)
339 PERL=./perl___ $(MAKE) _test_prep
340
341test_prep_perl_stat: test_prep_various ./perl_stat$(EXE_EXT)
342 PERL=./perl_stat $(MAKE) _test_prep
343
344test_prep_perl_stat_aout: test_prep_various ./perl_stat_aout$(EXE_EXT)
345 PERL=./perl_stat_aout $(MAKE) _test_prep
346
347aout_test: test_prep_perl_
348 PERL=./perl_ $(MAKE) _test
349
350aout_harness: test_prep_perl_
351 -PERL=./perl_ $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
352
353sys_test: test_prep_perl_sys
354 PERL=./perl_sys $(MAKE) _test
355
356sys_harness: test_prep_perl_sys
357 -PERL=./perl_sys $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
358
359stat_test: test_prep_perl_stat
360 PERL=./perl_stat $(MAKE) _test
361
362stat_harness: test_prep_perl_stat
363 -PERL=./perl_stat $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
364
365stat_aout_test: test_prep_perl_stat_aout
366 PERL=./perl_stat_aout $(MAKE) _test
367
368stat_aout_harness: test_prep_perl_stat_aout
369 -PERL=./perl_stat_aout $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
370
371perl___test: test_prep_perl___
372 PERL=./perl___ $(MAKE) _test
373
374perl___harness: test_prep_perl___
375 -PERL=./perl___ $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
376
377all_test: test aout_test perl___test sys_test stat_test stat_aout_test
378
59ad941d
IZ
379test_harness_redir: test_prep
380 -PERL=./perl $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
381
382all_harness: test_harness_redir aout_harness perl___harness sys_harness stat_harness stat_aout_harness
53285a48 383
017f25f1 384!NO!SUBS!
e95c8f0e 385
5f929d0c
IZ
386# Now we need to find directories in ./ext/ which are up to 3 level deep
387# Currently (2001/06) there is no directories 4 levels deep.
388# (Only directories so that there is no Makefile.PL some levels up matter.)
017f25f1
IZ
389
390dirs=''
5f929d0c 391ddirs=''
017f25f1
IZ
392preci='ext/%/Makefile.aout '
393for d in ext/*
394do
5f929d0c
IZ
395 # echo "...Checking '$d'..."
396 # skip the kid if the parent exists: cmp SDBFile/sdbm, done by MakeMaker
397 if test ! -e "$d/Makefile.PL"; then
398 # Need to treat subdirectories manually
399 # echo "...Checking subdirs of '$d'..."
400 d_treated=''
401 for dd in $d/*
402 do
403 if test ! -d $dd; then
404 continue
405 fi
406 if test -e "$dd/Makefile.PL"; then
407 if test "X$d_treated" = "X"; then
408 d_treated=1
409 # echo "...Found parentless 2-level deep Makefile.PL's in $d/*/:" $d/*/Makefile.PL
410 dirs="$dirs $d"
411 preci="$preci $d/%/Makefile.aout"
412 fi
413 else
414 # Need to treat subsubdirectories manually
415 dd_treated=''
59ad941d 416 for ddd in $dd/* # ext/*/*/*/Makefile.PL
5f929d0c
IZ
417 do
418 if test ! -d $ddd; then
419 continue
420 fi
421 if test -e "$ddd/Makefile.PL"; then
422 if test "X$dd_treated" = "X"; then
423 dd_treated=1
424 # echo "...Found parentless 3-level deep Makefile.PL's in $dd/*/:" $dd/*/Makefile.PL
425 ddirs="$ddirs $dd"
426 preci="$preci $dd/%/Makefile.aout"
427 fi
428 fi
429 done
430 fi
431 done
017f25f1
IZ
432 fi
433done
434
59ad941d
IZ
435# ext/threads is marked as NORECURS, so we need to specialcase it
436if echo "$static_ext $dynamic_ext" | grep -q threads/shared ; then
437 preci="$preci ext/threads/%/Makefile.aout"
438 dirs="$dirs ext/threads"
439fi
440
017f25f1
IZ
441$spitshell >>Makefile <<!GROK!THIS!
442.PRECIOUS : $preci
443
764df951
IZ
444# Set this to FORCE to force a rebuilt of aout extensions
445
446AOUT_EXTENSIONS_FORCE =
447
017f25f1
IZ
448!GROK!THIS!
449
5f929d0c
IZ
450for d in $ddirs
451do
452 # Remove the leading component ext/
453 dd=`dirname $d`
454 pp=`basename $dd`
455 p=$pp/`basename $d`
456 $spitshell >>Makefile <<!GROK!THIS!
457lib/auto/$p/*/%.a : $d/%/Makefile.aout
458 @cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
459 cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
460
764df951 461$d/%/Makefile.aout : miniperl_ \$(_preplibrary) \$(AOUT_EXTENSIONS_FORCE)
c5635c9e 462 cd \$(dir \$@) ; ../../../../miniperl_ -I ../../../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl PERL_CORE=1
5f929d0c
IZ
463
464!GROK!THIS!
465
466done
467
017f25f1
IZ
468for d in $dirs
469do
470 p=`basename $d`
471 $spitshell >>Makefile <<!GROK!THIS!
5f929d0c
IZ
472lib/auto/$p/*/%.a : $d/%/Makefile.aout
473 @cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
474 cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
017f25f1 475
764df951 476$d/%/Makefile.aout : miniperl_ \$(_preplibrary) \$(AOUT_EXTENSIONS_FORCE)
c5635c9e 477 cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl PERL_CORE=1
017f25f1
IZ
478
479!GROK!THIS!
e95c8f0e 480
017f25f1 481done
760ac839 482
764df951 483# We need to special-case OS2/DLL/DLL.a, since the recipe above will
354c724e 484# try to find it in ext/OS2-DLL
764df951 485
017f25f1 486$spitshell >>Makefile <<'!NO!SUBS!'
764df951
IZ
487lib/auto/OS2/DLL/DLL.a : lib/auto/OS2/REXX/REXX.a
488 @sh -c true
489
017f25f1
IZ
490lib/auto/*/%.a : ext/%/Makefile.aout
491 @cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
492 cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
760ac839 493
dfcfdb64 494ext/%/Makefile.aout : miniperl_ $(_preplibrary) $(AOUT_EXTENSIONS_FORCE)
c5635c9e 495 cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl PERL_CORE=1
e95c8f0e 496
82835e01 497!NO!SUBS!