1 # This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
2 # some additional rules as well).
4 # Rerun `sh Makefile.SH; make depend' after making any change.
6 # Additional rules supported: perl_, aout_test, aout_install, use them
7 # for a.out style perl (which may fork).
9 perl_fullversion="5.00${PERL_VERSION}_$PERL_SUBVERSION"
11 *-thread*) perl_fullversion="${perl_fullversion}-threaded";;
14 dll_post="`echo $perl_fullversion | sum | sed -e 's/^0*//' | awk '{print $1}'`"
15 dll_post="`printf '%x' $dll_post | tr '[a-z]' '[A-Z]'`"
19 for 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"
26 $spitshell >>Makefile <<!GROK!THIS!
28 PERL_FULLVERSION = $perl_fullversion
31 AOUT_OPTIMIZE = \$(OPTIMIZE)
32 AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE)
34 AOUT_OBJ_EXT = $aout_obj_ext
35 AOUT_LIB_EXT = $aout_lib_ext
36 AOUT_LIBPERL = libperl$aout_lib_ext
37 AOUT_CLDFLAGS = $aout_ldflags
39 AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
40 AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
41 AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000
44 SO_CCCMD = \$(CC) $ccflags \$(OPTIMIZE)
47 PERL_DLL_LD_OPT = -Zmap -Zlinker /map
49 PERL_DLL_BASE = perl$dll_post
50 PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
51 TEST_PERL_DLL = perl_dll_t
52 CONFIG_ARGS = $config_args
53 AOUT_EXTRA_LIBS = $aout_extra_libs
57 $spitshell >>Makefile <<'!NO!SUBS!'
58 PREPLIBRARY_LIBPERL = $(LIBPERL)
59 $(LIBPERL): perl.imp $(PERL_DLL) perl5.def libperl_override.lib
60 emximp -o $(LIBPERL) perl.imp
61 cp $(LIBPERL) perl.lib
63 libperl_override.imp: os2/os2add.sym miniperl
64 ./miniperl -wnle 'print "$$_\t$(PERL_DLL_BASE)\t$$_\t?"' os2/os2add.sym > tmp.imp
65 echo 'strdup $(PERL_DLL_BASE) Perl_strdup ?' >> tmp.imp
66 echo 'putenv $(PERL_DLL_BASE) Perl_putenv ?' >> tmp.imp
67 sh mv-if-diff tmp.imp $@
69 libperl_override.lib: libperl_override.imp
70 emximp -o $@ libperl_override.imp
72 $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
73 emximp -o $(AOUT_LIBPERL_DLL) perl.imp
76 emximp -o perl.imp perl5.def
77 echo 'emx_calloc emxlibcm 400 ?' >> $@
78 echo 'emx_free emxlibcm 401 ?' >> $@
79 echo 'emx_malloc emxlibcm 402 ?' >> $@
80 echo 'emx_realloc emxlibcm 403 ?' >> $@
82 .PHONY: perl_dll installcmd aout_clean aout_install aout_install.perl \
83 perlrexx test_prep_perl_ test_prep_perl_sys test_prep_perl_stat \
84 test_prep_perl_stat_aout test_prep_various \
85 stat_aout_harness aout_harness stat_harness sys_harness all_harness \
86 stat_aout_test aout_test stat_test sys_test all_test
90 perl_dll_t: t/$(PERL_DLL)
92 t/$(PERL_DLL): $(PERL_DLL)
93 $(LNS) $(PERL_DLL) t/$(PERL_DLL)
95 $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
96 $(LD) $(LD_OPT) $(LDDLFLAGS) $(PERL_DLL_LD_OPT) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
98 perl5.olddef: perl.linkexp
99 echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
100 echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated'" >>$@
101 echo STACKSIZE 32768 >>$@
102 echo CODE LOADONCALL >>$@
103 echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
107 if [ ! -z "$myttyname" ] ; then
108 $spitshell >>Makefile <<'!NO!SUBS!'
109 echo ' "ttyname"' >>$@
113 $spitshell >>Makefile <<'!NO!SUBS!'
114 cat perl.linkexp >>$@
116 # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
119 perl.exports: perl.exp EXTERN.h perl.h
120 (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
121 echo "malloc\nrealloc\ncalloc\nfree") | \
122 $(CC) -DEMBED -E - | \
123 awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
125 perl.linkexp: perl.exports perl.map os2/os2.sym
126 cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
128 # We link miniperl statically, since .DLL depends on $(DYNALOADER)
130 miniperl.map: miniperl
132 miniperl.exe: miniperl
134 miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
135 $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) `echo $(obj)|sed -e 's/\bop\./opmini./g'` $(libs) -Zmap -Zlinker /map/PM:VIO
136 @./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
138 depend: os2ish.h dlfcn.h os2thread.h os2.c
140 # Stupid make? Needed...
141 os2$(OBJ_EXT) : os2.c
143 os2.c: os2/os2.c os2ish.h
146 dl_os2.c: os2/dl_os2.c os2ish.h
149 os2ish.h: os2/os2ish.h
152 os2thread.h: os2/os2thread.h
158 # Non-Forking dynamically loaded perl
160 perl___$(EXE_EXT) perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
161 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /map/PM:VIO
163 # This one is compiled -Zsys, so cannot do many things:
166 STAT_CLDFLAGS = -Zexe -Zomf -Zmt -Zstack 32000
168 # Non-forking dynamically loaded perl with a wrong CRT library:
170 perl_stat: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
171 $(SHRPENV) $(CC) $(STAT_CLDFLAGS) $(CCDLFLAGS) -o $@ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /map/PM:VIO
173 # Remove -Zcrtdll, add -Zsys
174 SYS_CLDFLAGS = $(STAT_CLDFLAGS) -Zsys
176 # Non-Forking dynamically loaded perl without EMX - so with wrong CRT library
178 perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
179 $(SHRPENV) $(CC) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o $@ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /map/PM:VIO
182 @perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
183 ./miniperl -Ilib os2/perl2cmd.pl $(INSTALLCMDDIR)
187 aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
188 AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
189 aout_ext = $(dynamic_ext) $(AOUT_EXTRA_LIBS)
190 aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(aout_ext)))
191 aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(aout_ext)))
193 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
194 DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
195 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
196 AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
198 $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
201 $(DYNALOADER_OBJ) : $(DYNALOADER)
204 $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
206 $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
210 $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
212 opmini$(AOUT_OBJ_EXT): op.c
213 $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c
215 perlmain(AOUT_OBJ_EXT): perlmain.c
216 $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
218 aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
219 sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
220 sh mv-if-diff tmp aout_perlmain.c
222 _preplibrary = miniperl lib/Config.pm lib/lib.pm lib/re.pm
224 miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT) $(_preplibrary)
225 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
227 # Forking statically loaded perl
229 # Need a miniperl_ dependency, since $(AOUT_DYNALOADER) is build via implicit
230 # rules, thus would not rebuild miniperl_ via an explicit rule
232 perl_$(EXE_EXT) perl_: $& miniperl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
233 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
236 STAT_AOUT_CLDFLAGS = -Zexe -Zmt -Zstack 32000
238 # Forking dynamically loaded perl with a wrong CRT library:
240 perl_stat_aout$(EXE_EXT) perl_stat_aout: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
241 $(SHRPENV) $(CC) $(STAT_AOUT_CLDFLAGS) $(CCDLFLAGS) -o $@ perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) `cat ext.libs` $(libs)
243 PERLREXX_DLL = perlrexx.dll
245 perl : perl__ perl___ $(PERLREXX_DLL)
247 # Dynamically loaded PM-application perl:
249 perl__$(EXE_EXT) perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
250 $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
252 # Forking dynamically loaded perl:
254 perl$(EXE_EXT) perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
255 $(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)
260 -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
262 aout_install: perl_ aout_install.perl
264 aout_install.perl: perl_ installperl
267 perlrexx: $(PERLREXX_DLL)
270 perlrexx.c: os2/perlrexx.c
273 # Remove -Zexe, add -Zdll -Zso. No stack needed
274 SO_CLDFLAGS = -Zdll -Zso -Zomf -Zmt -Zsys
276 # A callable-from-REXX DLL
278 $(PERLREXX_DLL): perlrexx$(OBJ_EXT) perlrexx.def
279 $(SHRPENV) $(CC) $(SO_CLDFLAGS) $(CCDLFLAGS) -o $@ perlrexx$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) perlrexx.def
281 perlrexx.def: miniperl $(_preplibrary)
282 echo "LIBRARY 'perlrexx' INITINSTANCE TERMINSTANCE" > tmp.def
283 echo "DESCRIPTION '@#perl5-porters@perl.org:`miniperl -Ilib -MConfig -e 'print \$$]'`#@ REXX to Perl `miniperl -Ilib -MConfig -e 'print \$$Config{version}'` interface'" >> tmp.def
284 echo "EXPORTS" >> tmp.def
285 echo ' "PERL"' >> tmp.def
286 echo ' "PERLTERM"' >> tmp.def
287 echo ' "PERLINIT"' >> tmp.def
288 echo ' "PERLEXIT"' >> tmp.def
289 echo ' "PERLEVAL"' >> tmp.def
290 echo ' "PERLLASTERROR"' >> tmp.def
291 echo ' "PERLEVALSUBCOMMAND"' >> tmp.def
292 echo ' "PERLEXPORTALL"' >> tmp.def
293 echo ' "PERLDROPALL"' >> tmp.def
294 echo ' "PERLDROPALLEXIT"' >> tmp.def
295 sh mv-if-diff tmp.def $@
298 perlrexx$(OBJ_EXT): perlrexx.c
299 $(SO_CCCMD) $(PLDLFLAGS) -c perlrexx.c
301 # To test with harness, one needed to HARNESS_IGNORE_EXITCODE=2
303 # Define to be empty to get a TTY test
304 REDIR_TEST = 2>&1 | tee 00_$@
306 test_prep_perl_: test_prep_pre miniperl_ ./perl_$(EXE_EXT)
307 PERL=./perl_ $(MAKE) _test_prep
309 test_prep_various: test_prep_pre miniperl $(dynamic_ext) $(TEST_PERL_DLL)
311 test_prep_perl_sys: test_prep_various ./perl_sys$(EXE_EXT)
312 PERL=./perl_sys $(MAKE) _test_prep
314 test_prep_perl___: test_prep_various ./perl___$(EXE_EXT)
315 PERL=./perl___ $(MAKE) _test_prep
317 test_prep_perl_stat: test_prep_various ./perl_stat$(EXE_EXT)
318 PERL=./perl_stat $(MAKE) _test_prep
320 test_prep_perl_stat_aout: test_prep_various ./perl_stat_aout$(EXE_EXT)
321 PERL=./perl_stat_aout $(MAKE) _test_prep
323 aout_test: test_prep_perl_
324 PERL=./perl_ $(MAKE) _test
326 aout_harness: test_prep_perl_
327 -PERL=./perl_ $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
329 sys_test: test_prep_perl_sys
330 PERL=./perl_sys $(MAKE) _test
332 sys_harness: test_prep_perl_sys
333 -PERL=./perl_sys $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
335 stat_test: test_prep_perl_stat
336 PERL=./perl_stat $(MAKE) _test
338 stat_harness: test_prep_perl_stat
339 -PERL=./perl_stat $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
341 stat_aout_test: test_prep_perl_stat_aout
342 PERL=./perl_stat_aout $(MAKE) _test
344 stat_aout_harness: test_prep_perl_stat_aout
345 -PERL=./perl_stat_aout $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
347 perl___test: test_prep_perl___
348 PERL=./perl___ $(MAKE) _test
350 perl___harness: test_prep_perl___
351 -PERL=./perl___ $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
353 all_test: test aout_test perl___test sys_test stat_test stat_aout_test
355 all_harness: test_harness aout_harness perl___harness sys_harness stat_harness stat_aout_harness
359 # Now we need to find directories in ./ext/ which are up to 3 level deep
360 # Currently (2001/06) there is no directories 4 levels deep.
361 # (Only directories so that there is no Makefile.PL some levels up matter.)
365 preci='ext/%/Makefile.aout '
368 # echo "...Checking '$d'..."
369 # skip the kid if the parent exists: cmp SDBFile/sdbm, done by MakeMaker
370 if test ! -e "$d/Makefile.PL"; then
371 # Need to treat subdirectories manually
372 # echo "...Checking subdirs of '$d'..."
376 if test ! -d $dd; then
379 if test -e "$dd/Makefile.PL"; then
380 if test "X$d_treated" = "X"; then
382 # echo "...Found parentless 2-level deep Makefile.PL's in $d/*/:" $d/*/Makefile.PL
384 preci="$preci $d/%/Makefile.aout"
387 # Need to treat subsubdirectories manually
391 if test ! -d $ddd; then
394 if test -e "$ddd/Makefile.PL"; then
395 if test "X$dd_treated" = "X"; then
397 # echo "...Found parentless 3-level deep Makefile.PL's in $dd/*/:" $dd/*/Makefile.PL
399 preci="$preci $dd/%/Makefile.aout"
408 $spitshell >>Makefile <<!GROK!THIS!
411 # Set this to FORCE to force a rebuilt of aout extensions
413 AOUT_EXTENSIONS_FORCE =
419 # Remove the leading component ext/
423 $spitshell >>Makefile <<!GROK!THIS!
424 lib/auto/$p/*/%.a : $d/%/Makefile.aout
425 @cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
426 cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
428 $d/%/Makefile.aout : miniperl_ \$(_preplibrary) \$(AOUT_EXTENSIONS_FORCE)
429 cd \$(dir \$@) ; ../../../../miniperl_ -I ../../../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl
438 $spitshell >>Makefile <<!GROK!THIS!
439 lib/auto/$p/*/%.a : $d/%/Makefile.aout
440 @cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
441 cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
443 $d/%/Makefile.aout : miniperl_ \$(_preplibrary) \$(AOUT_EXTENSIONS_FORCE)
444 cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl
450 # We need to special-case OS2/DLL/DLL.a, since the recipe above will
451 # try to find it in ext/OS2/DLL
453 $spitshell >>Makefile <<'!NO!SUBS!'
454 lib/auto/OS2/DLL/DLL.a : lib/auto/OS2/REXX/REXX.a
457 lib/auto/*/%.a : ext/%/Makefile.aout
458 @cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
459 cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
461 ext/%/Makefile.aout : miniperl_ $(_preplibrary) $(AOUT_EXTENSIONS_FORCE)
462 cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl