[perl #29708] Problem with autouse (causing Perl to crash)
[p5sagit/p5-mst-13.2.git] / Makefile.SH
CommitLineData
599a829f 1#! /bin/sh
a02608de 2case $PERL_CONFIG_SH in
2304df62 3'')
66b99216 4 if test -f config.sh
5 then TOP=.
2304df62 6 else
7 echo "Can't find config.sh."; exit 1
8 fi
9 . $TOP/config.sh
10 ;;
11esac
761ee4e8 12
13# H.Merijn Brand [17 Feb 2004]
14# This comment is just to ensure that Configure will find variables that
15# are removed/replaced in patches on blead, but are still needed in the
16# 5.8.x, 5.6.x and 5.005.x maintainance tracks.
17# metaconfig -m will scan all .SH files on this level (not deeper), and
18# not in x2p and other subfolders. This file is as good as any .SH
19# patch references
20# #22227 $baserev
21# #22302 $yacc $byacc
22
2304df62 23: This forces SH files to create target in same directory as SH file.
24: This is so that make depend always knows where to find SH derivatives.
25case "$0" in
26*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
27esac
28
2304df62 29case "$d_dosuid" in
30*define*) suidperl='suidperl' ;;
31*) suidperl='';;
32esac
33
d5d19f97 34linklibperl='$(LIBPERL)'
3c321fdc 35shrpldflags='$(LDDLFLAGS)'
6ee623d5 36ldlibpth=''
ac9901e0 37DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
d96ebe2e 38case "$useshrplib" in
39true)
f4db5405 40 # Prefix all runs of 'miniperl' and 'perl' with
5cf1d1f1 41 # $ldlibpth so that ./perl finds *this* shared libperl.
c1b49bc0 42 case "$LD_LIBRARY_PATH" in
43 '')
44 ldlibpth="LD_LIBRARY_PATH=`pwd`";;
45 *)
46 ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
47 esac
6ee623d5 48
d5d19f97 49 pldlflags="$cccdlflags"
94c41b70 50 static_target='static_pic'
d96ebe2e 51 case "${osname}${osvers}" in
52 next4*)
3c321fdc 53 ld=libtool
54 lddlflags="-dynamic -undefined warning -framework System \
55 -compatibility_version 1 -current_version $patchlevel \
56 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
6ee623d5 57 ;;
f556e5b9 58 rhapsody*|darwin*)
59 shrpldflags="${ldflags} -dynamiclib \
c1e7a127 60 -compatibility_version \
61 ${api_revision}.${api_version}.${api_subversion} \
f556e5b9 62 -current_version \
c1e7a127 63 ${revision}.${patchlevel}.${subversion} \
f556e5b9 64 -install_name \$(shrpdir)/\$@"
65 ;;
5cf1d1f1 66 cygwin*)
8736538c 67 linklibperl="-lperl"
68 ;;
73d40b3e 69 sunos*)
d5d19f97 70 linklibperl="-lperl"
71 ;;
43039de7 72 netbsd*|freebsd[234]*|openbsd*)
099685bc 73 linklibperl="-L. -lperl"
74 ;;
3c321fdc 75 aix*)
76 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
1553ab04 77 case "$osvers" in
549a6b10 78 3*) shrpldflags="$shrpldflags -e _nostart"
1553ab04 79 ;;
549a6b10 80 *) shrpldflags="$shrpldflags -b noentry"
1553ab04 81 ;;
82 esac
9c839522 83 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
549a6b10 84 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
3c321fdc 85 ;;
1c7d1a19 86 hpux*)
87 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
46193409 88 ;;
ac9901e0 89 os390*)
f2766b05 90 shrpldflags='-W l,dll'
ac9901e0 91 linklibperl='libperl.x'
92 DPERL_EXTERNAL_GLOB=''
93 ;;
655635e8 94 esac
5cf1d1f1 95 case "$ldlibpthname" in
96 '') ;;
97 *)
98 case "$osname" in
99 os2)
100 ldlibpth=''
101 ;;
5cf1d1f1 102 *)
103 eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\""
104 ;;
105 esac
c1b49bc0 106 # Strip off any trailing :'s
107 ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
5cf1d1f1 108 ;;
109 esac
ecfc5424 110
9b9c6f34 111 case "$ldlibpth" in
112 # Protect any spaces
113 *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
114 esac
6904989c 115
9b9c6f34 116 case "$osname" in
117 linux)
830717a7 118 # If there is a pre-existing $libperl from a previous
119 # installation, Linux needs to use LD_PRELOAD to
120 # override the LD_LIBRARY_PATH setting. See the
121 # INSTALL file, under "Building a shared perl library".
122 # If there is no pre-existing $libperl, we don't need
123 # to do anything further.
124 if test -f $archlib/CORE/$libperl; then
68e8d60a 125 rm -f preload
d0ae58a5 126 cat <<'EOT' > preload
fde91635 127#! /bin/sh
128lib=$1
129shift
130test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
131exec "$@"
132EOT
9b9c6f34 133 chmod 755 preload
134 ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
830717a7 135 fi
136 ;;
9b9c6f34 137 os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
138 ;;
60d79001 139 esac
9b9c6f34 140
60d79001 141 ;;
9b9c6f34 142
143*) pldlflags=''
144 static_target='static'
b1f5ad7d 145 ;;
146esac
147
a0d0e21e 148: Prepare dependency lists for Makefile.
149dynamic_list=' '
150for f in $dynamic_ext; do
151 : the dependency named here will never exist
ecfc5424 152 base=`echo "$f" | sed 's/.*\///'`
75f92628 153 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
a0d0e21e 154done
155
156static_list=' '
a0d0e21e 157for f in $static_ext; do
158 base=`echo "$f" | sed 's/.*\///'`
cd4d8a96 159 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
a0d0e21e 160done
161
4318d5a0 162nonxs_list=' '
163for f in $nonxs_ext; do
164 base=`echo "$f" | sed 's/.*\///'`
165 nonxs_list="$nonxs_list ext/$f/pm_to_blib"
166done
167
2304df62 168echo "Extracting Makefile (with variable substitutions)"
655635e8 169$spitshell >Makefile <<!GROK!THIS!
a0d0e21e 170# Makefile.SH
85e6fe83 171# This file is derived from Makefile.SH. Any changes made here will
172# be lost the next time you run Configure.
655635e8 173# Makefile is used to generate $firstmakefile. The only difference
174# is that $firstmakefile has the dependencies filled in at the end.
0de566d7 175
2304df62 176CC = $cc
232e078e 177LD = $ld
16d20bd9 178
2304df62 179LDFLAGS = $ldflags
180CLDFLAGS = $ldflags
85e6fe83 181
2304df62 182mallocsrc = $mallocsrc
183mallocobj = $mallocobj
85e6fe83 184LNS = $lns
4c901d04 185# NOTE: some systems don't grok "cp -f". XXX Configure test needed?
186CPS = $cp
2304df62 187RMS = rm -f
85e6fe83 188ranlib = $ranlib
189
16d20bd9 190# The following are mentioned only to make metaconfig include the
191# appropriate questions in Configure. If you want to change these,
8e07c86e 192# edit config.sh instead, or specify --man1dir=/wherever on
16d20bd9 193# installman commandline.
194bin = $installbin
195scriptdir = $scriptdir
d96ebe2e 196shrpdir = $archlibexp/CORE
16d20bd9 197privlib = $installprivlib
198man1dir = $man1dir
199man1ext = $man1ext
200man3dir = $man3dir
201man3ext = $man3ext
202
85e6fe83 203# The following are used to build and install shared libraries for
204# dynamic loading.
205LDDLFLAGS = $lddlflags
3c321fdc 206SHRPLDFLAGS = $shrpldflags
85e6fe83 207CCDLFLAGS = $ccdlflags
a0d0e21e 208DLSUFFIX = .$dlext
ecfc5424 209PLDLFLAGS = $pldlflags
d96ebe2e 210LIBPERL = $libperl
d5d19f97 211LLIBPERL= $linklibperl
ecfc5424 212SHRPENV = $shrpenv
a0d0e21e 213
94c41b70 214# Static targets are ordinarily built without CCCDLFLAGS. However,
215# if building a shared libperl.so that might later be linked into
216# another application, then it might be appropriate to also build static
217# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
218# for GNU cc). This is handled by ext/util/make_ext.
219STATIC = $static_target
220
6ee623d5 221# The following is used to include the current directory in
5cf1d1f1 222# the dynamic loader path you are building a shared libperl.
6ee623d5 223LDLIBPTH = $ldlibpth
224
a0d0e21e 225dynamic_ext = $dynamic_list
226static_ext = $static_list
4318d5a0 227nonxs_ext = $nonxs_list
228ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
cd4d8a96 229DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
2304df62 230
9c839522 231libs = $perllibs $cryptlib
2304df62 232
443a5b98 233public = perl\$(EXE_EXT) $suidperl utilities translators
2304df62 234
235shellflags = $shellflags
236
d96ebe2e 237# This is set to MAKE=$make if your $make command doesn't
238# do it for you.
239$make_set_make
4633a7c4 240
1fef16b3 241# Mention $gmake here so it gets probed for by Configure.
242
dfe9444c 243# These variables may need to be manually set for non-Unix systems.
ccc7f9b3 244AR = $full_ar
dfe9444c 245EXE_EXT = $_exe
246LIB_EXT = $_a
247OBJ_EXT = $_o
248PATH_SEP = $p_
4633a7c4 249
250FIRSTMAKEFILE = $firstmakefile
251
252# Any special object files needed by this architecture, e.g. os2/os2.obj
253ARCHOBJS = $archobjs
254
89ada9f2 255.SUFFIXES: .c \$(OBJ_EXT) .i .s
cd4d8a96 256
d96ebe2e 257# grrr
258SHELL = $sh
655635e8 259
28e8609d 260# how to tr(anslate) newlines
261TRNL = '$trnl'
262
82240bfc 263OPTIMIZE = $optimize
264
3343e82c 265EXTRAS = $extras
266
bf35c3f6 267INSTALLPREFIXEXP = $prefix
268
d56c5707 269!GROK!THIS!
b7b35fc2 270# not used by Makefile but by installperl;
d56c5707 271# mentioned here so that metaconfig picks these up
272# $installusrbinperl
273# $versiononly
b7b35fc2 274
8170cb12 275case "${osname}:${osvers}" in
276darwin:*)
277$spitshell >>Makefile <<EOF
278
279# Your locales are broken (osname $osname, osvers $osvers)
280# and to avoid the numerous
281# perl: warning: Setting locale failed.
282# warnings during the build process we reset the locale variables.
283
284LC_ALL=C
285LANG=C
286LANGUAGE=C
287EOF
288 ;;
289esac
2304df62 290
85e6fe83 291## In the following dollars and backticks do not need the extra backslash.
2304df62 292$spitshell >>Makefile <<'!NO!SUBS!'
293
75550b4e 294CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@`
89ada9f2 295
75550b4e 296CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<`
2304df62 297
abae58a6 298private = preplibrary lib/Config.pm lib/ExtUtils/Miniperl.pm
2304df62 299
4633a7c4 300# Files to be built with variable substitution before miniperl
301# is available.
302sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
4755096e 303 makedir.SH myconfig.SH writemain.SH pod/Makefile.SH
4633a7c4 304
3ebb1980 305shextract = Makefile cflags config.h makeaperl makedepend \
4755096e 306 makedir myconfig writemain pod/Makefile
4633a7c4 307
308# Files to be built with variable substitution after miniperl is
309# available. Dependencies handled manually below (for now).
2304df62 310
efb12ca0 311pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
41630250 312 pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL
4633a7c4 313
4755096e 314# lib/lib.pm is not listed here because it has a rule of its own.
efb12ca0 315plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
41630250 316 pod/pod2usage pod/podchecker pod/podselect
4633a7c4 317
4755096e 318addedbyconf = UU $(shextract) $(plextract) lib/lib.pm pstruct
2304df62 319
fed7345c 320h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
dd2155a4 321h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
322h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
219f41b1 323h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
68795e93 324h5 = utf8.h warnings.h
33b839e2 325h = $(h1) $(h2) $(h3) $(h4) $(h5)
2304df62 326
10bc17b6 327c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c reentr.c
a0ed51b3 328c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c
dd2155a4 329c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c xsutils.c pad.c
68795e93 330c4 = globals.c perlio.c perlapi.c numeric.c locale.c pp_pack.c pp_sort.c
2304df62 331
09bef843 332c = $(c1) $(c2) $(c3) $(c4) miniperlmain.c perlmain.c
2304df62 333
dd2155a4 334obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT)
cd4d8a96 335obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT)
68795e93 336obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) xsutils$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT)
655635e8 337
4633a7c4 338obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
2304df62 339
340lintflags = -hbvxac
341
cd4d8a96 342.c$(OBJ_EXT):
d96ebe2e 343 $(CCCMD) $(PLDLFLAGS) $*.c
2304df62 344
89ada9f2 345.c.i:
346 $(CCCMDSRC) -E $*.c > $*.i
347
348.c.s:
349 $(CCCMDSRC) -S $*.c
350
443a5b98 351all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) extra.pods $(private) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
248e23d9 352 @echo " ";
fcfe1ab7 353 @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
909b3858 354
b2c07774 355.PHONY: all compile translators utilities
b27471b9 356
6ee623d5 357compile: all
358 echo "testing compilation" > testcompile;
359 cd utils; $(MAKE) compile;
f4db5405 360 cd x2p; $(MAKE) compile;
6ee623d5 361 cd pod; $(MAKE) compile;
362
443a5b98 363translators: miniperl$(EXE_EXT) lib/Config.pm FORCE
6ee623d5 364 @echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
8e07c86e 365
443a5b98 366utilities: miniperl$(EXE_EXT) lib/Config.pm $(plextract) lib/lib.pm FORCE
6ee623d5 367 @echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
909b3858 368
369
16d20bd9 370# This is now done by installman only if you actually want the man pages.
371# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83 372
373# Phony target to force checking subdirectories.
e50aee73 374# Apparently some makes require an action for the FORCE target.
869a466c 375.PHONY: FORCE
85e6fe83 376FORCE:
4633a7c4 377 @sh -c true
ac9901e0 378!NO!SUBS!
379$spitshell >>Makefile <<!GROK!THIS!
85e6fe83 380
4ba7095c 381# We do a copy of the op.c instead of a symlink because gcc gets huffy
382# if we have a symlink forest to another disk (it complains about too many
383# levels of symbolic links, even if we have only two)
384
ac9901e0 385opmini\$(OBJ_EXT): op.c config.h
386 \$(RMS) opmini.c
387 \$(CPS) op.c opmini.c
388 \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
389 \$(RMS) opmini.c
bd0dd1d8 390
ac9901e0 391!GROK!THIS!
392$spitshell >>Makefile <<'!NO!SUBS!'
517e7c64 393miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
92c28edd 394 $(CCCMD) $(PLDLFLAGS) $*.c
ecfc5424 395
92c28edd 396perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
e8827f64 397 sh writemain $(DYNALOADER) $(static_ext) > writemain.tmp
92c28edd 398 sh mv-if-diff writemain.tmp perlmain.c
85e6fe83 399
e31d4690 400!NO!SUBS!
401case "$osname" in
402cygwin)
403 ;; # Let cygwin/Makefile.SHs do its work.
404*)
405 $spitshell >>Makefile <<'!NO!SUBS!'
cd4d8a96 406perlmain$(OBJ_EXT): perlmain.c
92c28edd 407 $(CCCMD) $(PLDLFLAGS) $*.c
85e6fe83 408
e31d4690 409!NO!SUBS!
410 ;;
411esac
412$spitshell >>Makefile <<'!NO!SUBS!'
a0d0e21e 413# The file ext.libs is a list of libraries that must be linked in
414# for static extensions, e.g. -lm -lgdbm, etc. The individual
415# static extension Makefile's add to it.
fed7345c 416ext.libs: $(static_ext)
a0d0e21e 417 -@test -f ext.libs || touch ext.libs
85e6fe83 418
ecfc5424 419!NO!SUBS!
599a829f 420
d96ebe2e 421# How to build libperl. This is still rather convoluted.
599a829f 422# Load up custom Makefile.SH fragment for shared loading and executables:
8736538c 423case "$osname" in
8736538c 424*)
425 Makefile_s="$osname/Makefile.SHs"
426 ;;
427esac
428
549a6b10 429case "$osname" in
430aix)
431 $spitshell >>Makefile <<!GROK!THIS!
9c839522 432LIBS = $perllibs
5f9d9a17 433# In AIX we need to change this for building Perl itself from
434# its earlier definition (which is for building external
435# extensions *after* Perl has been built and installed)
436CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
549a6b10 437
438!GROK!THIS!
439 case "$useshrplib" in
440 define|true|[yY]*)
441 $spitshell >>Makefile <<'!NO!SUBS!'
442
443LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT)
444MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT)
445
446$(LIBPERL_NONSHR): perl$(OBJ_EXT) $(obj)
447 $(RMS) $(LIBPERL_NONSHR)
448 $(AR) rcu $(LIBPERL_NONSHR) perl$(OBJ_EXT) $(obj)
449
bd0dd1d8 450$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
a7089531 451 $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
452 opmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
549a6b10 453
454MINIPERLEXP = $(MINIPERL_NONSHR)
455
456LIBPERLEXPORT = perl.exp
457
458!NO!SUBS!
459
460 ;;
461 *)
462 $spitshell >>Makefile <<'!NO!SUBS!'
463MINIPERLEXP = miniperl$(EXE_EXT)
464
465PERLEXPORT = perl.exp
466
467!NO!SUBS!
468 ;;
469 esac
470 $spitshell >>Makefile <<'!NO!SUBS!'
471perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
5c728af0 472 ./$(MINIPERLEXP) makedef.pl PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" | sort -u | sort -f > perl.exp.tmp
549a6b10 473 sh mv-if-diff perl.exp.tmp perl.exp
474
475!NO!SUBS!
476 ;;
2c2d71f5 477os2)
478 $spitshell >>Makefile <<'!NO!SUBS!'
479MINIPERLEXP = miniperl
480
481perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
5c728af0 482 ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl.exp.tmp
2c2d71f5 483 sh mv-if-diff perl.exp.tmp perl5.def
484
485!NO!SUBS!
486 ;;
549a6b10 487esac
488
8736538c 489if test -r $Makefile_s ; then
490 . $Makefile_s
d96ebe2e 491 $spitshell >>Makefile <<!GROK!THIS!
cd4d8a96 492
8736538c 493Makefile: $Makefile_s
cd4d8a96 494!GROK!THIS!
495else
f0efd8cf 496 $spitshell >>Makefile <<'!NO!SUBS!'
549a6b10 497$(LIBPERL): $& perl$(OBJ_EXT) $(obj) $(LIBPERLEXPORT)
9c9e9f08 498!NO!SUBS!
d96ebe2e 499 case "$useshrplib" in
500 true)
501 $spitshell >>Makefile <<'!NO!SUBS!'
6bdd71ef 502 $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) $(libs)
3c321fdc 503!NO!SUBS!
504 case "$osname" in
505 aix)
506 $spitshell >>Makefile <<'!NO!SUBS!'
28e8609d 507 rm -f libperl$(OBJ_EXT)
3c321fdc 508 mv $@ libperl$(OBJ_EXT)
509 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 510!NO!SUBS!
3c321fdc 511 ;;
512 esac
d96ebe2e 513 ;;
514 *)
515 $spitshell >>Makefile <<'!NO!SUBS!'
516 rm -f $(LIBPERL)
517 $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
518 @$(ranlib) $(LIBPERL)
655635e8 519!NO!SUBS!
d96ebe2e 520 ;;
521 esac
599a829f 522 $spitshell >>Makefile <<'!NO!SUBS!'
523
524# How to build executables.
525
526# The $& notation tells Sequent machines that it can do a parallel make,
527# and is harmless otherwise.
528# The miniperl -w -MExporter line is a basic cheap test to catch errors
529# before make goes on to run preplibrary and then MakeMaker on extensions.
530# This is very handy because later errors are often caused by miniperl
531# build problems but that's not obvious to the novice.
532# The Module used here must not depend on Config or any extensions.
533
ecfb2188 534!NO!SUBS!
535
536 case "${osname}${osvers}" in
8fdf96e1 537 aix*)
ecfb2188 538 $spitshell >>Makefile <<'!NO!SUBS!'
bd0dd1d8 539miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
8fdf96e1 540 $(CC) -o miniperl $(CLDFLAGS) \
541 `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
ecfb2188 542 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
bd0dd1d8 543 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188 544!NO!SUBS!
545 ;;
8fdf96e1 546 beos*|next4*)
535d2540 547 $spitshell >>Makefile <<'!NO!SUBS!'
548miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
8fdf96e1 549 $(CC) -o miniperl `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
535d2540 550 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
551 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
552!NO!SUBS!
553 ;;
cb3fc426 554 darwin*)
986530ea 555 case "$osvers" in
556 [1-6].*) ;;
557 *) case "$ldflags" in
558 *"-flat_namespace"*) ;;
559 *) # to allow opmini.o to override stuff in libperl.dylib
69625aa9 560 $spitshell >>Makefile <<!NO!SUBS!
561NAMESPACEFLAGS = -force_flat_namespace
562!NO!SUBS!
986530ea 563 ;;
564 esac
565 ;;
cb3fc426 566 esac
567 $spitshell >>Makefile <<'!NO!SUBS!'
568miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
569 -@rm -f miniperl.xok
69625aa9 570 $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o miniperl \
cb3fc426 571 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
572 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
cb3fc426 573!NO!SUBS!
574 ;;
ecfb2188 575 *)
576 $spitshell >>Makefile <<'!NO!SUBS!'
443a5b98 577miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
93c0359c 578 -@rm -f miniperl.xok
f913803b 579 $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl \
a7089531 580 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
bd0dd1d8 581 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188 582!NO!SUBS!
583 ;;
584 esac
585
586 $spitshell >>Makefile <<'!NO!SUBS!'
599a829f 587
443a5b98 588perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
93c0359c 589 -@rm -f miniperl.xok
f913803b 590 $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 591
4ae3d70a 592# Purify/Quantify Perls.
593
443a5b98 594pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 595 $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 596
443a5b98 597purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 598 $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
dbadb36a 599
443a5b98 600quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 601 $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 602
7a834142 603# Valgrind perl (currently Linux only)
604
605perl.valgrind.config: config.sh
606 @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..."
607 @$(MAKE) perl.config.dashg
608 @echo "Checking usemymalloc='n' in config.sh..."
609 @grep "^usemymalloc=" config.sh
610 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
611 @echo "And of course you have to have valgrind..."
71152cd8 612 valgrind ./perl -e 1 2>/dev/null || exit 1
7a834142 613
4ae3d70a 614# Third Degree Perl (Tru64 only)
615
719561de 616perl.config.dashg:
83f0ef60 617 @echo "Checking optimize='-g' in config.sh..."
618 @grep "^optimize=" config.sh
619 @grep "^optimize='-g'" config.sh >/dev/null || exit 1
4ae3d70a 620
621perl.third.config: config.sh
622 @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
6e36760b 623 @$(MAKE) perl.config.dashg
83f0ef60 624 @echo "Checking usemymalloc='n' in config.sh..."
625 @grep "^usemymalloc=" config.sh
626 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
170ba846 627
412c6516 628perl.third: /usr/bin/atom perl.third.config perl
dca31ef4 629 atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl
83f0ef60 630 @echo "Now you may run perl.third and then study perl.3log."
15615bfd 631
4ae3d70a 632# Pixie Perls (Tru64 and IRIX only)
633
719561de 634perl.pixie.config: config.sh
4ae3d70a 635 @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
6e36760b 636 @$(MAKE) perl.config.dashg
4ae3d70a 637
719561de 638perl.pixie.atom: /usr/bin/atom perl
4ae3d70a 639 atom -tool pixie -L. -all -toolargs="-quiet" perl
640
641perl.pixie.irix: perl
642 pixie perl
643
719561de 644perl.pixie: /usr/bin/pixie perl.pixie.config perl
4ae3d70a 645 if test -x /usr/bin/atom; then \
646 $(MAKE) perl.pixie.atom; \
647 else \
648 $(MAKE) perl.pixie.irix; \
649 fi
83f0ef60 650 @echo "Now you may run perl.pixie and then run pixie."
651
652# Gprof Perl
653
654perl.config.dashpg:
655 @echo "Checking optimize='-pg' in config.sh..."
656 @grep "^optimize=" config.sh
64778e5f 657 @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
83f0ef60 658
659perl.gprof.config: config.sh
660 @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
661 @$(MAKE) perl.config.dashpg
662
663perl.gprof: /usr/bin/gprof perl.gprof.config
64778e5f 664 @-rm -f perl
51a35ef1 665 $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
83f0ef60 666 @echo "Now you may run perl.gprof and then run gprof perl.gprof."
4ae3d70a 667
51a35ef1 668# Gcov Perl
669
670perl.config.gcov:
671 @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
672 @echo "Checking gccversion in config.sh..."
673 @grep "^gccversion=" config.sh
674 @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
675 @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
676 @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
677 @grep "^ccflags=" config.sh
678 @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
679
680perl.gcov: perl.config.gcov
681 @-rm -f perl
682 $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
683 @echo "Now you may run perl.gcov and then run gcov some.c."
684
f946bb38 685# Microperl. This is just a convenience thing if one happens to
686# build also the full Perl and therefore the real big Makefile:
f4db5405 687# usually one should manually explicitly issue the below command.
f946bb38 688
869a466c 689.PHONY: microperl
f946bb38 690microperl:
691 $(MAKE) -f Makefile.micro
692
2304df62 693# This version, if specified in Configure, does ONLY those scripts which need
694# set-id emulation. Suidperl must be setuid root. It contains the "taint"
695# checks as well as the special code to validate that the script in question
696# has been invoked correctly.
697
443a5b98 698suidperl$(EXE_EXT): $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 699 $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 700
599a829f 701!NO!SUBS!
702
703fi
704
705$spitshell >>Makefile <<'!NO!SUBS!'
706
bf0dfd28 707sperl$(OBJ_EXT): perl.c $(h)
2304df62 708 $(RMS) sperl.c
85e6fe83 709 $(LNS) perl.c sperl.c
d96ebe2e 710 $(CCCMD) -DIAMSUID sperl.c
2304df62 711 $(RMS) sperl.c
712
fec02dd3 713# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
714# test -d lib/auto || mkdir lib/auto
5b7e50ea 715# We need to autosplit in two steps because VOS can't handle so many args
fec02dd3 716#
869a466c 717.PHONY: preplibrary
a64c954a 718preplibrary: miniperl$(EXE_EXT) lib/Config.pm lib/lib.pm $(PREPLIBRARY_LIBPERL)
cd4d8a96 719 @sh ./makedir lib/auto
a0d0e21e 720 @echo " AutoSplitting perl library"
92c28edd 721 $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
5b7e50ea 722 autosplit_lib_modules(@ARGV)' lib/*.pm
723 $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
724 autosplit_lib_modules(@ARGV)' lib/*/*.pm
abae58a6 725 $(MAKE) lib/re.pm
2304df62 726
75f92628 727# Take care to avoid modifying lib/Config.pm without reason
f4db5405 728# (If trying to create a new port and having problems with the configpm script,
fb73857a 729# try 'make minitest' and/or commenting out the tests at the end of configpm.)
ab57a4d7 730lib/Config.pm: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
d2212429 731 $(LDLIBPTH) ./miniperl -Ilib configpm configpm.tmp
92c28edd 732 sh mv-if-diff configpm.tmp $@
2304df62 733
443a5b98 734lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl lib/Config.pm
e8827f64 735 $(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
92c28edd 736 sh mv-if-diff minimod.tmp $@
abae58a6 737 -touch lib/ExtUtils/Miniperl.pm
fed7345c 738
92c28edd 739lib/re.pm: ext/re/re.pm
abae58a6 740 cp ext/re/re.pm ext/re/re.tmp && sh mv-if-diff ext/re/re.tmp lib/re.pm
7cfc0d09 741
180c42e0 742$(plextract): miniperl$(EXE_EXT) lib/Config.pm x2p/s2p
42c30c63 743 @-rm -f $@
92c28edd 744 $(LDLIBPTH) ./miniperl -Ilib $@.PL
72b3d9b4 745
d4d4a62f 746x2p/s2p: miniperl$(EXE_EXT) lib/Config.pm x2p/s2p.PL
36cf9c44 747 cd x2p; $(LDLIBPTH) $(MAKE) s2p
180c42e0 748
443a5b98 749lib/lib.pm: miniperl$(EXE_EXT) lib/Config.pm
42c30c63 750 @-rm -f $@
4755096e 751 $(LDLIBPTH) ./miniperl -Ilib lib/lib_pm.PL
752
443a5b98 753extra.pods: miniperl$(EXE_EXT)
fec93702 754 -@test -f extra.pods && rm -f `cat extra.pods`
72b3d9b4 755 -@rm -f extra.pods
b4bc034f 756 -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
72b3d9b4 757 nx=`echo $$x | sed -e "s/README\.//"`; \
40096396 758 cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
72b3d9b4 759 echo "pod/perl"$$nx".pod" >> extra.pods ; \
760 done
a8476e91 761 -@rm -f pod/perlvms.pod
762 -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
1400179b 763 -@rm -f pod/perldelta.pod
e0eb806d 764 -@test -f pod/perl592delta.pod && cd pod && $(LNS) perl592delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods
72b3d9b4 765
443a5b98 766extras.make: perl$(EXE_EXT)
70eaf669 767 -@test -s extras.lst && PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
bf35c3f6 768
443a5b98 769extras.test: perl$(EXE_EXT)
70eaf669 770 -@test -s extras.lst && PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
bf35c3f6 771
443a5b98 772extras.install: perl$(EXE_EXT)
70eaf669 773 -@test -s extras.lst && PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
bf35c3f6 774
869a466c 775.PHONY: install install-strip install-all install-verbose install-silent \
5e2f386f 776 no-install install.perl install.man install.html
869a466c 777
0cf51544 778META.yml: Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
779 $(LDLIBPTH) ./miniperl -Ilib Porting/makemeta
780
f556e5b9 781install-strip:
70eaf669 782 $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
f556e5b9 783
adbebc0b 784install install-all:
70eaf669 785 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)"
c77385cf 786
4ad019ef 787install-verbose:
70eaf669 788 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)"
c458b76c 789
4ad019ef 790install-silent:
70eaf669 791 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)"
4ad019ef 792
793no-install:
70eaf669 794 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
16d20bd9 795
70eaf669 796# Set this to an empty string to avoid an attempt of rebuild before install
797INSTALL_DEPENDENCE = all
798
799install.perl: $(INSTALL_DEPENDENCE) installperl
6ee623d5 800 if [ -n "$(COMPILE)" ]; \
801 then \
802 cd utils; $(MAKE) compile; \
803 cd ../x2p; $(MAKE) compile; \
804 cd ../pod; $(MAKE) compile; \
83673e1f 805 else :; \
6ee623d5 806 fi
5a9231b0 807 $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
bf35c3f6 808 $(MAKE) extras.install
a0d0e21e 809
b1a1e9f1 810install.man: all installman
5a9231b0 811 $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
16d20bd9 812
84902520 813# XXX Experimental. Hardwired values, but useful for testing.
814# Eventually Configure could ask for some of these values.
815install.html: all installhtml
40096396 816 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
6ee623d5 817 $(LDLIBPTH) ./perl installhtml \
84902520 818 --podroot=. --podpath=. --recurse \
819 --htmldir=$(privlib)/html \
820 --htmlroot=$(privlib)/html \
821 --splithead=pod/perlipc \
822 --splititem=pod/perlfunc \
823 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
824 --verbose
825
16d20bd9 826
a0d0e21e 827# I now supply perly.c with the kits, so the following section is
0de566d7 828# used only if you force bison to run by saying
829# make regen_perly
830# You normally shouldn't remake perly.[ch].
831
832.PHONY: regen_perly
833
834run_byacc:
835 @echo "run_byacc is obsolete; try 'make regen_perly' instead"
836
837# this outputs perly.act and perly.tab
838regen_perly:
839 perl regen_perly.pl
56febc5e 840
841# We don't want to regenerate perly.c and perly.h, but they might
842# appear out-of-date after a patch is applied or a new distribution is
843# made.
92c28edd 844perly.c: perly.y
b233458b 845 -@sh -c true
846
92c28edd 847perly.h: perly.y
b233458b 848 -@sh -c true
849
bd656b61 850# No compat3.sym here since and including the 5.004_50.
e4d5a464 851# No interp.sym since 5.005_03.
22c35a8c 852SYM = global.sym globvar.sym perlio.sym pp.sym
419eaf7b 853
22c35a8c 854SYMH = perlvars.h intrpvar.h thrdvar.h
419eaf7b 855
dae78bb1 856CHMOD_W = chmod +w
857
a8581515 858# The following files are generated automatically
9ad884cb 859# autodoc.pl: pod/perlapi.pod pod/perlintern.pod
c83f8f39 860# bytecode.pl: ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
861# ext/B/B/Asmdata.pm
9ad884cb 862# embed.pl: proto.h embed.h embedvar.h global.sym
863# perlapi.h perlapi.c
864# [* embed.pl needs pp.sym generated by opcode.pl! *]
865# keywords.pl: keywords.h
866# opcode.pl: opcode.h opnames.h pp_proto.h pp.sym
c83f8f39 867# regcomp.pl: regnodes.h
868# warnings.pl: warnings.h lib/warnings.pm
e50aee73 869# The correct versions should be already supplied with the perl kit,
870# in case you don't have perl available.
36bb303b 871# To force them to be regenerated, run
9ad884cb 872# perl regen.pl
36bb303b 873# with your existing copy of perl
874# (make regen_headers is kept for backwards compatibility)
e1354ed6 875
b4d4469a 876AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
877 embed.h embedvar.h global.sym \
878 pod/perlintern.pod pod/perlapi.pod \
acfe0abc 879 perlapi.h perlapi.c ext/ByteLoader/byterun.h \
c83f8f39 880 ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm regnodes.h \
881 warnings.h lib/warnings.pm
e1354ed6 882
869a466c 883.PHONY: regen_headers regen_pods regen_all
884
9ad884cb 885regen regen_headers: FORCE
886 -perl regen.pl
8e07c86e 887
4755096e 888regen_pods: FORCE
fcfe1ab7 889 -cd pod; $(LDLIBPTH) $(MAKE) regen_pods
4755096e 890
0de566d7 891regen_all: regen regen_pods
9fec149b 892
1aea71db 893.PHONY: manisort manicheck
894
895manisort: FORCE
f3a5d88c 896 LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
897 LC_ALL=C sort -fdo MANIFEST MANIFEST)
1aea71db 898
899manicheck: FORCE
900 perl Porting/manicheck
901
a0d0e21e 902# Extensions:
4318d5a0 903# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
904# automatically get built. There should ordinarily be no need to change
905# any of this part of makefile.
a0d0e21e 906#
907# The dummy dependency is a place holder in case $(dynamic_ext) or
908# $(static_ext) is empty.
909#
910# DynaLoader may be needed for extensions that use Makefile.PL.
911
443a5b98 912$(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE
94c41b70 913 @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 914
443a5b98 915d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
92c28edd 916 @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 917
443a5b98 918s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
94c41b70 919 @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
2304df62 920
443a5b98 921n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
92c28edd 922 @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
4318d5a0 923
869a466c 924.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
925 realclean _realcleaner clobber _clobber \
926 distclean veryclean _verycleaner
927
17b893d8 928clean: _tidy _mopup
70af249b 929
2edbd6da 930realclean: _realcleaner _mopup
fcfe1ab7 931 @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
70af249b 932
b37ebb13 933_clobber:
5440bc8e 934 -@rm -f Cross/run-* Cross/to-* Cross/from-*
bf35c3f6 935 rm -f config.sh cppstdin Policy.sh extras.lst
b37ebb13 936
937clobber: _realcleaner _mopup _clobber
70af249b 938
939distclean: clobber
940
2edbd6da 941# Like distclean but also removes emacs backups and *.orig.
b37ebb13 942veryclean: _verycleaner _mopup _clobber
943 -@rm -f Obsolete Wanted
2edbd6da 944
70af249b 945# Do not 'make _mopup' directly.
946_mopup:
cd4d8a96 947 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
1ed50e5b 948 -rmdir .depending
72b3d9b4 949 -@test -f extra.pods && rm -f `cat extra.pods`
b4bc034f 950 -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
ac83e8b0 951 -rm -f perl.exp ext.libs extra.pods opmini.o
d96ebe2e 952 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
1cfa4ec7 953 -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
9d4d067b 954 -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
6a966751 955 -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
93c0359c 956 -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
a0457be1 957 -rm -f perlld cygwin.c ld2 libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
1ed50e5b 958 -rm -f perl$(EXE_EXT) suidperl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
959 -rm -f opcode.h-old opnames.h-old pp.sym-old pp_proto.h-old
70af249b 960
961# Do not 'make _tidy' directly.
962_tidy:
e3f83878 963 -cd pod; $(LDLIBPTH) $(MAKE) clean
964 -cd utils; $(LDLIBPTH) $(MAKE) clean
965 -cd x2p; $(LDLIBPTH) $(MAKE) clean
4318d5a0 966 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
e3f83878 967 $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
a0d0e21e 968 done
6ee623d5 969 rm -f testcompile compilelog
ff68c719 970
2edbd6da 971_cleaner1:
4633a7c4 972 -cd os2; rm -f Makefile
2edbd6da 973 -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
974 -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
975 -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
4318d5a0 976 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
2edbd6da 977 $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
a0d0e21e 978 done
2edbd6da 979
2ad994b6 980# Some systems do not support "?", so keep these files separate.
2edbd6da 981_cleaner2:
2ad994b6 982 -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
983 rm -f core *perl.core t/core t/*perl.core
984 rm -f t/misctmp* t/forktmp* t/tmp* t/c t/perl$(EXE_EXT) t/rantests
985 rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
a0d0e21e 986 rm -rf $(addedbyconf)
0eb4e931 987 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
3d40713c 988 rm -f $(private) lib/Config.pod
a0d0e21e 989 rm -rf lib/auto
07a6e20d 990 rm -f lib/.exists lib/*/.exists lib/*/*/.exists
16d20bd9 991 rm -f h2ph.man pstruct
a0d0e21e 992 rm -rf .config
9b9c6f34 993 rm -f preload
6ee623d5 994 rm -f testcompile compilelog
26f17523 995 -rmdir lib/B lib/Data lib/Digest
996 rm -rf lib/Encode
c61dfb31 997 -rmdir lib/Filter/Util lib/IO/Socket lib/IO
998 -rmdir lib/List lib/MIME lib/Scalar lib/Sys
999 -rmdir lib/threads lib/XS
ecfc5424 1000
f4db5405 1001_realcleaner:
2edbd6da 1002 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1003 @$(LDLIBPTH) $(MAKE) _cleaner2
1004
f4db5405 1005_verycleaner:
2edbd6da 1006 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1007 @$(LDLIBPTH) $(MAKE) _cleaner2
c94787a5 1008 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
2edbd6da 1009
2304df62 1010# The following lint has practically everything turned on. Unfortunately,
1011# you have to wade through a lot of mumbo jumbo that can't be suppressed.
1012# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
1013# for that spot.
1014
869a466c 1015.PHONY: lint
bf0dfd28 1016lint: $(c)
2304df62 1017 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
1018
fb73857a 1019# Need to unset during recursion to go out of loop.
1020# The README below ensures that the dependency list is never empty and
1021# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 1022
84902520 1023MAKEDEPEND = Makefile makedepend
cd4d8a96 1024
fb73857a 1025$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 1026 $(MAKE) depend MAKEDEPEND=
a0d0e21e 1027
599a829f 1028config.h: config_h.SH config.sh
655635e8 1029 $(SHELL) config_h.SH
1030
a0d0e21e 1031# When done, touch perlmain.c so that it doesn't get remade each time.
869a466c 1032.PHONY: depend
2304df62 1033depend: makedepend
fb73857a 1034 sh ./makedepend MAKE=$(MAKE)
a0d0e21e 1035 - test -s perlmain.c && touch perlmain.c
2304df62 1036 cd x2p; $(MAKE) depend
1037
cd4d8a96 1038# Cannot postpone this until $firstmakefile is ready ;-)
92c28edd 1039makedepend: makedepend.SH config.sh
1040 sh ./makedepend.SH
cd4d8a96 1041
1167a30e 1042.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
869a466c 1043 test_tty test-tty _test_tty test_notty test-notty _test_notty \
e018f8be 1044 utest ucheck test.utf8 check.utf8 test.torture torturetest \
869a466c 1045 test.third check.third utest.third ucheck.third test_notty.third \
69bfbd2f 1046 test.deparse test_notty.deparse test_harness test_harness_notty \
b26492ee 1047 test.bytecompile minitest coretest test.taintwarn
869a466c 1048
ec861bc1 1049# Cannot delegate rebuilding of t/perl to make
1050# to allow interlaced test and minitest
3e3baf6d 1051
1167a30e 1052TESTFILE=TEST
1053
1054_test_prep:
ec861bc1 1055 cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
3e3baf6d 1056
1167a30e 1057# Architecture-neutral stuff:
1058
1059test_prep_pre: preplibrary utilities $(nonxs_ext)
1060
443a5b98 1061test_prep: test_prep_pre miniperl$(EXE_EXT) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
5fe84fd2 1062 PERL=./perl $(MAKE) _test_prep
ec861bc1 1063
5fe84fd2 1064_test_tty:
2a30c5e0 1065 cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
ec861bc1 1066
5fe84fd2 1067_test_notty:
2a30c5e0 1068 cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS)
ec861bc1 1069
1070# The second branch is for testing without a tty or controlling terminal,
1071# see t/op/stat.t
1072_test:
994e9bc0 1073 if (true </dev/tty) >/dev/null 2>&1; then \
1167a30e 1074 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty ; \
994e9bc0 1075 else \
1167a30e 1076 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
994e9bc0 1077 fi
3d8f1d64 1078 @echo "Ran tests" > t/rantests
a0ed51b3 1079
937aca76 1080test check: test_prep
ec861bc1 1081 PERL=./perl $(MAKE) _test
1082
937aca76 1083test_tty: test_prep
5fe84fd2 1084 PERL=./perl $(MAKE) _test_tty
ec861bc1 1085
937aca76 1086test_notty: test_prep
5fe84fd2 1087 PERL=./perl $(MAKE) _test_notty
ec861bc1 1088
83f0ef60 1089utest ucheck test.utf8 check.utf8: test_prep
35117553 1090 PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1091
5a6e071d 1092coretest: test_prep
1093 PERL=./perl TEST_ARGS=-core $(MAKE) _test
1094
48a293f8 1095test-prep: test_prep
5fe84fd2 1096
1097test-tty: test_tty
1098
1099test-notty: test_notty
1100
e018f8be 1101# Torture testing
1102
1103test.torture torturetest: test_prep
1104 PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1105
7a834142 1106# Targets for valgrind testing:
1107
1108test_prep.valgrind: test_prep perl.valgrind
1109 PERL=./perl $(MAKE) _test_prep
1110
1111test.valgrind check.valgrind: test_prep perl.valgrind.config
1112 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 $(MAKE) _test
1113
1114utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind
1115 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1116
1117test_notty.valgrind: test_prep.valgrind perl.valgrind
1118 PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1119
ec861bc1 1120# Targets for Third Degree testing.
1121
9b99345a 1122test_prep.third: test_prep perl.third
5fe84fd2 1123 PERL=./perl.third $(MAKE) _test_prep
ec861bc1 1124
937aca76 1125test.third check.third: test_prep.third perl.third
ec861bc1 1126 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1127
937aca76 1128utest.third ucheck.third: test_prep.third perl.third
35117553 1129 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1130
937aca76 1131test_notty.third: test_prep.third perl.third
5fe84fd2 1132 PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
2304df62 1133
1df34986 1134# Targets for Bytecode/ByteLoader testing.
1135
1136test.bytecompile: test_prep
1137 PERL=./perl TEST_ARGS=-bytecompile $(MAKE) _test
1138
35117553 1139# Targets for Deparse testing.
1140
1141test.deparse: test_prep
1142 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1143
1144test_notty.deparse: test_prep
1145 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1146
b26492ee 1147# Targets to run the test suite with -t
1148
1149test.taintwarn: test_prep
1150 PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1151
d96ebe2e 1152# Can't depend on lib/Config.pm because that might be where miniperl
1153# is crashing.
443a5b98 1154minitest: miniperl$(EXE_EXT) lib/re.pm
4fa3f26e 1155 -@test -f lib/lib.pm && test -f lib/Config.pm || \
1156 $(MAKE) lib/Config.pm lib/lib.pm
1157 @echo " "
d96ebe2e 1158 @echo "You may see some irrelevant test failures if you have been unable"
4fa3f26e 1159 @echo "to build lib/Config.pm or lib/lib.pm."
1160 @echo " "
cd4d8a96 1161 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
43651d81 1162 && $(LDLIBPTH) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
16d20bd9 1163
1167a30e 1164# Test via harness
1165
1166test_harness: test_prep
1167 PERL=./perl $(MAKE) TESTFILE=harness _test
1168
69bfbd2f 1169test_harness_notty: test_prep
1170 PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1171
fb73857a 1172# Handy way to run perlbug -ok without having to install and run the
84902520 1173# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 1174# Please *don't* use this unless all tests pass.
1d2dff63 1175# If you want to report test failures, use "make nok" instead.
869a466c 1176
1177.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1178
188cd53f 1179ok: utilities
92c28edd 1180 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 1181
105f9295 1182okfile: utilities
92c28edd 1183 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 1184
890b8eb0 1185oknack: utilities
1186 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1187
1188okfilenack: utilities
1189 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1190
1d2dff63 1191nok: utilities
92c28edd 1192 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 1193
b4e8cfaf 1194nokfile: utilities
1195 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1196
890b8eb0 1197noknack: utilities
1198 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1199
1200nokfilenack: utilities
1201 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1202
869a466c 1203.PHONY: clist hlist shlist pllist
1204
85e6fe83 1205clist: $(c)
92c28edd 1206 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 1207
85e6fe83 1208hlist: $(h)
92c28edd 1209 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 1210
85e6fe83 1211shlist: $(sh)
92c28edd 1212 echo $(sh) | tr ' ' $(TRNL) >.shlist
2304df62 1213
4633a7c4 1214pllist: $(pl)
92c28edd 1215 echo $(pl) | tr ' ' $(TRNL) >.pllist
4633a7c4 1216
92c28edd 1217Makefile: Makefile.SH ./config.sh
1218 $(SHELL) Makefile.SH
760ac839 1219
869a466c 1220.PHONY: distcheck
599a829f 1221distcheck: FORCE
760ac839 1222 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1223
869a466c 1224.PHONY: elc
771c4874 1225elc: emacs/cperl-mode.elc
1226
1227emacs/cperl-mode.elc: emacs/cperl-mode.el
1228 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1229
869a466c 1230.PHONY: etags ctags tags
1231
d6a255e6 1232etags: TAGS
1233
1234TAGS: emacs/cperl-mode.elc
3ee700d1 1235 sh emacs/ptags
01e22528 1236
d6a255e6 1237ctags: tags
1238
1239# Let's hope make will not go into an infinite loop on case-unsensitive systems
1240# This may also fail if . is in the head of the path, since perl will
1241# require -Ilib
1242tags: TAGS
1243 perl emacs/e2ctags.pl TAGS > tags
3ee700d1 1244
2304df62 1245# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1246# If this runs make out of memory, delete /usr/include lines.
1247!NO!SUBS!
1248
85e6fe83 1249$eunicefix Makefile
2304df62 1250case `pwd` in
1251*SH)
85e6fe83 1252 $rm -f ../Makefile
cd4d8a96 1253 $ln Makefile ../Makefile
2304df62 1254 ;;
1255esac
cd4d8a96 1256$rm -f $firstmakefile
5ff3f7a4 1257
1258# Now do any special processing required before building.
1259
1260case "$ebcdic" in
2d340b60 1261define)
5ff3f7a4 1262 xxx=''
2d340b60 1263 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
7a66b286 1264case "$osname" in
25e9a2e3 1265os390|posix-bc)
e9d08790 1266 if cd x2p
5ff3f7a4 1267 then
e9d08790 1268 rm -f y.tab.c y.tab.h
5928ee40 1269 case "$osname" in
1270 posix-bc)
1271 # we are using two different yaccs in BS2000 Posix!
1272 byacc a2p.y >/dev/null 2>&1
1273 ;;
1274 *) # e.g. os390
1275 yacc a2p.y >/dev/null 2>&1
1276 ;;
1277 esac
e9d08790 1278 if cmp -s y.tab.c a2p.c
1279 then
1280 rm -f y.tab.c
1281 else
1282 echo "a2p.y -> a2p.c" >&2
1283 mv -f y.tab.c a2p.c
1284 chmod u+w a2p.c
1285 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
f1f802f7 1286 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
e9d08790 1287 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1288 xxx="$xxx a2p.c"
1289 fi
1290 # In case somebody yacc -d:ed the a2p.y.
1291 if test -f y.tab.h
1292 then
1293 if cmp -s y.tab.h a2p.h
1294 then
1295 rm -f y.tab.h
1296 else
1297 echo "a2p.h -> a2p.h" >&2
1298 mv -f y.tab.h a2p.h
1299 xxx="$xxx a2p.h"
1300 fi
1301 fi
1302 cd ..
5ff3f7a4 1303 fi
7a66b286 1304 ;;
1305vmesa)
1306 # Do nothing in VM/ESA.
1307 ;;
aa34f189 1308*)
e9d08790 1309 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 1310 ;;
fe572743 1311esac
5ff3f7a4 1312 case "$xxx" in
1313 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1314 esac
1315 ;;
1316esac
1317