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
30 AOUT_OPTIMIZE = \$(OPTIMIZE)
31 AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE)
33 AOUT_OBJ_EXT = $aout_obj_ext
34 AOUT_LIB_EXT = $aout_lib_ext
35 AOUT_LIBPERL = libperl$aout_lib_ext
36 AOUT_CLDFLAGS = $aout_ldflags
38 AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
39 AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
40 AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000
43 SO_CCCMD = \$(CC) $ccflags \$(OPTIMIZE)
46 PERL_DLL_LD_OPT = -Zmap -Zlinker /map
48 PERL_DLL_BASE = perl$dll_post
49 PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
50 TEST_PERL_DLL = perl_dll_t
51 CONFIG_ARGS = $config_args
52 AOUT_EXTRA_LIBS = $aout_extra_libs
56 $spitshell >>Makefile <<'!NO!SUBS!'
57 PREPLIBRARY_LIBPERL = $(LIBPERL)
58 $(LIBPERL): perl.imp $(PERL_DLL) perl5.def libperl_override.lib
59 emximp -o $(LIBPERL) perl.imp
60 cp $(LIBPERL) perl.lib
62 libperl_override.imp: os2/os2add.sym miniperl
63 ./miniperl -wnle 'print "$$_\t$(PERL_DLL_BASE)\t$$_\t?"' os2/os2add.sym > tmp.imp
64 echo 'strdup $(PERL_DLL_BASE) Perl_strdup ?' >> tmp.imp
65 echo 'putenv $(PERL_DLL_BASE) Perl_putenv ?' >> tmp.imp
66 sh mv-if-diff tmp.imp $@
68 libperl_override.lib: libperl_override.imp
69 emximp -o $@ libperl_override.imp
71 $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
72 emximp -o $(AOUT_LIBPERL_DLL) perl.imp
75 emximp -o perl.imp perl5.def
76 echo 'emx_calloc emxlibcm 400 ?' >> $@
77 echo 'emx_free emxlibcm 401 ?' >> $@
78 echo 'emx_malloc emxlibcm 402 ?' >> $@
79 echo 'emx_realloc emxlibcm 403 ?' >> $@
81 .PHONY: perl_dll installcmd aout_clean aout_install aout_install.perl \
82 perlrexx test_prep_perl_ test_prep_perl_sys test_prep_perl_stat \
83 test_prep_perl_stat_aout test_prep_various \
84 stat_aout_harness aout_harness stat_harness sys_harness all_harness \
85 stat_aout_test aout_test stat_test sys_test all_test
89 perl_dll_t: t/$(PERL_DLL)
91 t/$(PERL_DLL): $(PERL_DLL)
92 $(LNS) $(PERL_DLL) t/$(PERL_DLL)
94 $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
95 $(LD) $(LD_OPT) $(LDDLFLAGS) $(PERL_DLL_LD_OPT) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
97 perl5.olddef: perl.linkexp
98 echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
99 echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated'" >>$@
100 echo STACKSIZE 32768 >>$@
101 echo CODE LOADONCALL >>$@
102 echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
106 if [ ! -z "$myttyname" ] ; then
107 $spitshell >>Makefile <<'!NO!SUBS!'
108 echo ' "ttyname"' >>$@
112 $spitshell >>Makefile <<'!NO!SUBS!'
113 cat perl.linkexp >>$@
115 # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
118 perl.exports: perl.exp EXTERN.h perl.h
119 (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
120 echo "malloc\nrealloc\ncalloc\nfree") | \
121 $(CC) -DEMBED -E - | \
122 awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
124 perl.linkexp: perl.exports perl.map os2/os2.sym
125 cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
127 # We link miniperl statically, since .DLL depends on $(DYNALOADER)
129 miniperl.map: miniperl
131 miniperl.exe: miniperl
133 miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
134 $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) `echo $(obj)|sed -e 's/\bop\./opmini./g'` $(libs) -Zmap -Zlinker /map/PM:VIO
135 @./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
137 depend: os2ish.h dlfcn.h os2thread.h os2.c
139 # Stupid make? Needed...
140 os2$(OBJ_EXT) : os2.c
142 os2.c: os2/os2.c os2ish.h
145 dl_os2.c: os2/dl_os2.c os2ish.h
148 os2ish.h: os2/os2ish.h
151 os2thread.h: os2/os2thread.h
157 # Non-Forking dynamically loaded perl
159 perl___$(EXE_EXT) perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
160 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /map/PM:VIO
162 # This one is compiled -Zsys, so cannot do many things:
165 STAT_CLDFLAGS = -Zexe -Zomf -Zmt -Zstack 32000
167 # Non-forking dynamically loaded perl with a wrong CRT library:
169 perl_stat: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
170 $(SHRPENV) $(CC) $(STAT_CLDFLAGS) $(CCDLFLAGS) -o $@ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /map/PM:VIO
172 # Remove -Zcrtdll, add -Zsys
173 SYS_CLDFLAGS = $(STAT_CLDFLAGS) -Zsys
175 # Non-Forking dynamically loaded perl without EMX - so with wrong CRT library
177 perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
178 $(SHRPENV) $(CC) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o $@ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /map/PM:VIO
181 @perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
182 ./miniperl -Ilib os2/perl2cmd.pl $(INSTALLCMDDIR)
186 aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
187 AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
188 aout_ext = $(dynamic_ext) $(AOUT_EXTRA_LIBS)
189 aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(aout_ext)))
190 aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(aout_ext)))
192 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
193 DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
194 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
195 AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
197 $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
200 $(DYNALOADER_OBJ) : $(DYNALOADER)
203 $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
205 $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
209 $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
211 opmini$(AOUT_OBJ_EXT): op.c
212 $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c
214 perlmain(AOUT_OBJ_EXT): perlmain.c
215 $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
217 aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
218 sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
219 sh mv-if-diff tmp aout_perlmain.c
221 _preplibrary = miniperl lib/Config.pm lib/lib.pm lib/re.pm
223 miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT) $(_preplibrary)
224 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
226 # Forking statically loaded perl
228 # Need a miniperl_ dependency, since $(AOUT_DYNALOADER) is build via implicit
229 # rules, thus would not rebuild miniperl_ via an explicit rule
231 perl_$(EXE_EXT) perl_: $& miniperl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
232 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
235 STAT_AOUT_CLDFLAGS = -Zexe -Zmt -Zstack 32000
237 # Forking dynamically loaded perl with a wrong CRT library:
239 perl_stat_aout$(EXE_EXT) perl_stat_aout: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
240 $(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)
242 PERLREXX_DLL = perlrexx.dll
244 perl : perl__ perl___ $(PERLREXX_DLL)
246 # Dynamically loaded PM-application perl:
248 perl__$(EXE_EXT) perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
249 $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
251 # Forking dynamically loaded perl:
253 perl$(EXE_EXT) perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
254 $(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)
259 -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
261 aout_install: perl_ aout_install.perl
263 aout_install.perl: perl_ installperl
266 perlrexx: $(PERLREXX_DLL)
269 perlrexx.c: os2/perlrexx.c
272 # Remove -Zexe, add -Zdll -Zso. No stack needed
273 SO_CLDFLAGS = -Zdll -Zso -Zomf -Zmt -Zsys
275 # A callable-from-REXX DLL
277 $(PERLREXX_DLL): perlrexx$(OBJ_EXT) perlrexx.def
278 $(SHRPENV) $(CC) $(SO_CLDFLAGS) $(CCDLFLAGS) -o $@ perlrexx$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) perlrexx.def
280 perlrexx.def: miniperl $(_preplibrary)
281 echo "LIBRARY 'perlrexx' INITINSTANCE TERMINSTANCE" > tmp.def
282 echo "DESCRIPTION '@#perl5-porters@perl.org:`miniperl -Ilib -MConfig -e 'print \$$]'`#@ REXX to Perl `miniperl -Ilib -MConfig -e 'print \$$Config{version}'` interface'" >> tmp.def
283 echo "EXPORTS" >> tmp.def
284 echo ' "PERL"' >> tmp.def
285 echo ' "PERLTERM"' >> tmp.def
286 echo ' "PERLINIT"' >> tmp.def
287 echo ' "PERLEXIT"' >> tmp.def
288 echo ' "PERLEVAL"' >> tmp.def
289 echo ' "PERLLASTERROR"' >> tmp.def
290 echo ' "PERLEVALSUBCOMMAND"' >> tmp.def
291 echo ' "PERLEXPORTALL"' >> tmp.def
292 echo ' "PERLDROPALL"' >> tmp.def
293 echo ' "PERLDROPALLEXIT"' >> tmp.def
294 sh mv-if-diff tmp.def $@
297 perlrexx$(OBJ_EXT): perlrexx.c
298 $(SO_CCCMD) $(PLDLFLAGS) -c perlrexx.c
300 # To test with harness, one needed to HARNESS_IGNORE_EXITCODE=2
302 # Define to be empty to get a TTY test
303 REDIR_TEST = 2>&1 | tee 00_$@
305 test_prep_perl_: test_prep_pre miniperl_ ./perl_$(EXE_EXT)
306 PERL=./perl_ $(MAKE) _test_prep
308 test_prep_various: test_prep_pre miniperl $(dynamic_ext) $(TEST_PERL_DLL)
310 test_prep_perl_sys: test_prep_various ./perl_sys$(EXE_EXT)
311 PERL=./perl_sys $(MAKE) _test_prep
313 test_prep_perl___: test_prep_various ./perl___$(EXE_EXT)
314 PERL=./perl___ $(MAKE) _test_prep
316 test_prep_perl_stat: test_prep_various ./perl_stat$(EXE_EXT)
317 PERL=./perl_stat $(MAKE) _test_prep
319 test_prep_perl_stat_aout: test_prep_various ./perl_stat_aout$(EXE_EXT)
320 PERL=./perl_stat_aout $(MAKE) _test_prep
322 aout_test: test_prep_perl_
323 PERL=./perl_ $(MAKE) _test
325 aout_harness: test_prep_perl_
326 -PERL=./perl_ $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
328 sys_test: test_prep_perl_sys
329 PERL=./perl_sys $(MAKE) _test
331 sys_harness: test_prep_perl_sys
332 -PERL=./perl_sys $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
334 stat_test: test_prep_perl_stat
335 PERL=./perl_stat $(MAKE) _test
337 stat_harness: test_prep_perl_stat
338 -PERL=./perl_stat $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
340 stat_aout_test: test_prep_perl_stat_aout
341 PERL=./perl_stat_aout $(MAKE) _test
343 stat_aout_harness: test_prep_perl_stat_aout
344 -PERL=./perl_stat_aout $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
346 perl___test: test_prep_perl___
347 PERL=./perl___ $(MAKE) _test
349 perl___harness: test_prep_perl___
350 -PERL=./perl___ $(MAKE) TESTFILE=harness _test $(REDIR_TEST)
352 all_test: test aout_test perl___test sys_test stat_test stat_aout_test
354 all_harness: test_harness aout_harness perl___harness sys_harness stat_harness stat_aout_harness
358 # Now we need to find directories in ./ext/ which are up to 3 level deep
359 # Currently (2001/06) there is no directories 4 levels deep.
360 # (Only directories so that there is no Makefile.PL some levels up matter.)
364 preci='ext/%/Makefile.aout '
367 # echo "...Checking '$d'..."
368 # skip the kid if the parent exists: cmp SDBFile/sdbm, done by MakeMaker
369 if test ! -e "$d/Makefile.PL"; then
370 # Need to treat subdirectories manually
371 # echo "...Checking subdirs of '$d'..."
375 if test ! -d $dd; then
378 if test -e "$dd/Makefile.PL"; then
379 if test "X$d_treated" = "X"; then
381 # echo "...Found parentless 2-level deep Makefile.PL's in $d/*/:" $d/*/Makefile.PL
383 preci="$preci $d/%/Makefile.aout"
386 # Need to treat subsubdirectories manually
390 if test ! -d $ddd; then
393 if test -e "$ddd/Makefile.PL"; then
394 if test "X$dd_treated" = "X"; then
396 # echo "...Found parentless 3-level deep Makefile.PL's in $dd/*/:" $dd/*/Makefile.PL
398 preci="$preci $dd/%/Makefile.aout"
407 $spitshell >>Makefile <<!GROK!THIS!
410 # Set this to FORCE to force a rebuilt of aout extensions
412 AOUT_EXTENSIONS_FORCE =
418 # Remove the leading component ext/
422 $spitshell >>Makefile <<!GROK!THIS!
423 lib/auto/$p/*/%.a : $d/%/Makefile.aout
424 @cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
425 cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
427 $d/%/Makefile.aout : miniperl_ \$(_preplibrary) \$(AOUT_EXTENSIONS_FORCE)
428 cd \$(dir \$@) ; ../../../../miniperl_ -I ../../../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl PERL_CORE=1
437 $spitshell >>Makefile <<!GROK!THIS!
438 lib/auto/$p/*/%.a : $d/%/Makefile.aout
439 @cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
440 cd $d/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
442 $d/%/Makefile.aout : miniperl_ \$(_preplibrary) \$(AOUT_EXTENSIONS_FORCE)
443 cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl PERL_CORE=1
449 # We need to special-case OS2/DLL/DLL.a, since the recipe above will
450 # try to find it in ext/OS2/DLL
452 $spitshell >>Makefile <<'!NO!SUBS!'
453 lib/auto/OS2/DLL/DLL.a : lib/auto/OS2/REXX/REXX.a
456 lib/auto/*/%.a : ext/%/Makefile.aout
457 @cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
458 cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
460 ext/%/Makefile.aout : miniperl_ $(_preplibrary) $(AOUT_EXTENSIONS_FORCE)
461 cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL FIRST_MAKEFILE=Makefile.aout INSTALLDIRS=perl PERL_CORE=1