[perl #31851] Threading crash with closures
[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
5ad7e614 320# Unicode data files generated by mktables
321unidatafiles = lib/unicore/Canonical.pl lib/unicore/Exact.pl \
322 lib/unicore/Properties lib/unicore/Decomposition.pl \
7ebf06b3 323 lib/unicore/CombiningClass.pl lib/unicore/Name.pl lib/unicore/PVA.pl
5ad7e614 324
325# Directories of Unicode data files generated by mktables
326unidatadirs = lib/unicore/To lib/unicore/lib
327
fed7345c 328h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
dd2155a4 329h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
330h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
219f41b1 331h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
68795e93 332h5 = utf8.h warnings.h
33b839e2 333h = $(h1) $(h2) $(h3) $(h4) $(h5)
2304df62 334
10bc17b6 335c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c reentr.c
a0ed51b3 336c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c
dd2155a4 337c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c xsutils.c pad.c
68795e93 338c4 = globals.c perlio.c perlapi.c numeric.c locale.c pp_pack.c pp_sort.c
2304df62 339
c015c5e4 340c = $(c1) $(c2) $(c3) $(c4) miniperlmain.c perlmain.c opmini.c
2304df62 341
dd2155a4 342obj1 = $(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 343obj2 = 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 344obj3 = 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 345
4633a7c4 346obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
2304df62 347
348lintflags = -hbvxac
349
cd4d8a96 350.c$(OBJ_EXT):
d96ebe2e 351 $(CCCMD) $(PLDLFLAGS) $*.c
2304df62 352
89ada9f2 353.c.i:
354 $(CCCMDSRC) -E $*.c > $*.i
355
356.c.s:
357 $(CCCMDSRC) -S $*.c
358
5ad7e614 359all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) extra.pods $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
248e23d9 360 @echo " ";
fcfe1ab7 361 @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
909b3858 362
b2c07774 363.PHONY: all compile translators utilities
b27471b9 364
6ee623d5 365compile: all
366 echo "testing compilation" > testcompile;
367 cd utils; $(MAKE) compile;
f4db5405 368 cd x2p; $(MAKE) compile;
6ee623d5 369 cd pod; $(MAKE) compile;
370
443a5b98 371translators: miniperl$(EXE_EXT) lib/Config.pm FORCE
6ee623d5 372 @echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
8e07c86e 373
443a5b98 374utilities: miniperl$(EXE_EXT) lib/Config.pm $(plextract) lib/lib.pm FORCE
6ee623d5 375 @echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
909b3858 376
377
16d20bd9 378# This is now done by installman only if you actually want the man pages.
379# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83 380
381# Phony target to force checking subdirectories.
e50aee73 382# Apparently some makes require an action for the FORCE target.
869a466c 383.PHONY: FORCE
85e6fe83 384FORCE:
4633a7c4 385 @sh -c true
ac9901e0 386!NO!SUBS!
387$spitshell >>Makefile <<!GROK!THIS!
85e6fe83 388
4ba7095c 389# We do a copy of the op.c instead of a symlink because gcc gets huffy
390# if we have a symlink forest to another disk (it complains about too many
391# levels of symbolic links, even if we have only two)
392
c015c5e4 393opmini.c: op.c
394 \$(CPS) op.c opmini.tmp
395 sh mv-if-diff opmini.tmp opmini.c
396
397opmini\$(OBJ_EXT): opmini.c
ac9901e0 398 \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
bd0dd1d8 399
ac9901e0 400!GROK!THIS!
401$spitshell >>Makefile <<'!NO!SUBS!'
517e7c64 402miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
92c28edd 403 $(CCCMD) $(PLDLFLAGS) $*.c
ecfc5424 404
92c28edd 405perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
e8827f64 406 sh writemain $(DYNALOADER) $(static_ext) > writemain.tmp
92c28edd 407 sh mv-if-diff writemain.tmp perlmain.c
85e6fe83 408
e31d4690 409!NO!SUBS!
410case "$osname" in
411cygwin)
412 ;; # Let cygwin/Makefile.SHs do its work.
413*)
414 $spitshell >>Makefile <<'!NO!SUBS!'
cd4d8a96 415perlmain$(OBJ_EXT): perlmain.c
92c28edd 416 $(CCCMD) $(PLDLFLAGS) $*.c
85e6fe83 417
e31d4690 418!NO!SUBS!
419 ;;
420esac
421$spitshell >>Makefile <<'!NO!SUBS!'
a0d0e21e 422# The file ext.libs is a list of libraries that must be linked in
423# for static extensions, e.g. -lm -lgdbm, etc. The individual
424# static extension Makefile's add to it.
fed7345c 425ext.libs: $(static_ext)
a0d0e21e 426 -@test -f ext.libs || touch ext.libs
85e6fe83 427
ecfc5424 428!NO!SUBS!
599a829f 429
d96ebe2e 430# How to build libperl. This is still rather convoluted.
599a829f 431# Load up custom Makefile.SH fragment for shared loading and executables:
8736538c 432case "$osname" in
8736538c 433*)
434 Makefile_s="$osname/Makefile.SHs"
435 ;;
436esac
437
549a6b10 438case "$osname" in
439aix)
440 $spitshell >>Makefile <<!GROK!THIS!
9c839522 441LIBS = $perllibs
5f9d9a17 442# In AIX we need to change this for building Perl itself from
443# its earlier definition (which is for building external
444# extensions *after* Perl has been built and installed)
445CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
549a6b10 446
447!GROK!THIS!
448 case "$useshrplib" in
449 define|true|[yY]*)
450 $spitshell >>Makefile <<'!NO!SUBS!'
451
452LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT)
453MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT)
454
455$(LIBPERL_NONSHR): perl$(OBJ_EXT) $(obj)
456 $(RMS) $(LIBPERL_NONSHR)
457 $(AR) rcu $(LIBPERL_NONSHR) perl$(OBJ_EXT) $(obj)
458
bd0dd1d8 459$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
a7089531 460 $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
461 opmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
549a6b10 462
463MINIPERLEXP = $(MINIPERL_NONSHR)
464
465LIBPERLEXPORT = perl.exp
466
467!NO!SUBS!
468
469 ;;
470 *)
471 $spitshell >>Makefile <<'!NO!SUBS!'
472MINIPERLEXP = miniperl$(EXE_EXT)
473
474PERLEXPORT = perl.exp
475
476!NO!SUBS!
477 ;;
478 esac
479 $spitshell >>Makefile <<'!NO!SUBS!'
480perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
5c728af0 481 ./$(MINIPERLEXP) makedef.pl PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" | sort -u | sort -f > perl.exp.tmp
549a6b10 482 sh mv-if-diff perl.exp.tmp perl.exp
483
484!NO!SUBS!
485 ;;
2c2d71f5 486os2)
487 $spitshell >>Makefile <<'!NO!SUBS!'
488MINIPERLEXP = miniperl
489
490perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
5c728af0 491 ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl.exp.tmp
2c2d71f5 492 sh mv-if-diff perl.exp.tmp perl5.def
493
494!NO!SUBS!
495 ;;
549a6b10 496esac
497
8736538c 498if test -r $Makefile_s ; then
499 . $Makefile_s
d96ebe2e 500 $spitshell >>Makefile <<!GROK!THIS!
cd4d8a96 501
8736538c 502Makefile: $Makefile_s
cd4d8a96 503!GROK!THIS!
504else
f0efd8cf 505 $spitshell >>Makefile <<'!NO!SUBS!'
549a6b10 506$(LIBPERL): $& perl$(OBJ_EXT) $(obj) $(LIBPERLEXPORT)
9c9e9f08 507!NO!SUBS!
d96ebe2e 508 case "$useshrplib" in
509 true)
510 $spitshell >>Makefile <<'!NO!SUBS!'
6bdd71ef 511 $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) $(libs)
3c321fdc 512!NO!SUBS!
513 case "$osname" in
514 aix)
515 $spitshell >>Makefile <<'!NO!SUBS!'
28e8609d 516 rm -f libperl$(OBJ_EXT)
3c321fdc 517 mv $@ libperl$(OBJ_EXT)
518 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 519!NO!SUBS!
3c321fdc 520 ;;
521 esac
d96ebe2e 522 ;;
523 *)
524 $spitshell >>Makefile <<'!NO!SUBS!'
525 rm -f $(LIBPERL)
526 $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
527 @$(ranlib) $(LIBPERL)
655635e8 528!NO!SUBS!
d96ebe2e 529 ;;
530 esac
599a829f 531 $spitshell >>Makefile <<'!NO!SUBS!'
532
533# How to build executables.
534
535# The $& notation tells Sequent machines that it can do a parallel make,
536# and is harmless otherwise.
537# The miniperl -w -MExporter line is a basic cheap test to catch errors
538# before make goes on to run preplibrary and then MakeMaker on extensions.
539# This is very handy because later errors are often caused by miniperl
540# build problems but that's not obvious to the novice.
541# The Module used here must not depend on Config or any extensions.
542
ecfb2188 543!NO!SUBS!
544
545 case "${osname}${osvers}" in
8fdf96e1 546 aix*)
ecfb2188 547 $spitshell >>Makefile <<'!NO!SUBS!'
bd0dd1d8 548miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
8fdf96e1 549 $(CC) -o miniperl $(CLDFLAGS) \
550 `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
ecfb2188 551 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
bd0dd1d8 552 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188 553!NO!SUBS!
554 ;;
8fdf96e1 555 beos*|next4*)
535d2540 556 $spitshell >>Makefile <<'!NO!SUBS!'
557miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
8fdf96e1 558 $(CC) -o miniperl `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
535d2540 559 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
560 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
561!NO!SUBS!
562 ;;
cb3fc426 563 darwin*)
986530ea 564 case "$osvers" in
565 [1-6].*) ;;
566 *) case "$ldflags" in
567 *"-flat_namespace"*) ;;
568 *) # to allow opmini.o to override stuff in libperl.dylib
69625aa9 569 $spitshell >>Makefile <<!NO!SUBS!
570NAMESPACEFLAGS = -force_flat_namespace
571!NO!SUBS!
986530ea 572 ;;
573 esac
574 ;;
cb3fc426 575 esac
576 $spitshell >>Makefile <<'!NO!SUBS!'
577miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
578 -@rm -f miniperl.xok
69625aa9 579 $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o miniperl \
cb3fc426 580 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
581 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
cb3fc426 582!NO!SUBS!
583 ;;
ecfb2188 584 *)
585 $spitshell >>Makefile <<'!NO!SUBS!'
443a5b98 586miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
93c0359c 587 -@rm -f miniperl.xok
f913803b 588 $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl \
a7089531 589 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
bd0dd1d8 590 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188 591!NO!SUBS!
592 ;;
593 esac
594
595 $spitshell >>Makefile <<'!NO!SUBS!'
599a829f 596
443a5b98 597perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
93c0359c 598 -@rm -f miniperl.xok
f913803b 599 $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 600
4ae3d70a 601# Purify/Quantify Perls.
602
443a5b98 603pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 604 $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 605
443a5b98 606purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 607 $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
dbadb36a 608
443a5b98 609quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 610 $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 611
7a834142 612# Valgrind perl (currently Linux only)
613
614perl.valgrind.config: config.sh
615 @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..."
616 @$(MAKE) perl.config.dashg
617 @echo "Checking usemymalloc='n' in config.sh..."
618 @grep "^usemymalloc=" config.sh
619 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
620 @echo "And of course you have to have valgrind..."
71152cd8 621 valgrind ./perl -e 1 2>/dev/null || exit 1
7a834142 622
4ae3d70a 623# Third Degree Perl (Tru64 only)
624
719561de 625perl.config.dashg:
83f0ef60 626 @echo "Checking optimize='-g' in config.sh..."
627 @grep "^optimize=" config.sh
628 @grep "^optimize='-g'" config.sh >/dev/null || exit 1
4ae3d70a 629
630perl.third.config: config.sh
631 @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
6e36760b 632 @$(MAKE) perl.config.dashg
83f0ef60 633 @echo "Checking usemymalloc='n' in config.sh..."
634 @grep "^usemymalloc=" config.sh
635 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
170ba846 636
412c6516 637perl.third: /usr/bin/atom perl.third.config perl
dca31ef4 638 atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl
83f0ef60 639 @echo "Now you may run perl.third and then study perl.3log."
15615bfd 640
4ae3d70a 641# Pixie Perls (Tru64 and IRIX only)
642
719561de 643perl.pixie.config: config.sh
4ae3d70a 644 @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
6e36760b 645 @$(MAKE) perl.config.dashg
4ae3d70a 646
719561de 647perl.pixie.atom: /usr/bin/atom perl
4ae3d70a 648 atom -tool pixie -L. -all -toolargs="-quiet" perl
649
650perl.pixie.irix: perl
651 pixie perl
652
719561de 653perl.pixie: /usr/bin/pixie perl.pixie.config perl
4ae3d70a 654 if test -x /usr/bin/atom; then \
655 $(MAKE) perl.pixie.atom; \
656 else \
657 $(MAKE) perl.pixie.irix; \
658 fi
83f0ef60 659 @echo "Now you may run perl.pixie and then run pixie."
660
661# Gprof Perl
662
663perl.config.dashpg:
664 @echo "Checking optimize='-pg' in config.sh..."
665 @grep "^optimize=" config.sh
64778e5f 666 @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
83f0ef60 667
668perl.gprof.config: config.sh
669 @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
670 @$(MAKE) perl.config.dashpg
671
672perl.gprof: /usr/bin/gprof perl.gprof.config
64778e5f 673 @-rm -f perl
51a35ef1 674 $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
83f0ef60 675 @echo "Now you may run perl.gprof and then run gprof perl.gprof."
4ae3d70a 676
51a35ef1 677# Gcov Perl
678
679perl.config.gcov:
680 @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
681 @echo "Checking gccversion in config.sh..."
682 @grep "^gccversion=" config.sh
683 @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
684 @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
685 @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
686 @grep "^ccflags=" config.sh
687 @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
688
689perl.gcov: perl.config.gcov
690 @-rm -f perl
691 $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
692 @echo "Now you may run perl.gcov and then run gcov some.c."
693
f946bb38 694# Microperl. This is just a convenience thing if one happens to
695# build also the full Perl and therefore the real big Makefile:
f4db5405 696# usually one should manually explicitly issue the below command.
f946bb38 697
869a466c 698.PHONY: microperl
f946bb38 699microperl:
700 $(MAKE) -f Makefile.micro
701
2304df62 702# This version, if specified in Configure, does ONLY those scripts which need
703# set-id emulation. Suidperl must be setuid root. It contains the "taint"
704# checks as well as the special code to validate that the script in question
705# has been invoked correctly.
706
443a5b98 707suidperl$(EXE_EXT): $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f913803b 708 $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 709
599a829f 710!NO!SUBS!
711
712fi
713
714$spitshell >>Makefile <<'!NO!SUBS!'
715
bf0dfd28 716sperl$(OBJ_EXT): perl.c $(h)
2304df62 717 $(RMS) sperl.c
85e6fe83 718 $(LNS) perl.c sperl.c
d96ebe2e 719 $(CCCMD) -DIAMSUID sperl.c
2304df62 720 $(RMS) sperl.c
721
fec02dd3 722# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
723# test -d lib/auto || mkdir lib/auto
5b7e50ea 724# We need to autosplit in two steps because VOS can't handle so many args
fec02dd3 725#
869a466c 726.PHONY: preplibrary
a64c954a 727preplibrary: miniperl$(EXE_EXT) lib/Config.pm lib/lib.pm $(PREPLIBRARY_LIBPERL)
cd4d8a96 728 @sh ./makedir lib/auto
a0d0e21e 729 @echo " AutoSplitting perl library"
92c28edd 730 $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
5b7e50ea 731 autosplit_lib_modules(@ARGV)' lib/*.pm
732 $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
733 autosplit_lib_modules(@ARGV)' lib/*/*.pm
abae58a6 734 $(MAKE) lib/re.pm
2304df62 735
75f92628 736# Take care to avoid modifying lib/Config.pm without reason
f4db5405 737# (If trying to create a new port and having problems with the configpm script,
fb73857a 738# try 'make minitest' and/or commenting out the tests at the end of configpm.)
ab57a4d7 739lib/Config.pm: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
d2212429 740 $(LDLIBPTH) ./miniperl -Ilib configpm configpm.tmp
92c28edd 741 sh mv-if-diff configpm.tmp $@
2304df62 742
443a5b98 743lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl lib/Config.pm
e8827f64 744 $(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
92c28edd 745 sh mv-if-diff minimod.tmp $@
abae58a6 746 -touch lib/ExtUtils/Miniperl.pm
fed7345c 747
92c28edd 748lib/re.pm: ext/re/re.pm
abae58a6 749 cp ext/re/re.pm ext/re/re.tmp && sh mv-if-diff ext/re/re.tmp lib/re.pm
7cfc0d09 750
180c42e0 751$(plextract): miniperl$(EXE_EXT) lib/Config.pm x2p/s2p
42c30c63 752 @-rm -f $@
92c28edd 753 $(LDLIBPTH) ./miniperl -Ilib $@.PL
72b3d9b4 754
d4d4a62f 755x2p/s2p: miniperl$(EXE_EXT) lib/Config.pm x2p/s2p.PL
36cf9c44 756 cd x2p; $(LDLIBPTH) $(MAKE) s2p
180c42e0 757
443a5b98 758lib/lib.pm: miniperl$(EXE_EXT) lib/Config.pm
42c30c63 759 @-rm -f $@
4755096e 760 $(LDLIBPTH) ./miniperl -Ilib lib/lib_pm.PL
761
5ad7e614 762$(unidatafiles): miniperl$(EXE_EXT) lib/Config.pm lib/unicore/mktables
00da7942 763 cd lib/unicore && $(LDLIBPTH) ../../miniperl -I../../lib mktables -w
5ad7e614 764
443a5b98 765extra.pods: miniperl$(EXE_EXT)
fec93702 766 -@test -f extra.pods && rm -f `cat extra.pods`
72b3d9b4 767 -@rm -f extra.pods
b4bc034f 768 -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
72b3d9b4 769 nx=`echo $$x | sed -e "s/README\.//"`; \
40096396 770 cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
72b3d9b4 771 echo "pod/perl"$$nx".pod" >> extra.pods ; \
772 done
a8476e91 773 -@rm -f pod/perlvms.pod
774 -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
1400179b 775 -@rm -f pod/perldelta.pod
0dfdcd8a 776 -@test -f pod/perl592delta.pod && cd pod && $(LNS) perl592delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods # See buildtoc
443a5b98 777extras.make: perl$(EXE_EXT)
70eaf669 778 -@test -s extras.lst && PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
bf35c3f6 779
443a5b98 780extras.test: perl$(EXE_EXT)
70eaf669 781 -@test -s extras.lst && PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
bf35c3f6 782
443a5b98 783extras.install: perl$(EXE_EXT)
70eaf669 784 -@test -s extras.lst && PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
bf35c3f6 785
869a466c 786.PHONY: install install-strip install-all install-verbose install-silent \
5e2f386f 787 no-install install.perl install.man install.html
869a466c 788
0cf51544 789META.yml: Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
790 $(LDLIBPTH) ./miniperl -Ilib Porting/makemeta
791
f556e5b9 792install-strip:
70eaf669 793 $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
f556e5b9 794
adbebc0b 795install install-all:
70eaf669 796 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)"
c77385cf 797
4ad019ef 798install-verbose:
70eaf669 799 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)"
c458b76c 800
4ad019ef 801install-silent:
70eaf669 802 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)"
4ad019ef 803
804no-install:
70eaf669 805 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
16d20bd9 806
70eaf669 807# Set this to an empty string to avoid an attempt of rebuild before install
808INSTALL_DEPENDENCE = all
809
810install.perl: $(INSTALL_DEPENDENCE) installperl
6ee623d5 811 if [ -n "$(COMPILE)" ]; \
812 then \
813 cd utils; $(MAKE) compile; \
814 cd ../x2p; $(MAKE) compile; \
815 cd ../pod; $(MAKE) compile; \
83673e1f 816 else :; \
6ee623d5 817 fi
5a9231b0 818 $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
bf35c3f6 819 $(MAKE) extras.install
a0d0e21e 820
b1a1e9f1 821install.man: all installman
5a9231b0 822 $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
16d20bd9 823
84902520 824# XXX Experimental. Hardwired values, but useful for testing.
825# Eventually Configure could ask for some of these values.
826install.html: all installhtml
40096396 827 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
6ee623d5 828 $(LDLIBPTH) ./perl installhtml \
84902520 829 --podroot=. --podpath=. --recurse \
830 --htmldir=$(privlib)/html \
831 --htmlroot=$(privlib)/html \
832 --splithead=pod/perlipc \
833 --splititem=pod/perlfunc \
834 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
835 --verbose
836
16d20bd9 837
a0d0e21e 838# I now supply perly.c with the kits, so the following section is
0de566d7 839# used only if you force bison to run by saying
840# make regen_perly
841# You normally shouldn't remake perly.[ch].
842
843.PHONY: regen_perly
844
845run_byacc:
846 @echo "run_byacc is obsolete; try 'make regen_perly' instead"
847
848# this outputs perly.act and perly.tab
849regen_perly:
850 perl regen_perly.pl
56febc5e 851
852# We don't want to regenerate perly.c and perly.h, but they might
853# appear out-of-date after a patch is applied or a new distribution is
854# made.
92c28edd 855perly.c: perly.y
b233458b 856 -@sh -c true
857
92c28edd 858perly.h: perly.y
b233458b 859 -@sh -c true
860
bd656b61 861# No compat3.sym here since and including the 5.004_50.
e4d5a464 862# No interp.sym since 5.005_03.
22c35a8c 863SYM = global.sym globvar.sym perlio.sym pp.sym
419eaf7b 864
22c35a8c 865SYMH = perlvars.h intrpvar.h thrdvar.h
419eaf7b 866
dae78bb1 867CHMOD_W = chmod +w
868
a8581515 869# The following files are generated automatically
9ad884cb 870# autodoc.pl: pod/perlapi.pod pod/perlintern.pod
c83f8f39 871# bytecode.pl: ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
872# ext/B/B/Asmdata.pm
9ad884cb 873# embed.pl: proto.h embed.h embedvar.h global.sym
874# perlapi.h perlapi.c
875# [* embed.pl needs pp.sym generated by opcode.pl! *]
876# keywords.pl: keywords.h
877# opcode.pl: opcode.h opnames.h pp_proto.h pp.sym
c83f8f39 878# regcomp.pl: regnodes.h
879# warnings.pl: warnings.h lib/warnings.pm
e50aee73 880# The correct versions should be already supplied with the perl kit,
881# in case you don't have perl available.
36bb303b 882# To force them to be regenerated, run
9ad884cb 883# perl regen.pl
36bb303b 884# with your existing copy of perl
885# (make regen_headers is kept for backwards compatibility)
e1354ed6 886
b4d4469a 887AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
888 embed.h embedvar.h global.sym \
889 pod/perlintern.pod pod/perlapi.pod \
acfe0abc 890 perlapi.h perlapi.c ext/ByteLoader/byterun.h \
c83f8f39 891 ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm regnodes.h \
892 warnings.h lib/warnings.pm
e1354ed6 893
869a466c 894.PHONY: regen_headers regen_pods regen_all
895
9ad884cb 896regen regen_headers: FORCE
897 -perl regen.pl
8e07c86e 898
4755096e 899regen_pods: FORCE
fcfe1ab7 900 -cd pod; $(LDLIBPTH) $(MAKE) regen_pods
4755096e 901
0de566d7 902regen_all: regen regen_pods
9fec149b 903
1aea71db 904.PHONY: manisort manicheck
905
906manisort: FORCE
f3a5d88c 907 LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
908 LC_ALL=C sort -fdo MANIFEST MANIFEST)
1aea71db 909
910manicheck: FORCE
911 perl Porting/manicheck
912
a0d0e21e 913# Extensions:
4318d5a0 914# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
915# automatically get built. There should ordinarily be no need to change
916# any of this part of makefile.
a0d0e21e 917#
918# The dummy dependency is a place holder in case $(dynamic_ext) or
919# $(static_ext) is empty.
920#
921# DynaLoader may be needed for extensions that use Makefile.PL.
922
443a5b98 923$(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE
94c41b70 924 @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 925
443a5b98 926d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
92c28edd 927 @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 928
443a5b98 929s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
94c41b70 930 @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
2304df62 931
443a5b98 932n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
92c28edd 933 @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
4318d5a0 934
869a466c 935.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
936 realclean _realcleaner clobber _clobber \
937 distclean veryclean _verycleaner
938
17b893d8 939clean: _tidy _mopup
70af249b 940
2edbd6da 941realclean: _realcleaner _mopup
fcfe1ab7 942 @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
70af249b 943
b37ebb13 944_clobber:
5440bc8e 945 -@rm -f Cross/run-* Cross/to-* Cross/from-*
bf35c3f6 946 rm -f config.sh cppstdin Policy.sh extras.lst
b37ebb13 947
948clobber: _realcleaner _mopup _clobber
70af249b 949
950distclean: clobber
951
2edbd6da 952# Like distclean but also removes emacs backups and *.orig.
b37ebb13 953veryclean: _verycleaner _mopup _clobber
954 -@rm -f Obsolete Wanted
2edbd6da 955
70af249b 956# Do not 'make _mopup' directly.
957_mopup:
34433938 958 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c
1ed50e5b 959 -rmdir .depending
72b3d9b4 960 -@test -f extra.pods && rm -f `cat extra.pods`
b4bc034f 961 -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
ac83e8b0 962 -rm -f perl.exp ext.libs extra.pods opmini.o
d96ebe2e 963 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
1cfa4ec7 964 -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
9d4d067b 965 -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
6a966751 966 -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
93c0359c 967 -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
a0457be1 968 -rm -f perlld cygwin.c ld2 libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
1ed50e5b 969 -rm -f perl$(EXE_EXT) suidperl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
970 -rm -f opcode.h-old opnames.h-old pp.sym-old pp_proto.h-old
70af249b 971
972# Do not 'make _tidy' directly.
973_tidy:
e3f83878 974 -cd pod; $(LDLIBPTH) $(MAKE) clean
975 -cd utils; $(LDLIBPTH) $(MAKE) clean
976 -cd x2p; $(LDLIBPTH) $(MAKE) clean
4318d5a0 977 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
e3f83878 978 $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
a0d0e21e 979 done
6ee623d5 980 rm -f testcompile compilelog
ff68c719 981
2edbd6da 982_cleaner1:
4633a7c4 983 -cd os2; rm -f Makefile
2edbd6da 984 -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
985 -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
986 -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
4318d5a0 987 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
2edbd6da 988 $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
a0d0e21e 989 done
2edbd6da 990
2ad994b6 991# Some systems do not support "?", so keep these files separate.
2edbd6da 992_cleaner2:
2ad994b6 993 -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
994 rm -f core *perl.core t/core t/*perl.core
995 rm -f t/misctmp* t/forktmp* t/tmp* t/c t/perl$(EXE_EXT) t/rantests
996 rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
a0d0e21e 997 rm -rf $(addedbyconf)
0eb4e931 998 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
3d40713c 999 rm -f $(private) lib/Config.pod
ca12659b 1000 rm -rf $(unidatafiles) $(unidatadirs)
a0d0e21e 1001 rm -rf lib/auto
07a6e20d 1002 rm -f lib/.exists lib/*/.exists lib/*/*/.exists
16d20bd9 1003 rm -f h2ph.man pstruct
a0d0e21e 1004 rm -rf .config
9b9c6f34 1005 rm -f preload
6ee623d5 1006 rm -f testcompile compilelog
26f17523 1007 -rmdir lib/B lib/Data lib/Digest
1008 rm -rf lib/Encode
c61dfb31 1009 -rmdir lib/Filter/Util lib/IO/Socket lib/IO
1010 -rmdir lib/List lib/MIME lib/Scalar lib/Sys
1011 -rmdir lib/threads lib/XS
ecfc5424 1012
f4db5405 1013_realcleaner:
2edbd6da 1014 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1015 @$(LDLIBPTH) $(MAKE) _cleaner2
1016
f4db5405 1017_verycleaner:
2edbd6da 1018 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1019 @$(LDLIBPTH) $(MAKE) _cleaner2
c94787a5 1020 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
2edbd6da 1021
2304df62 1022# The following lint has practically everything turned on. Unfortunately,
1023# you have to wade through a lot of mumbo jumbo that can't be suppressed.
1024# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
1025# for that spot.
1026
869a466c 1027.PHONY: lint
bf0dfd28 1028lint: $(c)
2304df62 1029 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
1030
fb73857a 1031# Need to unset during recursion to go out of loop.
1032# The README below ensures that the dependency list is never empty and
1033# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 1034
84902520 1035MAKEDEPEND = Makefile makedepend
cd4d8a96 1036
fb73857a 1037$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 1038 $(MAKE) depend MAKEDEPEND=
a0d0e21e 1039
599a829f 1040config.h: config_h.SH config.sh
655635e8 1041 $(SHELL) config_h.SH
1042
a0d0e21e 1043# When done, touch perlmain.c so that it doesn't get remade each time.
869a466c 1044.PHONY: depend
2304df62 1045depend: makedepend
fb73857a 1046 sh ./makedepend MAKE=$(MAKE)
a0d0e21e 1047 - test -s perlmain.c && touch perlmain.c
2304df62 1048 cd x2p; $(MAKE) depend
1049
cd4d8a96 1050# Cannot postpone this until $firstmakefile is ready ;-)
92c28edd 1051makedepend: makedepend.SH config.sh
1052 sh ./makedepend.SH
cd4d8a96 1053
1167a30e 1054.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
869a466c 1055 test_tty test-tty _test_tty test_notty test-notty _test_notty \
e018f8be 1056 utest ucheck test.utf8 check.utf8 test.torture torturetest \
1de9afcd 1057 test.utf16 check.utf16 utest.utf16 ucheck.utf16 \
869a466c 1058 test.third check.third utest.third ucheck.third test_notty.third \
69bfbd2f 1059 test.deparse test_notty.deparse test_harness test_harness_notty \
b26492ee 1060 test.bytecompile minitest coretest test.taintwarn
869a466c 1061
ec861bc1 1062# Cannot delegate rebuilding of t/perl to make
1063# to allow interlaced test and minitest
3e3baf6d 1064
1167a30e 1065TESTFILE=TEST
1066
1067_test_prep:
ec861bc1 1068 cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
3e3baf6d 1069
1167a30e 1070# Architecture-neutral stuff:
1071
1072test_prep_pre: preplibrary utilities $(nonxs_ext)
1073
4caedec1 1074test_prep: test_prep_pre miniperl$(EXE_EXT) $(unidatafiles) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
5fe84fd2 1075 PERL=./perl $(MAKE) _test_prep
ec861bc1 1076
5fe84fd2 1077_test_tty:
2a30c5e0 1078 cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
ec861bc1 1079
5fe84fd2 1080_test_notty:
2a30c5e0 1081 cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS)
ec861bc1 1082
1083# The second branch is for testing without a tty or controlling terminal,
1084# see t/op/stat.t
1085_test:
994e9bc0 1086 if (true </dev/tty) >/dev/null 2>&1; then \
1167a30e 1087 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty ; \
994e9bc0 1088 else \
1167a30e 1089 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
994e9bc0 1090 fi
3d8f1d64 1091 @echo "Ran tests" > t/rantests
a0ed51b3 1092
937aca76 1093test check: test_prep
ec861bc1 1094 PERL=./perl $(MAKE) _test
1095
937aca76 1096test_tty: test_prep
5fe84fd2 1097 PERL=./perl $(MAKE) _test_tty
ec861bc1 1098
937aca76 1099test_notty: test_prep
5fe84fd2 1100 PERL=./perl $(MAKE) _test_notty
ec861bc1 1101
83f0ef60 1102utest ucheck test.utf8 check.utf8: test_prep
35117553 1103 PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1104
5a6e071d 1105coretest: test_prep
1106 PERL=./perl TEST_ARGS=-core $(MAKE) _test
1107
48a293f8 1108test-prep: test_prep
5fe84fd2 1109
1110test-tty: test_tty
1111
1112test-notty: test_notty
1113
e018f8be 1114# Torture testing
1115
1116test.torture torturetest: test_prep
1117 PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1118
1de9afcd 1119# Targets for UTF16 testing:
1120
1121minitest.utf16: minitest.prep
1122 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
1123 && $(LDLIBPTH) ./perl TEST -minitest -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
1124
1125test.utf16 check.utf16: test_prep
1126 PERL=./perl $(MAKE) TEST_ARGS=-utf16 _test
1127
1128utest.utf16 ucheck.utf16: test_prep
1129 PERL=./perl $(MAKE) TEST_ARGS="-utf8 -utf16" _test
1130
7a834142 1131# Targets for valgrind testing:
1132
1133test_prep.valgrind: test_prep perl.valgrind
1134 PERL=./perl $(MAKE) _test_prep
1135
1136test.valgrind check.valgrind: test_prep perl.valgrind.config
1137 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 $(MAKE) _test
1138
1139utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind
1140 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1141
1142test_notty.valgrind: test_prep.valgrind perl.valgrind
1143 PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1144
ec861bc1 1145# Targets for Third Degree testing.
1146
9b99345a 1147test_prep.third: test_prep perl.third
5fe84fd2 1148 PERL=./perl.third $(MAKE) _test_prep
ec861bc1 1149
937aca76 1150test.third check.third: test_prep.third perl.third
ec861bc1 1151 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1152
937aca76 1153utest.third ucheck.third: test_prep.third perl.third
35117553 1154 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1155
937aca76 1156test_notty.third: test_prep.third perl.third
5fe84fd2 1157 PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
2304df62 1158
1df34986 1159# Targets for Bytecode/ByteLoader testing.
1160
1161test.bytecompile: test_prep
1162 PERL=./perl TEST_ARGS=-bytecompile $(MAKE) _test
1163
35117553 1164# Targets for Deparse testing.
1165
1166test.deparse: test_prep
1167 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1168
1169test_notty.deparse: test_prep
1170 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1171
b26492ee 1172# Targets to run the test suite with -t
1173
1174test.taintwarn: test_prep
1175 PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1176
1de9afcd 1177minitest.prep:
4fa3f26e 1178 -@test -f lib/lib.pm && test -f lib/Config.pm || \
5ad7e614 1179 $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
4fa3f26e 1180 @echo " "
d96ebe2e 1181 @echo "You may see some irrelevant test failures if you have been unable"
5ad7e614 1182 @echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
4fa3f26e 1183 @echo " "
1de9afcd 1184
1185# Can't depend on lib/Config.pm because that might be where miniperl
1186# is crashing.
1187minitest: miniperl$(EXE_EXT) lib/re.pm minitest.prep
cd4d8a96 1188 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
43651d81 1189 && $(LDLIBPTH) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
16d20bd9 1190
1167a30e 1191# Test via harness
1192
1193test_harness: test_prep
1194 PERL=./perl $(MAKE) TESTFILE=harness _test
1195
69bfbd2f 1196test_harness_notty: test_prep
1197 PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1198
fb73857a 1199# Handy way to run perlbug -ok without having to install and run the
84902520 1200# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 1201# Please *don't* use this unless all tests pass.
1d2dff63 1202# If you want to report test failures, use "make nok" instead.
869a466c 1203
1204.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1205
188cd53f 1206ok: utilities
92c28edd 1207 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 1208
105f9295 1209okfile: utilities
92c28edd 1210 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 1211
890b8eb0 1212oknack: utilities
1213 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1214
1215okfilenack: utilities
1216 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1217
1d2dff63 1218nok: utilities
92c28edd 1219 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 1220
b4e8cfaf 1221nokfile: utilities
1222 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1223
890b8eb0 1224noknack: utilities
1225 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1226
1227nokfilenack: utilities
1228 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1229
869a466c 1230.PHONY: clist hlist shlist pllist
1231
85e6fe83 1232clist: $(c)
92c28edd 1233 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 1234
85e6fe83 1235hlist: $(h)
92c28edd 1236 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 1237
85e6fe83 1238shlist: $(sh)
92c28edd 1239 echo $(sh) | tr ' ' $(TRNL) >.shlist
2304df62 1240
4633a7c4 1241pllist: $(pl)
92c28edd 1242 echo $(pl) | tr ' ' $(TRNL) >.pllist
4633a7c4 1243
92c28edd 1244Makefile: Makefile.SH ./config.sh
1245 $(SHELL) Makefile.SH
760ac839 1246
869a466c 1247.PHONY: distcheck
599a829f 1248distcheck: FORCE
760ac839 1249 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1250
869a466c 1251.PHONY: elc
771c4874 1252elc: emacs/cperl-mode.elc
1253
1254emacs/cperl-mode.elc: emacs/cperl-mode.el
1255 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1256
869a466c 1257.PHONY: etags ctags tags
1258
d6a255e6 1259etags: TAGS
1260
1261TAGS: emacs/cperl-mode.elc
3ee700d1 1262 sh emacs/ptags
01e22528 1263
d6a255e6 1264ctags: tags
1265
1266# Let's hope make will not go into an infinite loop on case-unsensitive systems
1267# This may also fail if . is in the head of the path, since perl will
1268# require -Ilib
1269tags: TAGS
1270 perl emacs/e2ctags.pl TAGS > tags
3ee700d1 1271
2304df62 1272# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1273# If this runs make out of memory, delete /usr/include lines.
1274!NO!SUBS!
1275
85e6fe83 1276$eunicefix Makefile
2304df62 1277case `pwd` in
1278*SH)
85e6fe83 1279 $rm -f ../Makefile
cd4d8a96 1280 $ln Makefile ../Makefile
2304df62 1281 ;;
1282esac
cd4d8a96 1283$rm -f $firstmakefile
5ff3f7a4 1284
1285# Now do any special processing required before building.
1286
1287case "$ebcdic" in
2d340b60 1288define)
5ff3f7a4 1289 xxx=''
2d340b60 1290 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
7a66b286 1291case "$osname" in
25e9a2e3 1292os390|posix-bc)
e9d08790 1293 if cd x2p
5ff3f7a4 1294 then
e9d08790 1295 rm -f y.tab.c y.tab.h
5928ee40 1296 case "$osname" in
1297 posix-bc)
1298 # we are using two different yaccs in BS2000 Posix!
1299 byacc a2p.y >/dev/null 2>&1
1300 ;;
1301 *) # e.g. os390
1302 yacc a2p.y >/dev/null 2>&1
1303 ;;
1304 esac
e9d08790 1305 if cmp -s y.tab.c a2p.c
1306 then
1307 rm -f y.tab.c
1308 else
1309 echo "a2p.y -> a2p.c" >&2
1310 mv -f y.tab.c a2p.c
1311 chmod u+w a2p.c
1312 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
f1f802f7 1313 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
e9d08790 1314 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1315 xxx="$xxx a2p.c"
1316 fi
1317 # In case somebody yacc -d:ed the a2p.y.
1318 if test -f y.tab.h
1319 then
1320 if cmp -s y.tab.h a2p.h
1321 then
1322 rm -f y.tab.h
1323 else
1324 echo "a2p.h -> a2p.h" >&2
1325 mv -f y.tab.h a2p.h
1326 xxx="$xxx a2p.h"
1327 fi
1328 fi
1329 cd ..
5ff3f7a4 1330 fi
7a66b286 1331 ;;
1332vmesa)
1333 # Do nothing in VM/ESA.
1334 ;;
aa34f189 1335*)
e9d08790 1336 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 1337 ;;
fe572743 1338esac
5ff3f7a4 1339 case "$xxx" in
1340 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1341 esac
1342 ;;
1343esac
1344