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
45 PERL_DLL_BASE = perl$dll_post
46 PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
47 TEST_PERL_DLL = perl_dll_t
48 CONFIG_ARGS = $config_args
49 AOUT_EXTRA_LIBS = $aout_extra_libs
53 $spitshell >>Makefile <<'!NO!SUBS!'
54 $(LIBPERL): perl.imp $(PERL_DLL) perl5.def libperl_override.lib
55 emximp -o $(LIBPERL) perl.imp
57 libperl_override.imp: os2/os2add.sym
58 ./miniperl -wnle 'print "$$_\t$(PERL_DLL_BASE)\t$$_\t?"' os2/os2add.sym > tmp.imp
59 echo 'strdup $(PERL_DLL_BASE) Perl_strdup ?' >> tmp.imp
60 echo 'putenv $(PERL_DLL_BASE) Perl_putenv ?' >> tmp.imp
61 sh mv-if-diff tmp.imp $@
63 libperl_override.lib: libperl_override.imp
64 emximp -o $@ libperl_override.imp
66 $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
67 emximp -o $(AOUT_LIBPERL_DLL) perl.imp
70 emximp -o perl.imp perl5.def
71 echo 'emx_calloc emxlibcm 400 ?' >> $@
72 echo 'emx_free emxlibcm 401 ?' >> $@
73 echo 'emx_malloc emxlibcm 402 ?' >> $@
74 echo 'emx_realloc emxlibcm 403 ?' >> $@
78 perl_dll_t: t/$(PERL_DLL)
80 t/$(PERL_DLL): $(PERL_DLL)
81 $(LNS) $(PERL_DLL) t/$(PERL_DLL)
83 $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
84 $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false )
86 perl5.olddef: perl.linkexp
87 echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
88 echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated'" >>$@
89 echo STACKSIZE 32768 >>$@
90 echo CODE LOADONCALL >>$@
91 echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
95 if [ ! -z "$myttyname" ] ; then
96 $spitshell >>Makefile <<'!NO!SUBS!'
97 echo ' "ttyname"' >>$@
101 $spitshell >>Makefile <<'!NO!SUBS!'
102 cat perl.linkexp >>$@
104 # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
107 perl.exports: perl.exp EXTERN.h perl.h
108 (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
109 echo "malloc\nrealloc\ncalloc\nfree") | \
110 $(CC) -DEMBED -E - | \
111 awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
113 perl.linkexp: perl.exports perl.map os2/os2.sym
114 cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
116 # We link miniperl statically, since .DLL depends on $(DYNALOADER)
118 miniperl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
119 $(CC) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) `echo $(obj)|sed -e 's/\bop\./opmini./g'` $(libs) -Zmap -Zlinker /map/PM:VIO
120 @./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
122 depend: os2ish.h dlfcn.h os2thread.h os2.c
124 # Stupid make? Needed...
125 os2$(OBJ_EXT) : os2.c
127 os2.c: os2/os2.c os2ish.h
130 dl_os2.c: os2/dl_os2.c os2ish.h
133 os2ish.h: os2/os2ish.h
136 os2thread.h: os2/os2thread.h
142 # This one is compiled OMF, so cannot fork():
144 perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
145 $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
147 # This one is compiled -Zsys, so cannot do many things:
149 # Remove -Zcrtdll, add -Zsys
150 SYS_CLDFLAGS = -Zexe -Zomf -Zmt -Zsys -Zstack 32000
152 perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
153 $(SHRPENV) $(CC) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o perl_sys perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
156 @perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
157 ./miniperl -Ilib os2/perl2cmd.pl $(INSTALLCMDDIR)
161 aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
162 AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
163 aout_ext = $(dynamic_ext) $(AOUT_EXTRA_LIBS)
164 aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(aout_ext)))
165 aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(aout_ext)))
167 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
168 DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
169 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
170 AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
172 $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
175 $(DYNALOADER_OBJ) : $(DYNALOADER)
178 $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
180 $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
183 $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
185 opmini$(AOUT_OBJ_EXT): op.c
186 $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c
188 perlmain(AOUT_OBJ_EXT): perlmain.c
189 $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
191 aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
192 sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
193 sh mv-if-diff tmp aout_perlmain.c
195 miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT)
196 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
198 perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
199 $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
201 perl : perl__ perl___
203 perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
204 $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
206 # Forking dynamically loaded perl:
208 perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
209 $(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)
214 -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
216 aout_install: perl_ aout_install.perl
218 aout_install.perl: perl_ installperl
222 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
224 # To test with harness, set HARNESS_BAD_EXITCODE=2
227 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
229 sys_harness: perl_sys
230 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && env HARNESS_BAD_EXITCODE=2 ./perl harness </dev/tty
234 # Now we need to find directories in ./ext/ which are two level deep
237 preci='ext/%/Makefile.aout '
240 # echo "Checking '$d'..."
241 f="`echo $d/*/Makefile.PL`"
242 # SDBFile/sdbm, skip kid makefile
243 if test ! -e "$d/Makefile.PL" -a ! "$f" = ""; then
245 preci="$preci $d/%/Makefile.aout"
249 $spitshell >>Makefile <<!GROK!THIS!
257 $spitshell >>Makefile <<!GROK!THIS!
258 lib/auto/$p/*/%.a : ext/$p/%/Makefile.aout
259 @cd ext/$p/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
260 cd ext/$p/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
262 $d/%/Makefile.aout : miniperl_
263 cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
269 $spitshell >>Makefile <<'!NO!SUBS!'
270 lib/auto/*/%.a : ext/%/Makefile.aout
271 @cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
272 cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
274 ext/%/Makefile.aout : miniperl_
275 cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl