This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refine Win32's s{GM|LOCAL}TIME_{min|max} values based on the output of
[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 12
5a20539c
VK
13case $CROSS_NAME in
14'')
15 Makefile=Makefile
16 ;;
17*)
18 # if cross-compilation, the Makefile named accordingly
19 Makefile=Makefile-cross-$CROSS_NAME
20 . Cross/config-${CROSS_NAME}.sh
21 ;;
22esac
23
761ee4e8
BD
24# H.Merijn Brand [17 Feb 2004]
25# This comment is just to ensure that Configure will find variables that
26# are removed/replaced in patches on blead, but are still needed in the
27# 5.8.x, 5.6.x and 5.005.x maintainance tracks.
28# metaconfig -m will scan all .SH files on this level (not deeper), and
29# not in x2p and other subfolders. This file is as good as any .SH
30# patch references
31# #22227 $baserev
32# #22302 $yacc $byacc
33
08c92000
MB
34# H.Merijn Brand [30 Oct 2004]
35# Mentioned for the same reason for future reference
36# #23434 $d_strlcat $d_strlcpy
37
2304df62
AD
38: This forces SH files to create target in same directory as SH file.
39: This is so that make depend always knows where to find SH derivatives.
40case "$0" in
41*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
42esac
43
2304df62
AD
44case "$d_dosuid" in
45*define*) suidperl='suidperl' ;;
46*) suidperl='';;
47esac
48
d5d19f97 49linklibperl='$(LIBPERL)'
3c321fdc 50shrpldflags='$(LDDLFLAGS)'
6ee623d5 51ldlibpth=''
ac9901e0 52DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
d96ebe2e 53case "$useshrplib" in
54true)
f4db5405 55 # Prefix all runs of 'miniperl' and 'perl' with
5cf1d1f1 56 # $ldlibpth so that ./perl finds *this* shared libperl.
c1b49bc0
GS
57 case "$LD_LIBRARY_PATH" in
58 '')
59 ldlibpth="LD_LIBRARY_PATH=`pwd`";;
60 *)
61 ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
62 esac
6ee623d5 63
d5d19f97 64 pldlflags="$cccdlflags"
94c41b70 65 static_target='static_pic'
d96ebe2e 66 case "${osname}${osvers}" in
67 next4*)
3c321fdc 68 ld=libtool
69 lddlflags="-dynamic -undefined warning -framework System \
70 -compatibility_version 1 -current_version $patchlevel \
71 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
6ee623d5 72 ;;
f556e5b9
JH
73 rhapsody*|darwin*)
74 shrpldflags="${ldflags} -dynamiclib \
c1e7a127
W
75 -compatibility_version \
76 ${api_revision}.${api_version}.${api_subversion} \
f556e5b9 77 -current_version \
c1e7a127 78 ${revision}.${patchlevel}.${subversion} \
f556e5b9
JH
79 -install_name \$(shrpdir)/\$@"
80 ;;
5cf1d1f1 81 cygwin*)
5f9145a3
RU
82 shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a -Wl,--image-base,0x52000000"
83 linklibperl="-L. -lperl"
8736538c 84 ;;
73d40b3e 85 sunos*)
d5d19f97
UP
86 linklibperl="-lperl"
87 ;;
a774dfe6 88 netbsd*|freebsd[234]*|openbsd*|dragonfly*)
099685bc
JH
89 linklibperl="-L. -lperl"
90 ;;
0c52c6a9
TV
91 interix*)
92 linklibperl="-L. -lperl"
93 shrpldflags="$shrpldflags -Wl,--image-base,0x57000000"
94 ;;
3c321fdc 95 aix*)
96 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
1553ab04 97 case "$osvers" in
549a6b10 98 3*) shrpldflags="$shrpldflags -e _nostart"
1553ab04 99 ;;
6f476969 100 *) shrpldflags="$shrpldflags -bnoentry"
1553ab04
TB
101 ;;
102 esac
9c839522 103 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
549a6b10 104 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
3c321fdc 105 ;;
1c7d1a19
GS
106 hpux*)
107 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
46193409 108 ;;
ac9901e0 109 os390*)
4144573e 110 shrpldflags='-W l,XPLINK,dll'
ac9901e0
PP
111 linklibperl='libperl.x'
112 DPERL_EXTERNAL_GLOB=''
113 ;;
655635e8 114 esac
5cf1d1f1
JH
115 case "$ldlibpthname" in
116 '') ;;
117 *)
118 case "$osname" in
119 os2)
120 ldlibpth=''
121 ;;
5cf1d1f1
JH
122 *)
123 eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\""
124 ;;
125 esac
c1b49bc0
GS
126 # Strip off any trailing :'s
127 ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
5cf1d1f1
JH
128 ;;
129 esac
ecfc5424 130
9b9c6f34
AE
131 case "$ldlibpth" in
132 # Protect any spaces
133 *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
134 esac
6904989c 135
9b9c6f34
AE
136 case "$osname" in
137 linux)
830717a7
AD
138 # If there is a pre-existing $libperl from a previous
139 # installation, Linux needs to use LD_PRELOAD to
140 # override the LD_LIBRARY_PATH setting. See the
141 # INSTALL file, under "Building a shared perl library".
142 # If there is no pre-existing $libperl, we don't need
143 # to do anything further.
144 if test -f $archlib/CORE/$libperl; then
68e8d60a 145 rm -f preload
d0ae58a5 146 cat <<'EOT' > preload
fde91635
JH
147#! /bin/sh
148lib=$1
149shift
150test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
151exec "$@"
152EOT
9b9c6f34
AE
153 chmod 755 preload
154 ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
830717a7
AD
155 fi
156 ;;
9b9c6f34
AE
157 os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
158 ;;
60d79001 159 esac
9b9c6f34 160
60d79001 161 ;;
9b9c6f34
AE
162
163*) pldlflags=''
164 static_target='static'
b1f5ad7d
JH
165 ;;
166esac
167
a0d0e21e
LW
168: Prepare dependency lists for Makefile.
169dynamic_list=' '
9f3ef600 170extra_dep=''
a0d0e21e
LW
171for f in $dynamic_ext; do
172 : the dependency named here will never exist
ecfc5424 173 base=`echo "$f" | sed 's/.*\///'`
9f3ef600
NC
174 this_target="lib/auto/$f/$base.$dlext"
175 dynamic_list="$dynamic_list $this_target"
176
177 : Parallel makes reveal that we have some interdependencies
178 case $f in
90e91dd8 179 Math/BigInt/FastCalc|Devel/NYTProf) extra_dep="$extra_dep
9f3ef600
NC
180$this_target: lib/auto/List/Util/Util.$dlext" ;;
181 Unicode/Normalize) extra_dep="$extra_dep
182$this_target: uni.data" ;;
183 esac
a0d0e21e
LW
184done
185
186static_list=' '
a0d0e21e
LW
187for f in $static_ext; do
188 base=`echo "$f" | sed 's/.*\///'`
cd4d8a96 189 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
a0d0e21e
LW
190done
191
4318d5a0
GB
192nonxs_list=' '
193for f in $nonxs_ext; do
194 base=`echo "$f" | sed 's/.*\///'`
195 nonxs_list="$nonxs_list ext/$f/pm_to_blib"
196done
197
5ac1e9b2
AA
198dtrace_h=''
199dtrace_o=''
200case "$usedtrace" in
201define|true)
202 dtrace_h='perldtrace.h'
203 $dtrace -G -s perldtrace.d -o perldtrace.tmp >/dev/null 2>&1 \
204 && rm -f perldtrace.tmp && dtrace_o='perldtrace$(OBJ_EXT)'
205 ;;
206esac
207
5a20539c
VK
208echo "Extracting $Makefile (with variable substitutions)"
209$spitshell >$Makefile <<!GROK!THIS!
210# $Makefile
85e6fe83
LW
211# This file is derived from Makefile.SH. Any changes made here will
212# be lost the next time you run Configure.
655635e8 213# Makefile is used to generate $firstmakefile. The only difference
214# is that $firstmakefile has the dependencies filled in at the end.
0de566d7 215
2304df62 216CC = $cc
232e078e 217LD = $ld
16d20bd9 218
2304df62
AD
219LDFLAGS = $ldflags
220CLDFLAGS = $ldflags
85e6fe83 221
2304df62
AD
222mallocsrc = $mallocsrc
223mallocobj = $mallocobj
00e74f14
NC
224madlysrc = $madlysrc
225madlyobj = $madlyobj
85e6fe83 226LNS = $lns
4c901d04
JH
227# NOTE: some systems don't grok "cp -f". XXX Configure test needed?
228CPS = $cp
2304df62 229RMS = rm -f
85e6fe83
LW
230ranlib = $ranlib
231
16d20bd9
AD
232# The following are mentioned only to make metaconfig include the
233# appropriate questions in Configure. If you want to change these,
8e07c86e 234# edit config.sh instead, or specify --man1dir=/wherever on
16d20bd9
AD
235# installman commandline.
236bin = $installbin
237scriptdir = $scriptdir
d96ebe2e 238shrpdir = $archlibexp/CORE
16d20bd9
AD
239privlib = $installprivlib
240man1dir = $man1dir
241man1ext = $man1ext
242man3dir = $man3dir
243man3ext = $man3ext
244
85e6fe83
LW
245# The following are used to build and install shared libraries for
246# dynamic loading.
247LDDLFLAGS = $lddlflags
3c321fdc 248SHRPLDFLAGS = $shrpldflags
85e6fe83 249CCDLFLAGS = $ccdlflags
a0d0e21e 250DLSUFFIX = .$dlext
ecfc5424 251PLDLFLAGS = $pldlflags
d96ebe2e 252LIBPERL = $libperl
d5d19f97 253LLIBPERL= $linklibperl
ecfc5424 254SHRPENV = $shrpenv
a0d0e21e 255
94c41b70
AD
256# Static targets are ordinarily built without CCCDLFLAGS. However,
257# if building a shared libperl.so that might later be linked into
258# another application, then it might be appropriate to also build static
259# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
260# for GNU cc). This is handled by ext/util/make_ext.
261STATIC = $static_target
262
6ee623d5 263# The following is used to include the current directory in
5cf1d1f1 264# the dynamic loader path you are building a shared libperl.
6ee623d5
GS
265LDLIBPTH = $ldlibpth
266
cef6ea9d
JH
267# Sometimes running an executable is an adventure.
268RUN = $run
269
5a20539c
VK
270# These variables may need to be manually set for non-Unix systems.
271AR = $full_ar
272HOST_EXE_EXT =
273EXE_EXT = $_exe
274LIB_EXT = $_a
275OBJ_EXT = $_o
276PATH_SEP = $p_
277
278#
a0d0e21e
LW
279dynamic_ext = $dynamic_list
280static_ext = $static_list
4318d5a0
GB
281nonxs_ext = $nonxs_list
282ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
908fcb8b 283DYNALOADER = DynaLoader\$(OBJ_EXT)
2304df62 284
9c839522 285libs = $perllibs $cryptlib
2304df62 286
443a5b98 287public = perl\$(EXE_EXT) $suidperl utilities translators
2304df62
AD
288
289shellflags = $shellflags
290
d96ebe2e 291# This is set to MAKE=$make if your $make command doesn't
292# do it for you.
293$make_set_make
4633a7c4 294
1fef16b3
JH
295# Mention $gmake here so it gets probed for by Configure.
296
4f9287d3
NC
297# If you're going to use valgrind and it can't be invoked as plain valgrind
298# then you'll need to change this, or override it on the make command line.
299VALGRIND=valgrind
300
5ac1e9b2
AA
301DTRACE = $dtrace
302DTRACE_H = $dtrace_h
303DTRACE_O = $dtrace_o
304
4633a7c4
LW
305FIRSTMAKEFILE = $firstmakefile
306
307# Any special object files needed by this architecture, e.g. os2/os2.obj
308ARCHOBJS = $archobjs
309
89ada9f2 310.SUFFIXES: .c \$(OBJ_EXT) .i .s
cd4d8a96 311
d96ebe2e 312# grrr
313SHELL = $sh
655635e8 314
28e8609d
JH
315# how to tr(anslate) newlines
316TRNL = '$trnl'
317
82240bfc
JH
318OPTIMIZE = $optimize
319
3343e82c
JH
320EXTRAS = $extras
321
bf35c3f6
JH
322INSTALLPREFIXEXP = $prefix
323
d56c5707 324!GROK!THIS!
b7b35fc2 325# not used by Makefile but by installperl;
d56c5707
JH
326# mentioned here so that metaconfig picks these up
327# $installusrbinperl
328# $versiononly
b7b35fc2 329
8170cb12
JH
330case "${osname}:${osvers}" in
331darwin:*)
5a20539c 332$spitshell >>$Makefile <<EOF
8170cb12
JH
333
334# Your locales are broken (osname $osname, osvers $osvers)
335# and to avoid the numerous
336# perl: warning: Setting locale failed.
337# warnings during the build process we reset the locale variables.
338
339LC_ALL=C
340LANG=C
341LANGUAGE=C
342EOF
343 ;;
344esac
2304df62 345
5a20539c
VK
346case $CROSS_NAME in
347'')
85e6fe83 348## In the following dollars and backticks do not need the extra backslash.
5a20539c 349$spitshell >>$Makefile <<'!NO!SUBS!'
2304df62 350
75550b4e 351CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@`
89ada9f2 352
75550b4e 353CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<`
2304df62 354
2d9d8159 355CONFIGPM = lib/Config.pm lib/Config_heavy.pl
5a20539c
VK
356
357CONFIGPOD = lib/Config.pod
358
359CONFIGH = config.h
360!NO!SUBS!
361 ;;
362*)
363 # if cross-compilation
364$spitshell >>$Makefile <<!GROK!THIS!
365CROSS_NAME = $CROSS_NAME
366CROSS_LIB = xlib/$CROSS_NAME
367
368CCCMD = \`sh \$(shellflags) cflags-cross-$CROSS_NAME "optimize='\$(OPTIMIZE)'" \$@\` -I\$(CROSS_LIB)
369CCCMDSRC = \`sh \$(shellflags) cflags-cross-$CROSS_NAME "optimize='\$(OPTIMIZE)'" \$<\` -I\$(CROSS_LIB)
370CONFIGPM = xlib/\$(CROSS_NAME)/Config.pm
371CONFIGPOD = xlib/\$(CROSS_NAME)/Config.pod
372CONFIGH = xconfig.h
373
374xconfig.h: config_h.SH Cross/config-\$(CROSS_NAME).sh
375 CONFIG_SH=Cross/config-\$(CROSS_NAME).sh CONFIG_H=xconfig.h \$(SHELL) config_h.SH
376 #TODO \$(LDLIBPTH) ./miniperl -Ilib -MCross=\$(CROSS_NAME) config_h.PL "INST_VER=\$(INST_VER)" "CORE_DIR=\$(CROSS_LIB)" "CONFIG_H=xconfig.h"
377 cp xconfig.h \$(CROSS_LIB)/
378 cp xconfig.h \$(CROSS_LIB)/config.h
379
380!GROK!THIS!
381 ;;
382esac
383
384## In the following dollars and backticks do not need the extra backslash.
385$spitshell >>$Makefile <<'!NO!SUBS!'
386
387private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm
2304df62 388
4633a7c4
LW
389# Files to be built with variable substitution before miniperl
390# is available.
391sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
4755096e 392 makedir.SH myconfig.SH writemain.SH pod/Makefile.SH
4633a7c4 393
3ebb1980 394shextract = Makefile cflags config.h makeaperl makedepend \
4755096e 395 makedir myconfig writemain pod/Makefile
4633a7c4
LW
396
397# Files to be built with variable substitution after miniperl is
398# available. Dependencies handled manually below (for now).
2304df62 399
efb12ca0 400pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
41630250 401 pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL
4633a7c4 402
4755096e 403# lib/lib.pm is not listed here because it has a rule of its own.
efb12ca0 404plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
41630250 405 pod/pod2usage pod/podchecker pod/podselect
4633a7c4 406
4755096e 407addedbyconf = UU $(shextract) $(plextract) lib/lib.pm pstruct
2304df62 408
5ad7e614
NC
409# Unicode data files generated by mktables
410unidatafiles = lib/unicore/Canonical.pl lib/unicore/Exact.pl \
411 lib/unicore/Properties lib/unicore/Decomposition.pl \
7ebf06b3 412 lib/unicore/CombiningClass.pl lib/unicore/Name.pl lib/unicore/PVA.pl
5ad7e614
NC
413
414# Directories of Unicode data files generated by mktables
415unidatadirs = lib/unicore/To lib/unicore/lib
416
5a20539c 417h1 = EXTERN.h INTERN.h XSUB.h av.h $(CONFIGH) cop.h cv.h dosish.h
dd2155a4
DM
418h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
419h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
219f41b1 420h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
5ac1e9b2 421h5 = utf8.h warnings.h mydtrace.h
33b839e2 422h = $(h1) $(h2) $(h3) $(h4) $(h5)
2304df62 423
e1a479c5 424c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro.c perl.c
00e74f14
NC
425c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c
426c3 = taint.c toke.c util.c deb.c run.c universal.c xsutils.c pad.c globals.c
427c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c
428c5 = $(madlysrc) $(mallocsrc)
2304df62 429
00e74f14 430c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c perlmain.c opmini.c
2304df62 431
e1a479c5 432obj1 = $(madlyobj) $(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) mro$(OBJ_EXT)
a643aca6 433obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) perl$(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)
7ee2227d 434obj3 = 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) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT)
655635e8 435
5ac1e9b2
AA
436ndt_obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
437obj = $(ndt_obj) $(DTRACE_O)
2304df62 438
075abff3 439lintflags = \
5f66b61c
AL
440 -b \
441 -n \
075abff3 442 -p \
075abff3
AL
443 -Ncheck=%all \
444 -Nlevel=4 \
bb263b4e
AL
445 -errchk=parentheses \
446 -errhdr=%all \
66a1b24b 447 -errfmt=src \
075abff3 448 -errtags \
5f66b61c 449 -erroff=E_ASSIGN_NARROW_CONV \
075abff3 450 -erroff=E_BAD_PTR_CAST \
5f66b61c
AL
451 -erroff=E_BAD_PTR_CAST_ALIGN \
452 -erroff=E_BAD_PTR_INT_COMBINATION \
453 -erroff=E_BAD_SIGN_EXTEND \
075abff3 454 -erroff=E_BLOCK_DECL_UNUSED \
5f66b61c 455 -erroff=E_CASE_FALLTHRU \
abcf5ada 456 -erroff=E_CONST_EXPR \
075abff3 457 -erroff=E_CONSTANT_CONDITION \
abcf5ada 458 -erroff=E_END_OF_LOOP_CODE_NOT_REACHED \
5f66b61c 459 -erroff=E_EQUALITY_NOT_ASSIGNMENT \
075abff3 460 -erroff=E_EXPR_NULL_EFFECT \
66a1b24b 461 -erroff=E_FALSE_LOGICAL_EXPR \
66a1b24b 462 -erroff=E_INCL_NUSD \
5f66b61c 463 -erroff=E_LOOP_EMPTY \
66a1b24b 464 -erroff=E_MAIN_PARAM \
5f66b61c
AL
465 -erroff=E_POINTER_TO_OBJECT \
466 -erroff=E_PTRDIFF_OVERFLOW \
467 -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L \
468 -erroff=E_STATIC_UNUSED \
05c462c4 469 -erroff=E_TRUE_LOGICAL_EXPR
2304df62 470
abcf5ada
AL
471splintflags = \
472 -I/usr/lib/gcc/i486-linux-gnu/4.0.2/include/ \
473 -D__builtin_va_list=va_list \
474 -Dsigjmp_buf=jmp_buf \
475 -warnposix \
476 \
477 +boolint \
478 +charintliteral \
479 -fixedformalarray \
480 -mustfreefresh \
481 -nestedextern \
482 -predboolint \
483 -predboolothers \
484 -preproc \
485 -boolops \
486 -shadow \
487 -nullstate \
488 +longintegral \
489 +matchanyintegral \
490 -type \
491 \
492 +line-len 999 \
493 +weak
494
495splintfiles = $(c1)
496
cd4d8a96 497.c$(OBJ_EXT):
d96ebe2e 498 $(CCCMD) $(PLDLFLAGS) $*.c
2304df62 499
89ada9f2
JH
500.c.i:
501 $(CCCMDSRC) -E $*.c > $*.i
502
503.c.s:
504 $(CCCMDSRC) -S $*.c
505
51356d76
NC
506all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) extra.pods $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
507 @echo " ";
508 @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
509
81c61bd5
NC
510sperl$(OBJ_EXT): perl.c $(h)
511 $(RMS) sperl.c
512 $(LNS) perl.c sperl.c
513 $(CCCMD) -DIAMSUID sperl.c
514 $(RMS) sperl.c
515
516sperl.i: perl.c $(h)
517 $(CCCMDSRC) -DIAMSUID -E perl.c > sperl.i
518
de125441 519.PHONY: all translators utilities
6ee623d5 520
2d9d8159 521translators: miniperl$(EXE_EXT) $(CONFIGPM) FORCE
6ee623d5 522 @echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
8e07c86e 523
2d9d8159 524utilities: miniperl$(EXE_EXT) $(CONFIGPM) $(plextract) lib/lib.pm FORCE
6ee623d5 525 @echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
909b3858 526
527
16d20bd9
AD
528# This is now done by installman only if you actually want the man pages.
529# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83
LW
530
531# Phony target to force checking subdirectories.
e50aee73 532# Apparently some makes require an action for the FORCE target.
869a466c 533.PHONY: FORCE
85e6fe83 534FORCE:
4633a7c4 535 @sh -c true
ac9901e0 536!NO!SUBS!
5a20539c 537$spitshell >>$Makefile <<!GROK!THIS!
85e6fe83 538
4ba7095c
JH
539# We do a copy of the op.c instead of a symlink because gcc gets huffy
540# if we have a symlink forest to another disk (it complains about too many
541# levels of symbolic links, even if we have only two)
542
c015c5e4 543opmini.c: op.c
3d30f400 544 \$(RMS) opmini.c
2c38b89b 545 \$(CPS) op.c opmini.c
c015c5e4
NC
546
547opmini\$(OBJ_EXT): opmini.c
ac9901e0 548 \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
bd0dd1d8 549
9444d213
NC
550globals\$(OBJ_EXT): uudmap.h
551
5a20539c
VK
552uudmap.h: generate_uudmap\$(HOST_EXE_EXT)
553 \$(RUN) ./generate_uudmap\$(HOST_EXE_EXT) >uudmap.h
9444d213 554
5a20539c
VK
555generate_uudmap\$(HOST_EXE_EXT): generate_uudmap\$(OBJ_EXT)
556 \$(CC) -o generate_uudmap\$(EXE_EXT) \$(LDFLAGS) generate_uudmap\$(OBJ_EXT) \$(libs)
9444d213 557
ac9901e0 558!GROK!THIS!
5a20539c 559$spitshell >>$Makefile <<'!NO!SUBS!'
517e7c64 560miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
92c28edd 561 $(CCCMD) $(PLDLFLAGS) $*.c
ecfc5424 562
92c28edd 563perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
2c38b89b 564 sh writemain $(DYNALOADER) $(static_ext) > perlmain.c
85e6fe83 565
cd4d8a96 566perlmain$(OBJ_EXT): perlmain.c
92c28edd 567 $(CCCMD) $(PLDLFLAGS) $*.c
85e6fe83 568
a0d0e21e
LW
569# The file ext.libs is a list of libraries that must be linked in
570# for static extensions, e.g. -lm -lgdbm, etc. The individual
571# static extension Makefile's add to it.
fed7345c 572ext.libs: $(static_ext)
a0d0e21e 573 -@test -f ext.libs || touch ext.libs
85e6fe83 574
ecfc5424 575!NO!SUBS!
599a829f 576
d96ebe2e 577# How to build libperl. This is still rather convoluted.
599a829f 578# Load up custom Makefile.SH fragment for shared loading and executables:
8736538c 579case "$osname" in
8736538c
AS
580*)
581 Makefile_s="$osname/Makefile.SHs"
582 ;;
583esac
584
549a6b10
JH
585case "$osname" in
586aix)
5a20539c 587 $spitshell >>$Makefile <<!GROK!THIS!
9c839522 588LIBS = $perllibs
5f9d9a17
ME
589# In AIX we need to change this for building Perl itself from
590# its earlier definition (which is for building external
591# extensions *after* Perl has been built and installed)
592CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
549a6b10
JH
593
594!GROK!THIS!
595 case "$useshrplib" in
596 define|true|[yY]*)
5a20539c 597 $spitshell >>$Makefile <<'!NO!SUBS!'
549a6b10
JH
598
599LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT)
600MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT)
601
a643aca6 602$(LIBPERL_NONSHR): $(obj)
549a6b10 603 $(RMS) $(LIBPERL_NONSHR)
a643aca6 604 $(AR) rcu $(LIBPERL_NONSHR) $(obj)
549a6b10 605
bd0dd1d8 606$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
a7089531
GS
607 $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
608 opmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
549a6b10
JH
609
610MINIPERLEXP = $(MINIPERL_NONSHR)
611
612LIBPERLEXPORT = perl.exp
613
614!NO!SUBS!
615
616 ;;
617 *)
5a20539c 618 $spitshell >>$Makefile <<'!NO!SUBS!'
549a6b10
JH
619MINIPERLEXP = miniperl$(EXE_EXT)
620
621PERLEXPORT = perl.exp
622
623!NO!SUBS!
624 ;;
625 esac
5a20539c 626 $spitshell >>$Makefile <<'!NO!SUBS!'
549a6b10 627perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
2c38b89b 628 ./$(MINIPERLEXP) makedef.pl PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" | sort -u | sort -f > perl.exp
549a6b10
JH
629
630!NO!SUBS!
631 ;;
2c2d71f5 632os2)
5a20539c 633 $spitshell >>$Makefile <<'!NO!SUBS!'
2c2d71f5
JH
634MINIPERLEXP = miniperl
635
636perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
46aae397 637 ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def
2c2d71f5
JH
638
639!NO!SUBS!
640 ;;
5f9145a3 641cygwin)
5a20539c 642 $spitshell >>$Makefile <<'!NO!SUBS!'
5f9145a3
RU
643cygwin.c: cygwin/cygwin.c
644 $(LNS) cygwin/cygwin.c
645
646LIBPERL_NONSHR = libperl$(LIB_EXT)
647
648$(LIBPERL_NONSHR): $(obj)
649 $(RMS) $(LIBPERL_NONSHR)
650 $(AR) rcu $(LIBPERL_NONSHR) $(obj)
651
652!NO!SUBS!
653 ;;
549a6b10
JH
654esac
655
5f9145a3 656if test -s $Makefile_s ; then
8736538c 657 . $Makefile_s
5a20539c 658 $spitshell >>$Makefile <<!GROK!THIS!
cd4d8a96 659
8736538c 660Makefile: $Makefile_s
cd4d8a96 661!GROK!THIS!
662else
5ac1e9b2
AA
663 case "$dtrace_h" in
664 ?*)
5a20539c 665 $spitshell >>$Makefile <<'!NO!SUBS!'
5ac1e9b2
AA
666$(DTRACE_H): perldtrace.d
667 $(DTRACE) -h -s perldtrace.d -o $(DTRACE_H)
668
669mydtrace.h: $(DTRACE_H)
670
671!NO!SUBS!
672 ;;
673 esac
674 case "$dtrace_o" in
675 ?*)
5a20539c 676 $spitshell >>$Makefile <<'!NO!SUBS!'
5ac1e9b2
AA
677$(DTRACE_O): perldtrace.d
678 $(DTRACE) -G -s perldtrace.d -o $(DTRACE_O) $(ndt_obj)
679
680!NO!SUBS!
681 ;;
682 esac
5a20539c 683 $spitshell >>$Makefile <<'!NO!SUBS!'
908fcb8b 684$(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT)
9c9e9f08 685!NO!SUBS!
d96ebe2e 686 case "$useshrplib" in
687 true)
5a20539c 688 $spitshell >>$Makefile <<'!NO!SUBS!'
0107c41a 689 rm -f $@
908fcb8b 690 $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
3c321fdc 691!NO!SUBS!
692 case "$osname" in
693 aix)
5a20539c 694 $spitshell >>$Makefile <<'!NO!SUBS!'
28e8609d 695 rm -f libperl$(OBJ_EXT)
3c321fdc 696 mv $@ libperl$(OBJ_EXT)
697 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 698!NO!SUBS!
3c321fdc 699 ;;
700 esac
d96ebe2e 701 ;;
702 *)
5a20539c 703 $spitshell >>$Makefile <<'!NO!SUBS!'
d96ebe2e 704 rm -f $(LIBPERL)
908fcb8b 705 $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER)
d96ebe2e 706 @$(ranlib) $(LIBPERL)
655635e8 707!NO!SUBS!
d96ebe2e 708 ;;
709 esac
5a20539c 710 $spitshell >>$Makefile <<'!NO!SUBS!'
599a829f
IZ
711
712# How to build executables.
713
714# The $& notation tells Sequent machines that it can do a parallel make,
715# and is harmless otherwise.
716# The miniperl -w -MExporter line is a basic cheap test to catch errors
717# before make goes on to run preplibrary and then MakeMaker on extensions.
718# This is very handy because later errors are often caused by miniperl
719# build problems but that's not obvious to the novice.
720# The Module used here must not depend on Config or any extensions.
721
ecfb2188
GS
722!NO!SUBS!
723
724 case "${osname}${osvers}" in
e56d2c04 725 aix*|beos*)
5a20539c
VK
726 $spitshell >>$Makefile <<'!NO!SUBS!'
727miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
728 $(CC) -o miniperl$(EXE_EXT) $(CLDFLAGS) \
8fdf96e1 729 `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
a643aca6 730 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
5a20539c 731 $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188
GS
732!NO!SUBS!
733 ;;
e56d2c04 734 next4*)
5a20539c
VK
735 $spitshell >>$Makefile <<'!NO!SUBS!'
736miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
737 $(CC) -o miniperl$(EXE_EXT) `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
a643aca6 738 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
5a20539c 739 $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
535d2540
JH
740!NO!SUBS!
741 ;;
cb3fc426 742 darwin*)
986530ea
JH
743 case "$osvers" in
744 [1-6].*) ;;
745 *) case "$ldflags" in
746 *"-flat_namespace"*) ;;
747 *) # to allow opmini.o to override stuff in libperl.dylib
5a20539c 748 $spitshell >>$Makefile <<!NO!SUBS!
69625aa9
JH
749NAMESPACEFLAGS = -force_flat_namespace
750!NO!SUBS!
986530ea
JH
751 ;;
752 esac
753 ;;
cb3fc426 754 esac
5a20539c 755 $spitshell >>$Makefile <<'!NO!SUBS!'
908fcb8b 756miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
cb3fc426 757 -@rm -f miniperl.xok
5a20539c 758 $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o miniperl$(EXE_EXT) \
908fcb8b
GA
759 `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
760 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
5a20539c 761 $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
cb3fc426
JH
762!NO!SUBS!
763 ;;
ecfb2188 764 *)
5a20539c 765 $spitshell >>$Makefile <<'!NO!SUBS!'
908fcb8b 766miniperl$(EXE_EXT): $& miniperlmain$(OBJ_EXT) $(obj) opmini$(OBJ_EXT)
93c0359c 767 -@rm -f miniperl.xok
5a20539c 768 $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl$(EXE_EXT) \
908fcb8b
GA
769 `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
770 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
5a20539c 771 $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188
GS
772!NO!SUBS!
773 ;;
774 esac
775
5a20539c 776 $spitshell >>$Makefile <<'!NO!SUBS!'
599a829f 777
908fcb8b 778perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
93c0359c 779 -@rm -f miniperl.xok
908fcb8b 780 $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 781
4ae3d70a
JH
782# Purify/Quantify Perls.
783
908fcb8b
GA
784pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
785 $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 786
908fcb8b
GA
787purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
788 $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
dbadb36a 789
908fcb8b
GA
790quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
791 $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 792
7a834142
JH
793# Valgrind perl (currently Linux only)
794
795perl.valgrind.config: config.sh
796 @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..."
797 @$(MAKE) perl.config.dashg
798 @echo "Checking usemymalloc='n' in config.sh..."
799 @grep "^usemymalloc=" config.sh
800 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
801 @echo "And of course you have to have valgrind..."
4f9287d3 802 $(VALGRIND) ./perl -e 1 2>/dev/null || exit 1
7a834142 803
4ae3d70a
JH
804# Third Degree Perl (Tru64 only)
805
719561de 806perl.config.dashg:
83f0ef60 807 @echo "Checking optimize='-g' in config.sh..."
fdb8bc18
RGS
808 @grep "^optimize=" config.sh
809 @egrep "^optimize='(.*-g.*)'" config.sh >/dev/null || exit 1
4ae3d70a
JH
810
811perl.third.config: config.sh
812 @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
6e36760b 813 @$(MAKE) perl.config.dashg
83f0ef60
JH
814 @echo "Checking usemymalloc='n' in config.sh..."
815 @grep "^usemymalloc=" config.sh
816 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
170ba846 817
412c6516 818perl.third: /usr/bin/atom perl.third.config perl
dca31ef4 819 atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl
83f0ef60 820 @echo "Now you may run perl.third and then study perl.3log."
15615bfd 821
4ae3d70a
JH
822# Pixie Perls (Tru64 and IRIX only)
823
719561de 824perl.pixie.config: config.sh
4ae3d70a 825 @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
6e36760b 826 @$(MAKE) perl.config.dashg
4ae3d70a 827
719561de 828perl.pixie.atom: /usr/bin/atom perl
4ae3d70a
JH
829 atom -tool pixie -L. -all -toolargs="-quiet" perl
830
831perl.pixie.irix: perl
832 pixie perl
833
719561de 834perl.pixie: /usr/bin/pixie perl.pixie.config perl
4ae3d70a
JH
835 if test -x /usr/bin/atom; then \
836 $(MAKE) perl.pixie.atom; \
837 else \
838 $(MAKE) perl.pixie.irix; \
839 fi
83f0ef60
JH
840 @echo "Now you may run perl.pixie and then run pixie."
841
842# Gprof Perl
843
844perl.config.dashpg:
845 @echo "Checking optimize='-pg' in config.sh..."
846 @grep "^optimize=" config.sh
64778e5f 847 @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
83f0ef60
JH
848
849perl.gprof.config: config.sh
850 @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
851 @$(MAKE) perl.config.dashpg
852
853perl.gprof: /usr/bin/gprof perl.gprof.config
64778e5f 854 @-rm -f perl
51a35ef1 855 $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
83f0ef60 856 @echo "Now you may run perl.gprof and then run gprof perl.gprof."
4ae3d70a 857
51a35ef1
JH
858# Gcov Perl
859
860perl.config.gcov:
861 @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
862 @echo "Checking gccversion in config.sh..."
863 @grep "^gccversion=" config.sh
864 @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
865 @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
866 @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
867 @grep "^ccflags=" config.sh
868 @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
869
870perl.gcov: perl.config.gcov
871 @-rm -f perl
872 $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
873 @echo "Now you may run perl.gcov and then run gcov some.c."
874
f946bb38
JH
875# Microperl. This is just a convenience thing if one happens to
876# build also the full Perl and therefore the real big Makefile:
f4db5405 877# usually one should manually explicitly issue the below command.
f946bb38 878
869a466c 879.PHONY: microperl
f946bb38
JH
880microperl:
881 $(MAKE) -f Makefile.micro
882
2304df62
AD
883# This version, if specified in Configure, does ONLY those scripts which need
884# set-id emulation. Suidperl must be setuid root. It contains the "taint"
885# checks as well as the special code to validate that the script in question
886# has been invoked correctly.
887
908fcb8b
GA
888suidperl$(EXE_EXT): $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
889 $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 890
599a829f
IZ
891!NO!SUBS!
892
893fi
894
6d4b7d88
JH
895# Some environment have no system(), which mkpport uses.
896# Let's try running the commands with shell.
897case "${osname}" in
898catamount)
5a20539c 899$spitshell >>$Makefile <<!GROK!THIS!
6d4b7d88
JH
900.PHONY: makeppport
901makeppport: miniperl\$(EXE_EXT) \$(CONFIGPM)
902 -@for f in Makefile.PL PPPort_pm.PL PPPort_xs.PL ppport_h.PL; do \
903 (cd ext/Devel/PPPort && `pwd`/run.sh ../../../miniperl -I../../../lib \$\$f); \
904 done
905
906!GROK!THIS!
907;;
908*)
5a20539c 909$spitshell >>$Makefile <<'!NO!SUBS!'
6d4b7d88
JH
910.PHONY: makeppport
911makeppport: miniperl$(EXE_EXT) $(CONFIGPM)
912 $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib mkppport
913
914!NO!SUBS!
915;;
916esac
917
5a20539c 918$spitshell >>$Makefile <<'!NO!SUBS!'
599a829f 919
fec02dd3
AD
920# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
921# test -d lib/auto || mkdir lib/auto
5b7e50ea 922# We need to autosplit in two steps because VOS can't handle so many args
fec02dd3 923#
869a466c 924.PHONY: preplibrary
2d9d8159 925preplibrary: miniperl$(EXE_EXT) $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
cd4d8a96 926 @sh ./makedir lib/auto
a0d0e21e 927 @echo " AutoSplitting perl library"
05bc20f3
NC
928 $(LDLIBPTH) $(RUN) ./miniperl -Ilib -MAutoSplit -MFile::Find -e ' \
929 find ({no_chdir=>1, wanted => \
930 sub {autosplit_lib_modules($$_) if /\.pm$$/}}, \
931 "lib")'
abae58a6 932 $(MAKE) lib/re.pm
2304df62 933
5a20539c 934$(CONFIGPOD): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
cef6ea9d 935 $(LDLIBPTH) $(RUN) ./miniperl -Ilib configpm
2304df62 936
5a20539c 937$(CONFIGPM): $(CONFIGPOD)
82169296 938
2d9d8159 939lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl $(CONFIGPM)
cef6ea9d 940 $(LDLIBPTH) $(RUN) ./miniperl minimod.pl > lib/ExtUtils/Miniperl.pm
fed7345c 941
92c28edd 942lib/re.pm: ext/re/re.pm
960d5a3a 943 @-rm -f $@
2c38b89b 944 cp ext/re/re.pm lib/re.pm
7cfc0d09 945
2d9d8159 946$(plextract): miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p
42c30c63 947 @-rm -f $@
cef6ea9d 948 $(LDLIBPTH) $(RUN) ./miniperl -I`pwd`/lib $@.PL
72b3d9b4 949
2d9d8159 950x2p/s2p: miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p.PL
36cf9c44 951 cd x2p; $(LDLIBPTH) $(MAKE) s2p
180c42e0 952
2d9d8159 953lib/lib.pm: miniperl$(EXE_EXT) $(CONFIGPM)
42c30c63 954 @-rm -f $@
cef6ea9d 955 $(LDLIBPTH) $(RUN) ./miniperl -Ilib lib/lib_pm.PL
4755096e 956
6c684aee
JH
957unidatafiles $(unidatafiles): uni.data
958
959uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
cef6ea9d 960 cd lib/unicore && $(LDLIBPTH) $(RUN) ../../miniperl -I../../lib mktables -w
6c684aee 961 touch uni.data
5ad7e614 962
443a5b98 963extra.pods: miniperl$(EXE_EXT)
ebbebb7c 964 -@test ! -f extra.pods || rm -f `cat extra.pods`
72b3d9b4 965 -@rm -f extra.pods
b4bc034f 966 -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
72b3d9b4 967 nx=`echo $$x | sed -e "s/README\.//"`; \
40096396 968 cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
72b3d9b4
GS
969 echo "pod/perl"$$nx".pod" >> extra.pods ; \
970 done
a8476e91
JH
971 -@rm -f pod/perlvms.pod
972 -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
1400179b 973 -@rm -f pod/perldelta.pod
7120b314 974 -@test -f pod/perl5110delta.pod && cd pod && $(LNS) perl5110delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods # See buildtoc
ebbebb7c 975
443a5b98 976extras.make: perl$(EXE_EXT)
6d4b7d88 977 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) $(RUN) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
bf35c3f6 978
443a5b98 979extras.test: perl$(EXE_EXT)
6d4b7d88 980 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) $(RUN) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
bf35c3f6 981
443a5b98 982extras.install: perl$(EXE_EXT)
6d4b7d88 983 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) $(RUN) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
bf35c3f6 984
869a466c 985.PHONY: install install-strip install-all install-verbose install-silent \
5e2f386f 986 no-install install.perl install.man install.html
869a466c 987
0cf51544 988META.yml: Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
cef6ea9d 989 $(LDLIBPTH) $(RUN) ./miniperl -Ilib Porting/makemeta
0cf51544 990
f556e5b9 991install-strip:
70eaf669 992 $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
f556e5b9 993
adbebc0b 994install install-all:
70eaf669 995 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)"
c77385cf 996
4ad019ef 997install-verbose:
70eaf669 998 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)"
c458b76c 999
4ad019ef 1000install-silent:
70eaf669 1001 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)"
4ad019ef
A
1002
1003no-install:
70eaf669 1004 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
16d20bd9 1005
70eaf669
IZ
1006# Set this to an empty string to avoid an attempt of rebuild before install
1007INSTALL_DEPENDENCE = all
1008
1009install.perl: $(INSTALL_DEPENDENCE) installperl
6d4b7d88 1010 $(LDLIBPTH) $(RUN) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
3eb2897c 1011 -@test ! -s extras.lst || $(MAKE) extras.install
a0d0e21e 1012
b1a1e9f1 1013install.man: all installman
6d4b7d88 1014 $(LDLIBPTH) $(RUN) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
16d20bd9 1015
84902520
TB
1016# XXX Experimental. Hardwired values, but useful for testing.
1017# Eventually Configure could ask for some of these values.
1018install.html: all installhtml
40096396 1019 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
6d4b7d88 1020 $(LDLIBPTH) $(RUN) ./perl installhtml \
84902520 1021 --podroot=. --podpath=. --recurse \
47ec63d0
RGS
1022 --htmldir=$(privlib)/html \
1023 --htmlroot=$(privlib)/html \
84902520
TB
1024 --splithead=pod/perlipc \
1025 --splititem=pod/perlfunc \
1026 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
47ec63d0 1027 --ignore=Porting/Maintainers.pm,Porting/patching.pod,Porting/pumpkin.pod,Porting/repository.pod \
84902520
TB
1028 --verbose
1029
16d20bd9 1030
a0d0e21e 1031# I now supply perly.c with the kits, so the following section is
0de566d7
DM
1032# used only if you force bison to run by saying
1033# make regen_perly
1034# You normally shouldn't remake perly.[ch].
1035
1036.PHONY: regen_perly
1037
1038run_byacc:
1039 @echo "run_byacc is obsolete; try 'make regen_perly' instead"
1040
f05e27e5 1041# this outputs perly.h, perly.act and perly.tab
0de566d7
DM
1042regen_perly:
1043 perl regen_perly.pl
56febc5e
AD
1044
1045# We don't want to regenerate perly.c and perly.h, but they might
1046# appear out-of-date after a patch is applied or a new distribution is
1047# made.
92c28edd 1048perly.c: perly.y
b233458b
JH
1049 -@sh -c true
1050
92c28edd 1051perly.h: perly.y
b233458b
JH
1052 -@sh -c true
1053
bd656b61 1054# No compat3.sym here since and including the 5.004_50.
e4d5a464 1055# No interp.sym since 5.005_03.
22c35a8c 1056SYM = global.sym globvar.sym perlio.sym pp.sym
419eaf7b 1057
907b3e23 1058SYMH = perlvars.h intrpvar.h
419eaf7b 1059
dae78bb1
IZ
1060CHMOD_W = chmod +w
1061
a8581515 1062# The following files are generated automatically
9ad884cb 1063# autodoc.pl: pod/perlapi.pod pod/perlintern.pod
9ad884cb
JH
1064# embed.pl: proto.h embed.h embedvar.h global.sym
1065# perlapi.h perlapi.c
1066# [* embed.pl needs pp.sym generated by opcode.pl! *]
1067# keywords.pl: keywords.h
1068# opcode.pl: opcode.h opnames.h pp_proto.h pp.sym
c83f8f39
JH
1069# regcomp.pl: regnodes.h
1070# warnings.pl: warnings.h lib/warnings.pm
e50aee73
AD
1071# The correct versions should be already supplied with the perl kit,
1072# in case you don't have perl available.
36bb303b 1073# To force them to be regenerated, run
9ad884cb 1074# perl regen.pl
36bb303b
NC
1075# with your existing copy of perl
1076# (make regen_headers is kept for backwards compatibility)
e1354ed6 1077
b4d4469a
JH
1078AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
1079 embed.h embedvar.h global.sym \
1080 pod/perlintern.pod pod/perlapi.pod \
de125441 1081 perlapi.h perlapi.c regnodes.h \
c83f8f39 1082 warnings.h lib/warnings.pm
e1354ed6 1083
869a466c
JH
1084.PHONY: regen_headers regen_pods regen_all
1085
95aa0565 1086regen: FORCE
9ad884cb 1087 -perl regen.pl
8e07c86e 1088
95aa0565
RB
1089regen_headers: FORCE
1090 -perl regen.pl -v
1091
4755096e 1092regen_pods: FORCE
fcfe1ab7 1093 -cd pod; $(LDLIBPTH) $(MAKE) regen_pods
4755096e 1094
0de566d7 1095regen_all: regen regen_pods
9fec149b 1096
1aea71db
A
1097.PHONY: manisort manicheck
1098
1099manisort: FORCE
f3a5d88c
JH
1100 LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
1101 LC_ALL=C sort -fdo MANIFEST MANIFEST)
1aea71db
A
1102
1103manicheck: FORCE
1104 perl Porting/manicheck
1105
a0d0e21e 1106# Extensions:
4318d5a0
GB
1107# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
1108# automatically get built. There should ordinarily be no need to change
1109# any of this part of makefile.
a0d0e21e
LW
1110#
1111# The dummy dependency is a place holder in case $(dynamic_ext) or
1112# $(static_ext) is empty.
1113#
1114# DynaLoader may be needed for extensions that use Makefile.PL.
1115
443a5b98 1116$(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE
94c41b70 1117 @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 1118
42e07562 1119d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
92c28edd 1120 @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 1121
42e07562 1122s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
94c41b70 1123 @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
2304df62 1124
eedd3f99 1125n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary FORCE
92c28edd 1126 @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
9f3ef600
NC
1127!NO!SUBS!
1128
5a20539c 1129$spitshell >>$Makefile <<EOF
9f3ef600
NC
1130$extra_dep
1131EOF
1132
5a20539c 1133$spitshell >>$Makefile <<'!NO!SUBS!'
4318d5a0 1134
a774dfe6
RSG
1135.PHONY: printconfig
1136printconfig:
6d4b7d88 1137 @eval `$(LDLIBPTH) $(RUN) ./perl -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
a774dfe6 1138
869a466c
JH
1139.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
1140 realclean _realcleaner clobber _clobber \
687d3573
JB
1141 distclean veryclean _verycleaner \
1142 cleanup_unpacked_files unpack_files
869a466c 1143
687d3573 1144clean: cleanup_unpacked_files _tidy _mopup
70af249b 1145
687d3573 1146realclean: cleanup_unpacked_files _realcleaner _mopup
fcfe1ab7 1147 @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
70af249b 1148
b37ebb13 1149_clobber:
5440bc8e 1150 -@rm -f Cross/run-* Cross/to-* Cross/from-*
0279961e 1151 rm -f t/test_state
bf35c3f6 1152 rm -f config.sh cppstdin Policy.sh extras.lst
b37ebb13 1153
687d3573 1154clobber: cleanup_unpacked_files _realcleaner _mopup _clobber
70af249b
CS
1155
1156distclean: clobber
1157
2edbd6da 1158# Like distclean but also removes emacs backups and *.orig.
f6cadd99 1159veryclean: cleanup_unpacked_files _verycleaner _mopup _clobber
b37ebb13 1160 -@rm -f Obsolete Wanted
2edbd6da 1161
70af249b
CS
1162# Do not 'make _mopup' directly.
1163_mopup:
9444d213 1164 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c uudmap.h generate_uudmap$(EXE_EXT)
1ed50e5b 1165 -rmdir .depending
72b3d9b4 1166 -@test -f extra.pods && rm -f `cat extra.pods`
b4bc034f 1167 -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
6c684aee 1168 -rm -f perl.exp ext.libs extra.pods uni.data opmini.o
d96ebe2e 1169 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
1cfa4ec7 1170 -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
9d4d067b 1171 -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
6a966751 1172 -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
93c0359c 1173 -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
ce0286c6 1174 -rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
1ed50e5b
JH
1175 -rm -f perl$(EXE_EXT) suidperl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
1176 -rm -f opcode.h-old opnames.h-old pp.sym-old pp_proto.h-old
8b53a00d 1177 -rm -f config.arch config.over $(DTRACE_H)
70af249b
CS
1178
1179# Do not 'make _tidy' directly.
1180_tidy:
e3f83878
JH
1181 -cd pod; $(LDLIBPTH) $(MAKE) clean
1182 -cd utils; $(LDLIBPTH) $(MAKE) clean
1183 -cd x2p; $(LDLIBPTH) $(MAKE) clean
4318d5a0 1184 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
e3f83878 1185 $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
a0d0e21e 1186 done
ff68c719 1187
2edbd6da 1188_cleaner1:
4633a7c4 1189 -cd os2; rm -f Makefile
2edbd6da
JH
1190 -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
1191 -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
1192 -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
4318d5a0 1193 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
2edbd6da 1194 $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
a0d0e21e 1195 done
cef6ea9d 1196 -@test ! -f $(RUN) ./miniperl$(EXE_EXT) || $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib mkppport --clean
2edbd6da 1197
2ad994b6 1198# Some systems do not support "?", so keep these files separate.
2edbd6da 1199_cleaner2:
2ad994b6 1200 -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
5033177e 1201 rm -f core *perl.core t/core t/*perl.core core.* t/core.*
2ad994b6
PG
1202 rm -f t/misctmp* t/forktmp* t/tmp* t/c t/perl$(EXE_EXT) t/rantests
1203 rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
a0d0e21e 1204 rm -rf $(addedbyconf)
0eb4e931 1205 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
c27f7bb1 1206 rm -f $(private)
ca12659b 1207 rm -rf $(unidatafiles) $(unidatadirs)
a0d0e21e 1208 rm -rf lib/auto
07a6e20d 1209 rm -f lib/.exists lib/*/.exists lib/*/*/.exists
16d20bd9 1210 rm -f h2ph.man pstruct
a0d0e21e 1211 rm -rf .config
f6cadd99 1212 rm -f preload lib/re.pm
0f4f294e 1213 rm -rf lib/Encode lib/Compress lib/Hash lib/re
42182ddc 1214 rm -rf lib/IO/Compress lib/IO/Uncompress
fc2730c3
RGS
1215 rm -f lib/ExtUtils/ParseXS/t/XSTest.c
1216 rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT)
1217 rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX)
b6c155fe
JH
1218 rm -fr lib/B
1219 -rmdir lib/Data
af39be2f 1220 -rmdir lib/Filter/Util lib/IO/Socket
45812765 1221 -rmdir lib/List lib/MIME lib/Scalar lib/Sys
01f2eac4 1222 -rmdir lib/threads lib/XS
2d55c85b
JH
1223 -rmdir lib/CPANPLUS/Dist/Build/t/dummy-*
1224 -rmdir lib/CPANPLUS/t/dummy-cpanplus lib/CPANPLUS/t/dummy-localmirror
b0d7393a
JH
1225 -rm -f lib/ExtUtils/CBuilder/t/libcompilet.dll.a
1226 -rm -f lib/ExtUtils/ParseXS/t/libXSTest.dll.a
ecfc5424 1227
f4db5405 1228_realcleaner:
2edbd6da
JH
1229 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1230 @$(LDLIBPTH) $(MAKE) _cleaner2
1231
f4db5405 1232_verycleaner:
2edbd6da
JH
1233 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1234 @$(LDLIBPTH) $(MAKE) _cleaner2
c94787a5 1235 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
2edbd6da 1236
869a466c 1237.PHONY: lint
bf0dfd28 1238lint: $(c)
075abff3 1239 rm -f *.ln
66a1b24b 1240 lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
2304df62 1241
abcf5ada
AL
1242.PHONY: splint
1243splint: $(c)
1244 splint $(splintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(splintfiles)
1245
fb73857a 1246# Need to unset during recursion to go out of loop.
1247# The README below ensures that the dependency list is never empty and
1248# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 1249
84902520 1250MAKEDEPEND = Makefile makedepend
cd4d8a96 1251
fb73857a 1252$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 1253 $(MAKE) depend MAKEDEPEND=
a0d0e21e 1254
599a829f 1255config.h: config_h.SH config.sh
655635e8 1256 $(SHELL) config_h.SH
1257
a0d0e21e 1258# When done, touch perlmain.c so that it doesn't get remade each time.
869a466c 1259.PHONY: depend
2304df62 1260depend: makedepend
fb73857a 1261 sh ./makedepend MAKE=$(MAKE)
a0d0e21e 1262 - test -s perlmain.c && touch perlmain.c
2304df62
AD
1263 cd x2p; $(MAKE) depend
1264
cd4d8a96 1265# Cannot postpone this until $firstmakefile is ready ;-)
92c28edd
JH
1266makedepend: makedepend.SH config.sh
1267 sh ./makedepend.SH
cd4d8a96 1268
1167a30e 1269.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
869a466c 1270 test_tty test-tty _test_tty test_notty test-notty _test_notty \
e018f8be 1271 utest ucheck test.utf8 check.utf8 test.torture torturetest \
1de9afcd 1272 test.utf16 check.utf16 utest.utf16 ucheck.utf16 \
869a466c 1273 test.third check.third utest.third ucheck.third test_notty.third \
69bfbd2f 1274 test.deparse test_notty.deparse test_harness test_harness_notty \
4979e288 1275 minitest coretest test.taintwarn test-reonly
869a466c 1276
ec861bc1
JH
1277# Cannot delegate rebuilding of t/perl to make
1278# to allow interlaced test and minitest
3e3baf6d 1279
1167a30e
IZ
1280TESTFILE=TEST
1281
687d3573 1282_test_prep: unpack_files
ec861bc1 1283 cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
3e3baf6d 1284
1167a30e
IZ
1285# Architecture-neutral stuff:
1286
1287test_prep_pre: preplibrary utilities $(nonxs_ext)
1288
4caedec1 1289test_prep: test_prep_pre miniperl$(EXE_EXT) $(unidatafiles) perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
5fe84fd2 1290 PERL=./perl $(MAKE) _test_prep
ec861bc1 1291
5fe84fd2 1292_test_tty:
3d18daf1 1293 cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) $(TEST_FILES) </dev/tty
ec861bc1 1294
5fe84fd2 1295_test_notty:
3d18daf1 1296 cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) $(TEST_FILES)
ec861bc1 1297
687d3573 1298unpack_files:
cef6ea9d 1299 $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib uupacktool.pl -u -m
687d3573
JB
1300
1301cleanup_unpacked_files:
cef6ea9d 1302 -@test ! -f $(RUN) ./miniperl$(EXE_EXT) || $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib uupacktool.pl -c
687d3573 1303
ec861bc1
JH
1304# The second branch is for testing without a tty or controlling terminal,
1305# see t/op/stat.t
1306_test:
994e9bc0 1307 if (true </dev/tty) >/dev/null 2>&1; then \
4979e288 1308 $(MAKE) TEST_ARGS='$(TEST_ARGS)' TESTFILE=$(TESTFILE) _test_tty ; \
994e9bc0 1309 else \
4979e288 1310 $(MAKE) TEST_ARGS='$(TEST_ARGS)' TESTFILE=$(TESTFILE) _test_notty ; \
994e9bc0 1311 fi
3d8f1d64 1312 @echo "Ran tests" > t/rantests
a0ed51b3 1313
937aca76 1314test check: test_prep
ec861bc1
JH
1315 PERL=./perl $(MAKE) _test
1316
937aca76 1317test_tty: test_prep
5fe84fd2 1318 PERL=./perl $(MAKE) _test_tty
ec861bc1 1319
937aca76 1320test_notty: test_prep
5fe84fd2 1321 PERL=./perl $(MAKE) _test_notty
ec861bc1 1322
83f0ef60 1323utest ucheck test.utf8 check.utf8: test_prep
35117553 1324 PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1325
5a6e071d
PJ
1326coretest: test_prep
1327 PERL=./perl TEST_ARGS=-core $(MAKE) _test
1328
48a293f8 1329test-prep: test_prep
5fe84fd2
JH
1330
1331test-tty: test_tty
1332
1333test-notty: test_notty
1334
e018f8be
JH
1335# Torture testing
1336
1337test.torture torturetest: test_prep
1338 PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1339
1de9afcd
RGS
1340# Targets for UTF16 testing:
1341
1342minitest.utf16: minitest.prep
1343 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
8cebccf4 1344 && $(LDLIBPTH) $(RUN) ./perl TEST -minitest -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t mro/*.t </dev/tty
1de9afcd
RGS
1345
1346test.utf16 check.utf16: test_prep
1347 PERL=./perl $(MAKE) TEST_ARGS=-utf16 _test
1348
1349utest.utf16 ucheck.utf16: test_prep
1350 PERL=./perl $(MAKE) TEST_ARGS="-utf8 -utf16" _test
1351
7a834142
JH
1352# Targets for valgrind testing:
1353
1354test_prep.valgrind: test_prep perl.valgrind
1355 PERL=./perl $(MAKE) _test_prep
1356
1357test.valgrind check.valgrind: test_prep perl.valgrind.config
4f9287d3 1358 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(MAKE) _test
7a834142 1359
78f158d1 1360utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config
7a834142
JH
1361 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1362
78f158d1 1363test_notty.valgrind: test_prep.valgrind perl.valgrind.config
7a834142
JH
1364 PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1365
ec861bc1
JH
1366# Targets for Third Degree testing.
1367
9b99345a 1368test_prep.third: test_prep perl.third
5fe84fd2 1369 PERL=./perl.third $(MAKE) _test_prep
ec861bc1 1370
937aca76 1371test.third check.third: test_prep.third perl.third
ec861bc1
JH
1372 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1373
937aca76 1374utest.third ucheck.third: test_prep.third perl.third
35117553 1375 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1376
937aca76 1377test_notty.third: test_prep.third perl.third
5fe84fd2 1378 PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
2304df62 1379
35117553
JH
1380# Targets for Deparse testing.
1381
1382test.deparse: test_prep
1383 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1384
1385test_notty.deparse: test_prep
1386 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1387
b26492ee
RGS
1388# Targets to run the test suite with -t
1389
1390test.taintwarn: test_prep
1391 PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1392
1de9afcd 1393minitest.prep:
4fa3f26e 1394 -@test -f lib/lib.pm && test -f lib/Config.pm || \
5ad7e614 1395 $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
4fa3f26e 1396 @echo " "
d96ebe2e 1397 @echo "You may see some irrelevant test failures if you have been unable"
5ad7e614 1398 @echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
4fa3f26e 1399 @echo " "
1de9afcd
RGS
1400
1401# Can't depend on lib/Config.pm because that might be where miniperl
1402# is crashing.
1403minitest: miniperl$(EXE_EXT) lib/re.pm minitest.prep
cd4d8a96 1404 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
8cebccf4 1405 && $(LDLIBPTH) $(RUN) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t mro/*.t </dev/tty
16d20bd9 1406
1167a30e
IZ
1407# Test via harness
1408
1409test_harness: test_prep
1410 PERL=./perl $(MAKE) TESTFILE=harness _test
1411
69bfbd2f
RGS
1412test_harness_notty: test_prep
1413 PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1414
4979e288
YO
1415test-reonly: test_prep
1416 PERL=./perl TEST_ARGS='-re \\bpat\\b \\breg \\bre\b \\bsubst \\brxcode' $(MAKE) TESTFILE=harness _test
1417
fb73857a 1418# Handy way to run perlbug -ok without having to install and run the
84902520 1419# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 1420# Please *don't* use this unless all tests pass.
1d2dff63 1421# If you want to report test failures, use "make nok" instead.
869a466c
JH
1422
1423.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1424
188cd53f 1425ok: utilities
6d4b7d88 1426 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 1427
105f9295 1428okfile: utilities
6d4b7d88 1429 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 1430
890b8eb0 1431oknack: utilities
6d4b7d88 1432 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
890b8eb0
NC
1433
1434okfilenack: utilities
6d4b7d88 1435 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
890b8eb0 1436
1d2dff63 1437nok: utilities
6d4b7d88 1438 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 1439
b4e8cfaf 1440nokfile: utilities
6d4b7d88 1441 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
b4e8cfaf 1442
890b8eb0 1443noknack: utilities
6d4b7d88 1444 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
890b8eb0
NC
1445
1446nokfilenack: utilities
6d4b7d88 1447 $(LDLIBPTH) $(RUN) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
890b8eb0 1448
869a466c
JH
1449.PHONY: clist hlist shlist pllist
1450
85e6fe83 1451clist: $(c)
92c28edd 1452 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 1453
85e6fe83 1454hlist: $(h)
92c28edd 1455 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 1456
85e6fe83 1457shlist: $(sh)
92c28edd 1458 echo $(sh) | tr ' ' $(TRNL) >.shlist
2304df62 1459
4633a7c4 1460pllist: $(pl)
92c28edd 1461 echo $(pl) | tr ' ' $(TRNL) >.pllist
4633a7c4 1462
92c28edd
JH
1463Makefile: Makefile.SH ./config.sh
1464 $(SHELL) Makefile.SH
760ac839 1465
869a466c 1466.PHONY: distcheck
599a829f 1467distcheck: FORCE
760ac839
LW
1468 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1469
869a466c 1470.PHONY: elc
771c4874
IZ
1471elc: emacs/cperl-mode.elc
1472
1473emacs/cperl-mode.elc: emacs/cperl-mode.el
1474 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1475
869a466c
JH
1476.PHONY: etags ctags tags
1477
d6a255e6
IZ
1478etags: TAGS
1479
1480TAGS: emacs/cperl-mode.elc
3ee700d1 1481 sh emacs/ptags
01e22528 1482
d6a255e6
IZ
1483# Let's hope make will not go into an infinite loop on case-unsensitive systems
1484# This may also fail if . is in the head of the path, since perl will
1485# require -Ilib
1486tags: TAGS
1487 perl emacs/e2ctags.pl TAGS > tags
3ee700d1 1488
5c36f626 1489ctags:
abcf5ada 1490 ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c *.c *.h
5c36f626 1491
2304df62
AD
1492# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1493# If this runs make out of memory, delete /usr/include lines.
1494!NO!SUBS!
1495
85e6fe83 1496$eunicefix Makefile
2304df62
AD
1497case `pwd` in
1498*SH)
85e6fe83 1499 $rm -f ../Makefile
cd4d8a96 1500 $ln Makefile ../Makefile
2304df62
AD
1501 ;;
1502esac
cd4d8a96 1503$rm -f $firstmakefile
5ff3f7a4
GS
1504
1505# Now do any special processing required before building.
1506
1507case "$ebcdic" in
2d340b60 1508define)
5ff3f7a4 1509 xxx=''
2d340b60 1510 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
7a66b286 1511case "$osname" in
25e9a2e3 1512os390|posix-bc)
e9d08790 1513 if cd x2p
5ff3f7a4 1514 then
e9d08790 1515 rm -f y.tab.c y.tab.h
5928ee40
JH
1516 case "$osname" in
1517 posix-bc)
1518 # we are using two different yaccs in BS2000 Posix!
1519 byacc a2p.y >/dev/null 2>&1
1520 ;;
1521 *) # e.g. os390
1522 yacc a2p.y >/dev/null 2>&1
1523 ;;
1524 esac
e9d08790
JH
1525 if cmp -s y.tab.c a2p.c
1526 then
1527 rm -f y.tab.c
1528 else
1529 echo "a2p.y -> a2p.c" >&2
1530 mv -f y.tab.c a2p.c
1531 chmod u+w a2p.c
1532 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
f1f802f7 1533 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
e9d08790
JH
1534 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1535 xxx="$xxx a2p.c"
1536 fi
1537 # In case somebody yacc -d:ed the a2p.y.
1538 if test -f y.tab.h
1539 then
1540 if cmp -s y.tab.h a2p.h
1541 then
1542 rm -f y.tab.h
1543 else
1544 echo "a2p.h -> a2p.h" >&2
1545 mv -f y.tab.h a2p.h
1546 xxx="$xxx a2p.h"
1547 fi
1548 fi
1549 cd ..
5ff3f7a4 1550 fi
7a66b286
JH
1551 ;;
1552vmesa)
1553 # Do nothing in VM/ESA.
1554 ;;
aa34f189 1555*)
e9d08790 1556 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 1557 ;;
fe572743 1558esac
5ff3f7a4
GS
1559 case "$xxx" in
1560 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1561 esac
1562 ;;
1563esac
1564
075abff3 1565# ex: set ts=8 sts=4 sw=4 noet: