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_version="5.00${PATCHLEVEL}_$SUBVERSION"
11 *-thread*) perl_version="${perl_version}-threaded";;
14 dll_post="`echo $perl_version | sum | awk '{print $1}'`"
15 dll_post="`printf '%x' $dll_post | tr '[a-z]' '[A-Z]'`"
17 $spitshell >>Makefile <<!GROK!THIS!
19 PERL_VERSION = $perl_version
21 AOUT_OPTIMIZE = \$(OPTIMIZE)
22 AOUT_CCCMD = \$(CC) $aout_ccflags \$(AOUT_OPTIMIZE)
24 AOUT_OBJ_EXT = $aout_obj_ext
25 AOUT_LIB_EXT = $aout_lib_ext
26 AOUT_LIBPERL = libperl$aout_lib_ext
27 AOUT_CLDFLAGS = $aout_ldflags
29 AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
30 AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
31 AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000
35 PERL_DLL_BASE = perl$dll_post
36 PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
37 CONFIG_ARGS = $config_args
41 $spitshell >>Makefile <<'!NO!SUBS!'
42 $(LIBPERL): perl.imp $(PERL_DLL) perl5.def
43 emximp -o $(LIBPERL) perl.imp
45 $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
46 emximp -o $(AOUT_LIBPERL_DLL) perl.imp
49 emximp -o perl.imp perl5.def
50 echo 'emx_calloc emxlibcm 400 ?' >> $@
51 echo 'emx_free emxlibcm 401 ?' >> $@
52 echo 'emx_malloc emxlibcm 402 ?' >> $@
53 echo 'emx_realloc emxlibcm 403 ?' >> $@
57 $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
58 $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def
60 perl5.def: perl.linkexp
61 echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
62 echo DESCRIPTION "'Perl interpreter v$(PERL_VERSION), export autogenerated, built with $(CONFIG_ARGS)'" >>$@
63 echo STACKSIZE 32768 >>$@
64 echo CODE LOADONCALL >>$@
65 echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
69 if [ ! -z "$myttyname" ] ; then
70 $spitshell >>Makefile <<'!NO!SUBS!'
71 echo ' "ttyname"' >>$@
75 $spitshell >>Makefile <<'!NO!SUBS!'
78 # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@
81 perl.exports: perl.exp EXTERN.h perl.h
82 (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
83 echo "malloc\nrealloc\ncalloc\nfree") | \
84 $(CC) -DEMBED -E - | \
85 awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
87 perl.linkexp: perl.exports perl.map os2/os2.sym
88 cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
90 # We link miniperl statically, since .DLL depends on $(DYNALOADER)
92 perl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
93 $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(obj) $(libs) -Zmap -Zlinker /map
94 awk '{if ($$3 == "") print $$2}' <miniperl.map | sort | uniq > perl.map
96 @./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
98 depend: os2ish.h dlfcn.h os2thread.h os2.c
100 # Stupid make? Needed...
101 os2$(OBJ_EXT) : os2.c
103 os2.c: os2/os2.c os2ish.h
106 dl_os2.c: os2/dl_os2.c os2ish.h
109 os2ish.h: os2/os2ish.h
112 os2thread.h: os2/os2thread.h
118 # This one is compiled OMF, so cannot fork():
120 perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
121 $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
123 # This one is compiled -Zsys, so cannot do many things:
125 # Remove -Zcrtdll, add -Zsys
126 SYS_CLDFLAGS = -Zexe -Zomf -Zmt -Zsys -Zstack 32000
128 perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
129 $(SHRPENV) $(CC) $(LARGE) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o perl_sys perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
132 perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
133 perl os2/perl2cmd.pl $(INSTALLCMDDIR)
137 aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
138 AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
139 aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(dynamic_ext)))
140 aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(dynamic_ext)))
142 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
143 DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
144 aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
145 AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
147 $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
150 $(DYNALOADER_OBJ) : $(DYNALOADER)
153 $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
155 $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
158 $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
160 perlmain(AOUT_OBJ_EXT): perlmain.c
161 $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
163 aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
164 sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
165 sh mv-if-diff tmp aout_perlmain.c
167 miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL)
168 $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs)
170 perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
171 $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
173 perl : perl__ perl___
175 perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
176 $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
178 # Forking dynamically loaded perl:
180 perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
181 $(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)
186 -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
188 aout_install: perl_ aout_install.perl
190 aout_install.perl: perl_ installperl
194 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
196 # To test with harness, set HARNESS_BAD_EXITCODE=2
199 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
201 sys_harness: perl_sys
202 - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && env HARNESS_BAD_EXITCODE=2 ./perl harness </dev/tty
206 # Now we need to find directories in ./ext/ which are two level deep
209 preci='ext/%/Makefile.aout '
212 # echo "Checking '$d'..."
213 f="`echo $d/*/Makefile.PL`"
214 # SDBFile/sdbm, skip kid makefile
215 if test ! -e "$d/Makefile.PL" -a ! "$f" = ""; then
217 preci="$preci $d/%/Makefile.aout"
221 $spitshell >>Makefile <<!GROK!THIS!
229 $spitshell >>Makefile <<!GROK!THIS!
230 lib/auto/$p/*/%.a : ext/$p/%/Makefile.aout
231 @cd ext/$p/\$(basename \$(notdir \$@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
232 cd ext/$p/\$(basename \$(notdir \$@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
234 $d/%/Makefile.aout : miniperl_
235 cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
241 $spitshell >>Makefile <<'!NO!SUBS!'
242 lib/auto/*/%.a : ext/%/Makefile.aout
243 @cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "\$(MAKE) config failed, continuing anyway..."
244 cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
246 ext/%/Makefile.aout : miniperl_
247 cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl