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