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 | |
b732e2e2 |
17 | aout_extra_libs='' |
18 | aout_extra_sep='' |
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" |
23 | aout_extra_sep=' ' |
24 | done |
25 | |
e95c8f0e |
26 | $spitshell >>Makefile <<!GROK!THIS! |
27 | |
cceca5ed |
28 | PERL_FULLVERSION = $perl_fullversion |
3aefca04 |
29 | |
e96326af |
30 | OPTIMIZE = $optimize |
6756f2f0 |
31 | AOUT_OPTIMIZE = \$(OPTIMIZE) |
0eb4ebd7 |
32 | AOUT_CCCMD = \$(CC) -DPERL_CORE $aout_ccflags \$(AOUT_OPTIMIZE) |
e95c8f0e |
33 | AOUT_AR = $aout_ar |
34 | AOUT_OBJ_EXT = $aout_obj_ext |
35 | AOUT_LIB_EXT = $aout_lib_ext |
f9c39ab5 |
36 | AOUT_LIBPERL = libperl$aout_lib_ext |
e95c8f0e |
37 | AOUT_CLDFLAGS = $aout_ldflags |
38 | |
dd3366de |
39 | AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext |
72ea3524 |
40 | AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK |
491527d0 |
41 | AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll -Zstack 32000 |
dd3366de |
42 | |
84902520 |
43 | LD_OPT = $optimize |
44 | |
3aefca04 |
45 | PERL_DLL_BASE = perl$dll_post |
46 | PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX) |
d6a255e6 |
47 | TEST_PERL_DLL = perl_dll_t |
017f25f1 |
48 | CONFIG_ARGS = $config_args |
b732e2e2 |
49 | AOUT_EXTRA_LIBS = $aout_extra_libs |
3aefca04 |
50 | |
e95c8f0e |
51 | !GROK!THIS! |
82835e01 |
52 | |
53 | $spitshell >>Makefile <<'!NO!SUBS!' |
5ba48348 |
54 | $(LIBPERL): perl.imp $(PERL_DLL) perl5.def libperl_override.lib |
f9c39ab5 |
55 | emximp -o $(LIBPERL) perl.imp |
82835e01 |
56 | |
5ba48348 |
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 $@ |
62 | |
63 | libperl_override.lib: libperl_override.imp |
64 | emximp -o $@ libperl_override.imp |
65 | |
3aefca04 |
66 | $(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def |
dd3366de |
67 | emximp -o $(AOUT_LIBPERL_DLL) perl.imp |
68 | |
82835e01 |
69 | perl.imp: perl5.def |
70 | emximp -o perl.imp perl5.def |
df3ef7a9 |
71 | echo 'emx_calloc emxlibcm 400 ?' >> $@ |
72 | echo 'emx_free emxlibcm 401 ?' >> $@ |
73 | echo 'emx_malloc emxlibcm 402 ?' >> $@ |
74 | echo 'emx_realloc emxlibcm 403 ?' >> $@ |
82835e01 |
75 | |
017f25f1 |
76 | perl_dll: $(PERL_DLL) |
77 | |
d6a255e6 |
78 | perl_dll_t: t/$(PERL_DLL) |
79 | |
80 | t/$(PERL_DLL): $(PERL_DLL) |
81 | $(LNS) $(PERL_DLL) t/$(PERL_DLL) |
82 | |
3aefca04 |
83 | $(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT) |
3cfae81b |
84 | $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def || ( rm $(PERL_DLL) && sh -c false ) |
82835e01 |
85 | |
3cfae81b |
86 | perl5.olddef: perl.linkexp |
3aefca04 |
87 | echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@ |
23da6c43 |
88 | echo DESCRIPTION "'Perl interpreter v$(PERL_FULLVERSION), export autogenerated'" >>$@ |
82835e01 |
89 | echo STACKSIZE 32768 >>$@ |
90 | echo CODE LOADONCALL >>$@ |
91 | echo DATA LOADONCALL NONSHARED MULTIPLE >>$@ |
92 | echo EXPORTS >>$@ |
82835e01 |
93 | !NO!SUBS! |
94 | |
95 | if [ ! -z "$myttyname" ] ; then |
96 | $spitshell >>Makefile <<'!NO!SUBS!' |
97 | echo ' "ttyname"' >>$@ |
98 | !NO!SUBS! |
99 | fi |
100 | |
101 | $spitshell >>Makefile <<'!NO!SUBS!' |
102 | cat perl.linkexp >>$@ |
103 | |
104 | # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@ |
105 | |
106 | |
82835e01 |
107 | perl.exports: perl.exp EXTERN.h perl.h |
ff68c719 |
108 | (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \ |
109 | echo "malloc\nrealloc\ncalloc\nfree") | \ |
82835e01 |
110 | $(CC) -DEMBED -E - | \ |
111 | awk '{if ($$2 == "") print $$1}' | sort | uniq > $@ |
112 | |
3aefca04 |
113 | perl.linkexp: perl.exports perl.map os2/os2.sym |
dd96f567 |
114 | cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp |
82835e01 |
115 | |
84902520 |
116 | # We link miniperl statically, since .DLL depends on $(DYNALOADER) |
117 | |
bd0dd1d8 |
118 | miniperl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) |
74294fdf |
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 |
bd0dd1d8 |
120 | @./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest |
82835e01 |
121 | |
dd96f567 |
122 | depend: os2ish.h dlfcn.h os2thread.h os2.c |
82835e01 |
123 | |
124 | # Stupid make? Needed... |
125 | os2$(OBJ_EXT) : os2.c |
126 | |
127 | os2.c: os2/os2.c os2ish.h |
491527d0 |
128 | cp -f $< $@ |
82835e01 |
129 | |
e95c8f0e |
130 | dl_os2.c: os2/dl_os2.c os2ish.h |
491527d0 |
131 | cp -f $< $@ |
e95c8f0e |
132 | |
82835e01 |
133 | os2ish.h: os2/os2ish.h |
491527d0 |
134 | cp -f $< $@ |
82835e01 |
135 | |
dd96f567 |
136 | os2thread.h: os2/os2thread.h |
491527d0 |
137 | cp -f $< $@ |
dd96f567 |
138 | |
e95c8f0e |
139 | dlfcn.h: os2/dlfcn.h |
491527d0 |
140 | cp -f $< $@ |
e95c8f0e |
141 | |
dd3366de |
142 | # This one is compiled OMF, so cannot fork(): |
143 | |
144 | perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs |
74294fdf |
145 | $(SHRPENV) $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) |
e95c8f0e |
146 | |
53285a48 |
147 | # This one is compiled -Zsys, so cannot do many things: |
148 | |
149 | # Remove -Zcrtdll, add -Zsys |
150 | SYS_CLDFLAGS = -Zexe -Zomf -Zmt -Zsys -Zstack 32000 |
151 | |
152 | perl_sys: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs |
74294fdf |
153 | $(SHRPENV) $(CC) $(SYS_CLDFLAGS) $(CCDLFLAGS) -o perl_sys perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) |
53285a48 |
154 | |
82835e01 |
155 | installcmd : |
e71dd89f |
156 | @perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR) |
157 | ./miniperl -Ilib os2/perl2cmd.pl $(INSTALLCMDDIR) |
82835e01 |
158 | |
e95c8f0e |
159 | # Aout section: |
160 | |
161 | aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj))) |
162 | AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER))) |
b732e2e2 |
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))) |
e95c8f0e |
166 | |
dd3366de |
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))) |
171 | |
172 | $(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ) |
173 | emxaout -o $@ $< |
174 | |
175 | $(DYNALOADER_OBJ) : $(DYNALOADER) |
176 | @sh -c true |
177 | |
f9c39ab5 |
178 | $(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT) |
dd3366de |
179 | rm -f $@ |
180 | $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj) |
e95c8f0e |
181 | |
182 | .c$(AOUT_OBJ_EXT): |
183 | $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c |
184 | |
bd0dd1d8 |
185 | opmini$(AOUT_OBJ_EXT): op.c |
186 | $(AOUT_CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB -o opmini$(AOUT_OBJ_EXT) -c op.c |
187 | |
dd3366de |
188 | perlmain(AOUT_OBJ_EXT): perlmain.c |
189 | $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c |
190 | |
e95c8f0e |
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 |
194 | |
bd0dd1d8 |
195 | miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) opmini$(AOUT_OBJ_EXT) |
74294fdf |
196 | $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) opmini$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(libs) |
e95c8f0e |
197 | |
f9c39ab5 |
198 | perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs |
74294fdf |
199 | $(CC) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs) |
e95c8f0e |
200 | |
dd3366de |
201 | perl : perl__ perl___ |
760ac839 |
202 | |
f9c39ab5 |
203 | perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs |
74294fdf |
204 | $(CC) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM |
760ac839 |
205 | |
dd3366de |
206 | # Forking dynamically loaded perl: |
207 | |
208 | perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs |
74294fdf |
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) |
dd3366de |
210 | |
211 | clean: aout_clean |
212 | |
e95c8f0e |
213 | aout_clean: |
214 | -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout |
215 | |
216 | aout_install: perl_ aout_install.perl |
217 | |
218 | aout_install.perl: perl_ installperl |
219 | ./perl_ installperl |
220 | |
221 | aout_test: perl_ |
760ac839 |
222 | - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty |
223 | |
53285a48 |
224 | # To test with harness, set HARNESS_BAD_EXITCODE=2 |
225 | |
226 | sys_test: perl_sys |
227 | - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_sys$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty |
228 | |
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 |
231 | |
017f25f1 |
232 | !NO!SUBS! |
e95c8f0e |
233 | |
017f25f1 |
234 | # Now we need to find directories in ./ext/ which are two level deep |
235 | |
236 | dirs='' |
237 | preci='ext/%/Makefile.aout ' |
238 | for d in ext/* |
239 | do |
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 |
244 | dirs="$dirs $d" |
245 | preci="$preci $d/%/Makefile.aout" |
246 | fi |
247 | done |
248 | |
249 | $spitshell >>Makefile <<!GROK!THIS! |
250 | .PRECIOUS : $preci |
251 | |
252 | !GROK!THIS! |
253 | |
254 | for d in $dirs |
255 | do |
256 | p=`basename $d` |
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= |
261 | |
262 | $d/%/Makefile.aout : miniperl_ |
263 | cd \$(dir \$@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl |
264 | |
265 | !GROK!THIS! |
e95c8f0e |
266 | |
017f25f1 |
267 | done |
760ac839 |
268 | |
017f25f1 |
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= |
760ac839 |
273 | |
e95c8f0e |
274 | ext/%/Makefile.aout : miniperl_ |
760ac839 |
275 | cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl |
e95c8f0e |
276 | |
82835e01 |
277 | !NO!SUBS! |