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