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]'`"
17 $spitshell >>Makefile <<!GROK!THIS!
19 PERL_FULLVERSION = $perl_fullversion
22 AOUT_OPTIMIZE = \$(OPTIMIZE)
23 AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE)
25 AOUT_OBJ_EXT = $aout_obj_ext
26 AOUT_LIB_EXT = $aout_lib_ext
27 AOUT_LIBPERL = libperl$aout_lib_ext
28 AOUT_CLDFLAGS = $aout_ldflags
30 AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
31 AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
32 AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000
36 PERL_DLL_BASE = perl$dll_post
37 PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
38 TEST_PERL_DLL = perl_dll_t
39 CONFIG_ARGS = $config_args
43 $spitshell >>Makefile <<'!NO!SUBS!'
44 $(LIBPERL): perl.imp $(PERL_DLL) perl5.def
45 emximp -o $(LIBPERL) perl.imp
47 $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
48 emximp -o $(AOUT_LIBPERL_DLL) perl.imp
51 emximp -o perl.imp perl5.def
52 echo 'emx_calloc emxlibcm 400 ?' >> $@
53 echo 'emx_free emxlibcm 401 ?' >> $@
54 echo 'emx_malloc emxlibcm 402 ?' >> $@
55 echo 'emx_realloc emxlibcm 403 ?' >> $@
59 perl_dll_t: t/$(PERL_DLL)
61 t/$(PERL_DLL): $(PERL_DLL)
62 $(LNS) $(PERL_DLL) t/$(PERL_DLL)
64 $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
65 $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
67 perl5.olddef: perl.linkexp
68 echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
69 echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated, built with $(CONFIG_ARGS)'" >>$@
70 echo STACKSIZE 32768 >>$@
71 echo CODE LOADONCALL >>$@
72 echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
76 if [ ! -z "$myttyname" ] ; then
77 $spitshell >>Makefile <<'!NO!SUBS!'
78 echo ' "ttyname"' >>$@
82 $spitshell >>Makefile <<'!NO!SUBS!'
85 # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
88 perl.exports: perl.exp EXTERN.h perl.h
89 (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
90 echo "malloc\nrealloc\ncalloc\nfree") | \
91 $(CC) -DEMBED -E - | \
92 awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
94 perl.linkexp: perl.exports perl.map os2/os2.sym
95 cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
97 # We link miniperl statically, since .DLL depends on $(DYNALOADER)
99 miniperl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
100 $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) `echo $(obj)|sed -e 's/\bop\./opmini./g'` $(libs) -Zmap -Zlinker /map/PM:VIO
101 @./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
103 depend: os2ish.h dlfcn.h os2thread.h os2.c
105 # Stupid make? Needed...
106 os2$(OBJ_EXT) : os2.c
108 os2.c: os2/os2.c os2ish.h
111 dl_os2.c: os2/dl_os2.c os2ish.h
114 os2ish.h: os2/os2ish.h
117 os2thread.h: os2/os2thread.h
123 # This one is compiled OMF, so cannot fork():
125 perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
126 $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
128 # This one is compiled -Zsys, so cannot do many things:
130 # Remove -Zcrtdll, add -Zsys
131 SYS_CLDFLAGS = -Zexe -Zomf -Zmt -Zsys -Zstack 32000
133 perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
134 $(SHRPENV) $(CC) $(LARGE) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o perl_sys perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
137 perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
138 perl os2/perl2cmd.pl $(INSTALLCMDDIR)
142 aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
143 AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
144 aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(dynamic_ext)))
145 aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(dynamic_ext)))
147 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
148 DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
149 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
150 AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
152 $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
155 $(DYNALOADER_OBJ) : $(DYNALOADER)
158 $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
160 $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
163 $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
165 opmini$(AOUT_OBJ_EXT): op.c
166 $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c
168 perlmain(AOUT_OBJ_EXT): perlmain.c
169 $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
171 aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
172 sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
173 sh mv-if-diff tmp aout_perlmain.c
175 miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT)
176 $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
178 perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
179 $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
181 perl : perl__ perl___
183 perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
184 $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
186 # Forking dynamically loaded perl:
188 perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
189 $(CC) $(LARGE) $(AOUT_CLDFLAGS_DLL) $(CCDLFLAGS) -o perl perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) `cat ext.libs` $(libs)
194 -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
196 aout_install: perl_ aout_install.perl
198 aout_install.perl: perl_ installperl
202 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
204 # To test with harness, set HARNESS_BAD_EXITCODE=2
207 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
209 sys_harness: perl_sys
210 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && env HARNESS_BAD_EXITCODE=2 ./perl harness </dev/tty
214 # Now we need to find directories in ./ext/ which are two level deep
217 preci='ext/%/Makefile.aout '
220 # echo "Checking '$d'..."
221 f="`echo $d/*/Makefile.PL`"
222 # SDBFile/sdbm, skip kid makefile
223 if test ! -e "$d/Makefile.PL" -a ! "$f" = ""; then
225 preci="$preci $d/%/Makefile.aout"
229 $spitshell >>Makefile <<!GROK!THIS!
237 $spitshell >>Makefile <<!GROK!THIS!
238 lib/auto/$p/*/%.a : ext/$p/%/Makefile.aout
239 @cd ext/$p/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
240 cd ext/$p/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
242 $d/%/Makefile.aout : miniperl_
243 cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
249 $spitshell >>Makefile <<'!NO!SUBS!'
250 lib/auto/*/%.a : ext/%/Makefile.aout
251 @cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
252 cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
254 ext/%/Makefile.aout : miniperl_
255 cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl