This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Time::Local 1.10.
[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
NC
761$(unidatafiles): miniperl$(EXE_EXT) lib/Config.pm lib/unicore/mktables
762 cd lib/unicore && ../../miniperl -I../../lib mktables
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
e0eb806d 775 -@test -f pod/perl592delta.pod && cd pod && $(LNS) perl592delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods
72b3d9b4 776
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
JH
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
A
803
804no-install:
70eaf669 805 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
16d20bd9 806
70eaf669
IZ
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
GS
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
TB
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
TB
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
DM
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
AD
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
JH
856 -@sh -c true
857
92c28edd 858perly.h: perly.y
b233458b
JH
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
IZ
867CHMOD_W = chmod +w
868
a8581515 869# The following files are generated automatically
9ad884cb 870# autodoc.pl: pod/perlapi.pod pod/perlintern.pod
c83f8f39
JH
871# bytecode.pl: ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
872# ext/B/B/Asmdata.pm
9ad884cb
JH
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
JH
878# regcomp.pl: regnodes.h
879# warnings.pl: warnings.h lib/warnings.pm
e50aee73
AD
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
NC
884# with your existing copy of perl
885# (make regen_headers is kept for backwards compatibility)
e1354ed6 886
b4d4469a
JH
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
JH
891 ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm regnodes.h \
892 warnings.h lib/warnings.pm
e1354ed6 893
869a466c
JH
894.PHONY: regen_headers regen_pods regen_all
895
9ad884cb
JH
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
A
904.PHONY: manisort manicheck
905
906manisort: FORCE
f3a5d88c
JH
907 LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
908 LC_ALL=C sort -fdo MANIFEST MANIFEST)
1aea71db
A
909
910manicheck: FORCE
911 perl Porting/manicheck
912
a0d0e21e 913# Extensions:
4318d5a0
GB
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
LW
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
JH
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
JH
947
948clobber: _realcleaner _mopup _clobber
70af249b
CS
949
950distclean: clobber
951
2edbd6da 952# Like distclean but also removes emacs backups and *.orig.
b37ebb13
JH
953veryclean: _verycleaner _mopup _clobber
954 -@rm -f Obsolete Wanted
2edbd6da 955
70af249b
CS
956# Do not 'make _mopup' directly.
957_mopup:
cd4d8a96 958 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.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
JH
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
CS
971
972# Do not 'make _tidy' directly.
973_tidy:
e3f83878
JH
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
JH
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
PG
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
JH
1007 -rmdir lib/B lib/Data lib/Digest
1008 rm -rf lib/Encode
c61dfb31
JH
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
JH
1014 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1015 @$(LDLIBPTH) $(MAKE) _cleaner2
1016
f4db5405 1017_verycleaner:
2edbd6da
JH
1018 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1019 @$(LDLIBPTH) $(MAKE) _cleaner2
c94787a5 1020 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
2edbd6da 1021
2304df62
AD
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
AD
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
AD
1048 cd x2p; $(MAKE) depend
1049
cd4d8a96 1050# Cannot postpone this until $firstmakefile is ready ;-)
92c28edd
JH
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 \
869a466c 1057 test.third check.third utest.third ucheck.third test_notty.third \
69bfbd2f 1058 test.deparse test_notty.deparse test_harness test_harness_notty \
b26492ee 1059 test.bytecompile minitest coretest test.taintwarn
869a466c 1060
ec861bc1
JH
1061# Cannot delegate rebuilding of t/perl to make
1062# to allow interlaced test and minitest
3e3baf6d 1063
1167a30e
IZ
1064TESTFILE=TEST
1065
1066_test_prep:
ec861bc1 1067 cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
3e3baf6d 1068
1167a30e
IZ
1069# Architecture-neutral stuff:
1070
1071test_prep_pre: preplibrary utilities $(nonxs_ext)
1072
443a5b98 1073test_prep: test_prep_pre miniperl$(EXE_EXT) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
5fe84fd2 1074 PERL=./perl $(MAKE) _test_prep
ec861bc1 1075
5fe84fd2 1076_test_tty:
2a30c5e0 1077 cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
ec861bc1 1078
5fe84fd2 1079_test_notty:
2a30c5e0 1080 cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS)
ec861bc1
JH
1081
1082# The second branch is for testing without a tty or controlling terminal,
1083# see t/op/stat.t
1084_test:
994e9bc0 1085 if (true </dev/tty) >/dev/null 2>&1; then \
1167a30e 1086 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty ; \
994e9bc0 1087 else \
1167a30e 1088 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
994e9bc0 1089 fi
3d8f1d64 1090 @echo "Ran tests" > t/rantests
a0ed51b3 1091
937aca76 1092test check: test_prep
ec861bc1
JH
1093 PERL=./perl $(MAKE) _test
1094
937aca76 1095test_tty: test_prep
5fe84fd2 1096 PERL=./perl $(MAKE) _test_tty
ec861bc1 1097
937aca76 1098test_notty: test_prep
5fe84fd2 1099 PERL=./perl $(MAKE) _test_notty
ec861bc1 1100
83f0ef60 1101utest ucheck test.utf8 check.utf8: test_prep
35117553 1102 PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1103
5a6e071d
PJ
1104coretest: test_prep
1105 PERL=./perl TEST_ARGS=-core $(MAKE) _test
1106
48a293f8 1107test-prep: test_prep
5fe84fd2
JH
1108
1109test-tty: test_tty
1110
1111test-notty: test_notty
1112
e018f8be
JH
1113# Torture testing
1114
1115test.torture torturetest: test_prep
1116 PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1117
7a834142
JH
1118# Targets for valgrind testing:
1119
1120test_prep.valgrind: test_prep perl.valgrind
1121 PERL=./perl $(MAKE) _test_prep
1122
1123test.valgrind check.valgrind: test_prep perl.valgrind.config
1124 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 $(MAKE) _test
1125
1126utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind
1127 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1128
1129test_notty.valgrind: test_prep.valgrind perl.valgrind
1130 PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1131
ec861bc1
JH
1132# Targets for Third Degree testing.
1133
9b99345a 1134test_prep.third: test_prep perl.third
5fe84fd2 1135 PERL=./perl.third $(MAKE) _test_prep
ec861bc1 1136
937aca76 1137test.third check.third: test_prep.third perl.third
ec861bc1
JH
1138 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1139
937aca76 1140utest.third ucheck.third: test_prep.third perl.third
35117553 1141 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1142
937aca76 1143test_notty.third: test_prep.third perl.third
5fe84fd2 1144 PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
2304df62 1145
1df34986
AE
1146# Targets for Bytecode/ByteLoader testing.
1147
1148test.bytecompile: test_prep
1149 PERL=./perl TEST_ARGS=-bytecompile $(MAKE) _test
1150
35117553
JH
1151# Targets for Deparse testing.
1152
1153test.deparse: test_prep
1154 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1155
1156test_notty.deparse: test_prep
1157 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1158
b26492ee
RGS
1159# Targets to run the test suite with -t
1160
1161test.taintwarn: test_prep
1162 PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1163
d96ebe2e 1164# Can't depend on lib/Config.pm because that might be where miniperl
1165# is crashing.
443a5b98 1166minitest: miniperl$(EXE_EXT) lib/re.pm
4fa3f26e 1167 -@test -f lib/lib.pm && test -f lib/Config.pm || \
5ad7e614 1168 $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
4fa3f26e 1169 @echo " "
d96ebe2e 1170 @echo "You may see some irrelevant test failures if you have been unable"
5ad7e614 1171 @echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
4fa3f26e 1172 @echo " "
cd4d8a96 1173 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
43651d81 1174 && $(LDLIBPTH) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
16d20bd9 1175
1167a30e
IZ
1176# Test via harness
1177
1178test_harness: test_prep
1179 PERL=./perl $(MAKE) TESTFILE=harness _test
1180
69bfbd2f
RGS
1181test_harness_notty: test_prep
1182 PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1183
fb73857a 1184# Handy way to run perlbug -ok without having to install and run the
84902520 1185# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 1186# Please *don't* use this unless all tests pass.
1d2dff63 1187# If you want to report test failures, use "make nok" instead.
869a466c
JH
1188
1189.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1190
188cd53f 1191ok: utilities
92c28edd 1192 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 1193
105f9295 1194okfile: utilities
92c28edd 1195 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 1196
890b8eb0
NC
1197oknack: utilities
1198 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1199
1200okfilenack: utilities
1201 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1202
1d2dff63 1203nok: utilities
92c28edd 1204 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 1205
b4e8cfaf
GS
1206nokfile: utilities
1207 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1208
890b8eb0
NC
1209noknack: utilities
1210 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1211
1212nokfilenack: utilities
1213 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1214
869a466c
JH
1215.PHONY: clist hlist shlist pllist
1216
85e6fe83 1217clist: $(c)
92c28edd 1218 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 1219
85e6fe83 1220hlist: $(h)
92c28edd 1221 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 1222
85e6fe83 1223shlist: $(sh)
92c28edd 1224 echo $(sh) | tr ' ' $(TRNL) >.shlist
2304df62 1225
4633a7c4 1226pllist: $(pl)
92c28edd 1227 echo $(pl) | tr ' ' $(TRNL) >.pllist
4633a7c4 1228
92c28edd
JH
1229Makefile: Makefile.SH ./config.sh
1230 $(SHELL) Makefile.SH
760ac839 1231
869a466c 1232.PHONY: distcheck
599a829f 1233distcheck: FORCE
760ac839
LW
1234 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1235
869a466c 1236.PHONY: elc
771c4874
IZ
1237elc: emacs/cperl-mode.elc
1238
1239emacs/cperl-mode.elc: emacs/cperl-mode.el
1240 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1241
869a466c
JH
1242.PHONY: etags ctags tags
1243
d6a255e6
IZ
1244etags: TAGS
1245
1246TAGS: emacs/cperl-mode.elc
3ee700d1 1247 sh emacs/ptags
01e22528 1248
d6a255e6
IZ
1249ctags: tags
1250
1251# Let's hope make will not go into an infinite loop on case-unsensitive systems
1252# This may also fail if . is in the head of the path, since perl will
1253# require -Ilib
1254tags: TAGS
1255 perl emacs/e2ctags.pl TAGS > tags
3ee700d1 1256
2304df62
AD
1257# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1258# If this runs make out of memory, delete /usr/include lines.
1259!NO!SUBS!
1260
85e6fe83 1261$eunicefix Makefile
2304df62
AD
1262case `pwd` in
1263*SH)
85e6fe83 1264 $rm -f ../Makefile
cd4d8a96 1265 $ln Makefile ../Makefile
2304df62
AD
1266 ;;
1267esac
cd4d8a96 1268$rm -f $firstmakefile
5ff3f7a4
GS
1269
1270# Now do any special processing required before building.
1271
1272case "$ebcdic" in
2d340b60 1273define)
5ff3f7a4 1274 xxx=''
2d340b60 1275 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
7a66b286 1276case "$osname" in
25e9a2e3 1277os390|posix-bc)
e9d08790 1278 if cd x2p
5ff3f7a4 1279 then
e9d08790 1280 rm -f y.tab.c y.tab.h
5928ee40
JH
1281 case "$osname" in
1282 posix-bc)
1283 # we are using two different yaccs in BS2000 Posix!
1284 byacc a2p.y >/dev/null 2>&1
1285 ;;
1286 *) # e.g. os390
1287 yacc a2p.y >/dev/null 2>&1
1288 ;;
1289 esac
e9d08790
JH
1290 if cmp -s y.tab.c a2p.c
1291 then
1292 rm -f y.tab.c
1293 else
1294 echo "a2p.y -> a2p.c" >&2
1295 mv -f y.tab.c a2p.c
1296 chmod u+w a2p.c
1297 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
f1f802f7 1298 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
e9d08790
JH
1299 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1300 xxx="$xxx a2p.c"
1301 fi
1302 # In case somebody yacc -d:ed the a2p.y.
1303 if test -f y.tab.h
1304 then
1305 if cmp -s y.tab.h a2p.h
1306 then
1307 rm -f y.tab.h
1308 else
1309 echo "a2p.h -> a2p.h" >&2
1310 mv -f y.tab.h a2p.h
1311 xxx="$xxx a2p.h"
1312 fi
1313 fi
1314 cd ..
5ff3f7a4 1315 fi
7a66b286
JH
1316 ;;
1317vmesa)
1318 # Do nothing in VM/ESA.
1319 ;;
aa34f189 1320*)
e9d08790 1321 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 1322 ;;
fe572743 1323esac
5ff3f7a4
GS
1324 case "$xxx" in
1325 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1326 esac
1327 ;;
1328esac
1329