Commit | Line | Data |
f9c39ab5 |
1 | # This file is read by Makefile.SH to produce rules for $(LIBPERL) (and |
e95c8f0e |
2 | # some additional rules as well). |
3 | |
4 | # Rerun `sh Makefile.SH; make depend' after making any change. |
5 | |
6 | # Additional rules supported: perl_, aout_test, aout_install, use them |
7 | # for a.out style perl (which may fork). |
8 | |
cceca5ed |
9 | perl_fullversion="5.00${PERL_VERSION}_$PERL_SUBVERSION" |
3aefca04 |
10 | case "$archname" in |
cceca5ed |
11 | *-thread*) perl_fullversion="${perl_fullversion}-threaded";; |
3aefca04 |
12 | esac |
13 | |
3cfae81b |
14 | dll_post="`echo $perl_fullversion | sum | sed -e 's/^0*//' | awk '{print $1}'`" |
017f25f1 |
15 | dll_post="`printf '%x' $dll_post | tr '[a-z]' '[A-Z]'`" |
16 | |
e95c8f0e |
17 | $spitshell >>Makefile <<!GROK!THIS! |
18 | |
cceca5ed |
19 | PERL_FULLVERSION = $perl_fullversion |
3aefca04 |
20 | |
e96326af |
21 | OPTIMIZE = $optimize |
6756f2f0 |
22 | AOUT_OPTIMIZE = \$(OPTIMIZE) |
146174a9 |
23 | AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE) |
e95c8f0e |
24 | AOUT_AR = $aout_ar |
25 | AOUT_OBJ_EXT = $aout_obj_ext |
26 | AOUT_LIB_EXT = $aout_lib_ext |
f9c39ab5 |
27 | AOUT_LIBPERL = libperl$aout_lib_ext |
e95c8f0e |
28 | AOUT_CLDFLAGS = $aout_ldflags |
29 | |
dd3366de |
30 | AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext |
72ea3524 |
31 | AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK |
491527d0 |
32 | AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000 |
dd3366de |
33 | |
84902520 |
34 | LD_OPT = $optimize |
35 | |
3aefca04 |
36 | PERL_DLL_BASE = perl$dll_post |
37 | PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX) |
d6a255e6 |
38 | TEST_PERL_DLL = perl_dll_t |
017f25f1 |
39 | CONFIG_ARGS = $config_args |
3aefca04 |
40 | |
e95c8f0e |
41 | !GROK!THIS! |
82835e01 |
42 | |
43 | $spitshell >>Makefile <<'!NO!SUBS!' |
cb50131a |
44 | $(LIBPERL): perl.imp $(PERL_DLL) perl5.def |
f9c39ab5 |
45 | emximp -o $(LIBPERL) perl.imp |
82835e01 |
46 | |
3aefca04 |
47 | $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def |
dd3366de |
48 | emximp -o $(AOUT_LIBPERL_DLL) perl.imp |
49 | |
82835e01 |
50 | perl.imp: perl5.def |
51 | emximp -o perl.imp perl5.def |
df3ef7a9 |
52 | echo 'emx_calloc emxlibcm 400 ?' >> $@ |
53 | echo 'emx_free emxlibcm 401 ?' >> $@ |
54 | echo 'emx_malloc emxlibcm 402 ?' >> $@ |
55 | echo 'emx_realloc emxlibcm 403 ?' >> $@ |
82835e01 |
56 | |
017f25f1 |
57 | perl_dll: $(PERL_DLL) |
58 | |
d6a255e6 |
59 | perl_dll_t: t/$(PERL_DLL) |
60 | |
61 | t/$(PERL_DLL): $(PERL_DLL) |
62 | $(LNS) $(PERL_DLL) t/$(PERL_DLL) |
63 | |
3aefca04 |
64 | $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT) |
3cfae81b |
65 | $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false ) |
82835e01 |
66 | |
3cfae81b |
67 | perl5.olddef: perl.linkexp |
3aefca04 |
68 | echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@ |
cceca5ed |
69 | echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated, built with $(CONFIG_ARGS)'" >>$@ |
82835e01 |
70 | echo STACKSIZE 32768 >>$@ |
71 | echo CODE LOADONCALL >>$@ |
72 | echo DATA LOADONCALL NONSHARED MULTIPLE >>$@ |
73 | echo EXPORTS >>$@ |
82835e01 |
74 | !NO!SUBS! |
75 | |
76 | if [ ! -z "$myttyname" ] ; then |
77 | $spitshell >>Makefile <<'!NO!SUBS!' |
78 | echo ' "ttyname"' >>$@ |
79 | !NO!SUBS! |
80 | fi |
81 | |
82 | $spitshell >>Makefile <<'!NO!SUBS!' |
83 | cat perl.linkexp >>$@ |
84 | |
85 | # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@ |
86 | |
87 | |
82835e01 |
88 | perl.exports: perl.exp EXTERN.h perl.h |
ff68c719 |
89 | (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \ |
90 | echo "malloc\nrealloc\ncalloc\nfree") | \ |
82835e01 |
91 | $(CC) -DEMBED -E - | \ |
92 | awk '{if ($$2 == "") print $$1}' | sort | uniq > $@ |
93 | |
3aefca04 |
94 | perl.linkexp: perl.exports perl.map os2/os2.sym |
dd96f567 |
95 | cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp |
82835e01 |
96 | |
84902520 |
97 | # We link miniperl statically, since .DLL depends on $(DYNALOADER) |
98 | |
146174a9 |
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 |
82835e01 |
102 | |
dd96f567 |
103 | depend: os2ish.h dlfcn.h os2thread.h os2.c |
82835e01 |
104 | |
105 | # Stupid make? Needed... |
106 | os2$(OBJ_EXT) : os2.c |
107 | |
108 | os2.c: os2/os2.c os2ish.h |
491527d0 |
109 | cp -f $< $@ |
82835e01 |
110 | |
e95c8f0e |
111 | dl_os2.c: os2/dl_os2.c os2ish.h |
491527d0 |
112 | cp -f $< $@ |
e95c8f0e |
113 | |
82835e01 |
114 | os2ish.h: os2/os2ish.h |
491527d0 |
115 | cp -f $< $@ |
82835e01 |
116 | |
dd96f567 |
117 | os2thread.h: os2/os2thread.h |
491527d0 |
118 | cp -f $< $@ |
dd96f567 |
119 | |
e95c8f0e |
120 | dlfcn.h: os2/dlfcn.h |
491527d0 |
121 | cp -f $< $@ |
e95c8f0e |
122 | |
dd3366de |
123 | # This one is compiled OMF, so cannot fork(): |
124 | |
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) |
e95c8f0e |
127 | |
53285a48 |
128 | # This one is compiled -Zsys, so cannot do many things: |
129 | |
130 | # Remove -Zcrtdll, add -Zsys |
131 | SYS_CLDFLAGS = -Zexe -Zomf -Zmt -Zsys -Zstack 32000 |
132 | |
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) |
135 | |
82835e01 |
136 | installcmd : |
137 | perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR) |
138 | perl os2/perl2cmd.pl $(INSTALLCMDDIR) |
139 | |
e95c8f0e |
140 | # Aout section: |
141 | |
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))) |
146 | |
dd3366de |
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))) |
151 | |
152 | $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ) |
153 | emxaout -o $@ $< |
154 | |
155 | $(DYNALOADER_OBJ) : $(DYNALOADER) |
156 | @sh -c true |
157 | |
f9c39ab5 |
158 | $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT) |
dd3366de |
159 | rm -f $@ |
160 | $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj) |
e95c8f0e |
161 | |
162 | .c$(AOUT_OBJ_EXT): |
163 | $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c |
164 | |
146174a9 |
165 | opmini$(AOUT_OBJ_EXT): op.c |
166 | $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c |
167 | |
dd3366de |
168 | perlmain(AOUT_OBJ_EXT): perlmain.c |
169 | $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c |
170 | |
e95c8f0e |
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 |
174 | |
146174a9 |
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) |
e95c8f0e |
177 | |
f9c39ab5 |
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) |
e95c8f0e |
180 | |
dd3366de |
181 | perl : perl__ perl___ |
760ac839 |
182 | |
f9c39ab5 |
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 |
760ac839 |
185 | |
dd3366de |
186 | # Forking dynamically loaded perl: |
187 | |
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) |
190 | |
191 | clean: aout_clean |
192 | |
e95c8f0e |
193 | aout_clean: |
194 | -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout |
195 | |
196 | aout_install: perl_ aout_install.perl |
197 | |
198 | aout_install.perl: perl_ installperl |
199 | ./perl_ installperl |
200 | |
201 | aout_test: perl_ |
760ac839 |
202 | - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty |
203 | |
53285a48 |
204 | # To test with harness, set HARNESS_BAD_EXITCODE=2 |
205 | |
206 | sys_test: perl_sys |
207 | - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty |
208 | |
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 |
211 | |
017f25f1 |
212 | !NO!SUBS! |
e95c8f0e |
213 | |
017f25f1 |
214 | # Now we need to find directories in ./ext/ which are two level deep |
215 | |
216 | dirs='' |
217 | preci='ext/%/Makefile.aout ' |
218 | for d in ext/* |
219 | do |
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 |
224 | dirs="$dirs $d" |
225 | preci="$preci $d/%/Makefile.aout" |
226 | fi |
227 | done |
228 | |
229 | $spitshell >>Makefile <<!GROK!THIS! |
230 | .PRECIOUS : $preci |
231 | |
232 | !GROK!THIS! |
233 | |
234 | for d in $dirs |
235 | do |
236 | p=`basename $d` |
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= |
241 | |
242 | $d/%/Makefile.aout : miniperl_ |
243 | cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl |
244 | |
245 | !GROK!THIS! |
e95c8f0e |
246 | |
017f25f1 |
247 | done |
760ac839 |
248 | |
017f25f1 |
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= |
760ac839 |
253 | |
e95c8f0e |
254 | ext/%/Makefile.aout : miniperl_ |
760ac839 |
255 | cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl |
e95c8f0e |
256 | |
82835e01 |
257 | !NO!SUBS! |