This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: comment %n deficiency
[perl5.git] / Makefile.SH
CommitLineData
1f00b0d6
S
1#!/bin/sh
2
937aac54 3# quote() - Creates a shell literal
6bc4329f 4# Usage: echo "...` quote "..." `..."
937aac54
EB
5quote() {
6 case "$1" in
7 '') echo "''" ;;
87d98376 8 *) echo "$1" | sed 's/\([^a-zA-Z0-9.:_/-]\)/\\\1/g' ;;
937aac54
EB
9 esac
10}
11
a02608de 12case $PERL_CONFIG_SH in
2304df62 13'')
66b99216
JH
14 if test -f config.sh
15 then TOP=.
2304df62
AD
16 else
17 echo "Can't find config.sh."; exit 1
18 fi
19 . $TOP/config.sh
20 ;;
21esac
761ee4e8 22
1247ba6e
AB
23case "$osname" in
24amigaos)
25 devtty=CONSOLE:
26 ;;
27*)
28 devtty=/dev/tty
29 ;;
30esac
31
3c32af27 32Makefile=Makefile
5a20539c 33
2304df62
AD
34: This forces SH files to create target in same directory as SH file.
35: This is so that make depend always knows where to find SH derivatives.
36case "$0" in
37*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
38esac
39
6bc4329f 40pwd="`pwd`"
d5d19f97 41linklibperl='$(LIBPERL)'
fe5460cc 42linklibperl_nonshr=''
3c321fdc 43shrpldflags='$(LDDLFLAGS)'
6ee623d5 44ldlibpth=''
ac9901e0 45DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
bf799c64 46DPERL_IS_MINIPERL='-DPERL_IS_MINIPERL'
d96ebe2e 47case "$useshrplib" in
48true)
f4db5405 49 # Prefix all runs of 'miniperl' and 'perl' with
5cf1d1f1 50 # $ldlibpth so that ./perl finds *this* shared libperl.
c1b49bc0 51 case "$LD_LIBRARY_PATH" in
6bc4329f
EB
52 '') ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `" ;;
53 *) ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `:` quote "$LD_LIBRARY_PATH" `" ;;
c1b49bc0 54 esac
6ee623d5 55
d5d19f97 56 pldlflags="$cccdlflags"
07f3cc2a 57 static_ldflags=''
d96ebe2e 58 case "${osname}${osvers}" in
59 next4*)
3c321fdc 60 ld=libtool
61 lddlflags="-dynamic -undefined warning -framework System \
62 -compatibility_version 1 -current_version $patchlevel \
63 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
6ee623d5 64 ;;
7eb35c03 65 darwin*)
f556e5b9 66 shrpldflags="${ldflags} -dynamiclib \
c1e7a127
W
67 -compatibility_version \
68 ${api_revision}.${api_version}.${api_subversion} \
f556e5b9 69 -current_version \
c1e7a127 70 ${revision}.${patchlevel}.${subversion} \
f556e5b9
JH
71 -install_name \$(shrpdir)/\$@"
72 ;;
5cf1d1f1 73 cygwin*)
5f9145a3
RU
74 shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a -Wl,--image-base,0x52000000"
75 linklibperl="-L. -lperl"
8736538c 76 ;;
73d40b3e 77 sunos*)
d5d19f97
UP
78 linklibperl="-lperl"
79 ;;
a0a23c6b 80 netbsd*|freebsd[234]*|openbsd*|dragonfly*|bitrig*)
099685bc
JH
81 linklibperl="-L. -lperl"
82 ;;
0c52c6a9
TV
83 interix*)
84 linklibperl="-L. -lperl"
85 shrpldflags="$shrpldflags -Wl,--image-base,0x57000000"
86 ;;
3c321fdc 87 aix*)
21efc957
RT
88 case "$cc" in
89 gcc*)
90 shrpldflags="-shared -Wl,-H512 -Wl,-T512 -Wl,-bhalt:4 -Wl,-bM:SRE -Wl,-bE:perl.exp"
91 case "$osvers" in
92 3*) shrpldflags="$shrpldflags -e _nostart"
93 ;;
94 *) shrpldflags="$shrpldflags -Wl,-bnoentry"
95 ;;
96 esac
97 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
98 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
fe5460cc 99 linklibperl_nonshr='-lperl_nonshr'
1553ab04 100 ;;
21efc957
RT
101 *)
102 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
103 case "$osvers" in
104 3*) shrpldflags="$shrpldflags -e _nostart"
105 ;;
106 *) shrpldflags="$shrpldflags -b noentry"
107 ;;
108 esac
109 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
110 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
fe5460cc 111 linklibperl_nonshr='-lperl_nonshr'
1553ab04
TB
112 ;;
113 esac
3c321fdc 114 ;;
1c7d1a19
GS
115 hpux*)
116 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
46193409 117 ;;
ac9901e0 118 os390*)
4144573e 119 shrpldflags='-W l,XPLINK,dll'
ac9901e0
PP
120 linklibperl='libperl.x'
121 DPERL_EXTERNAL_GLOB=''
122 ;;
655635e8 123 esac
5cf1d1f1
JH
124 case "$ldlibpthname" in
125 '') ;;
126 *)
127 case "$osname" in
128 os2)
129 ldlibpth=''
130 ;;
5cf1d1f1 131 *)
937aac54
EB
132 eval "ldlibpthval=\"\$$ldlibpthname\""
133
134 case "$ldlibpthval" in
6bc4329f
EB
135 '') ldlibpth="$ldlibpthname=` quote "$pwd" `" ;;
136 *) ldlibpth="$ldlibpthname=` quote "$pwd" `:` quote "$ldlibpthval" `" ;;
937aac54
EB
137 esac
138
5cf1d1f1
JH
139 ;;
140 esac
937aac54 141
5cf1d1f1
JH
142 ;;
143 esac
ecfc5424 144
9b9c6f34
AE
145 case "$osname" in
146 linux)
830717a7
AD
147 # If there is a pre-existing $libperl from a previous
148 # installation, Linux needs to use LD_PRELOAD to
149 # override the LD_LIBRARY_PATH setting. See the
150 # INSTALL file, under "Building a shared perl library".
151 # If there is no pre-existing $libperl, we don't need
152 # to do anything further.
153 if test -f $archlib/CORE/$libperl; then
68e8d60a 154 rm -f preload
d0ae58a5 155 cat <<'EOT' > preload
fde91635
JH
156#! /bin/sh
157lib=$1
158shift
159test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
160exec "$@"
161EOT
9b9c6f34
AE
162 chmod 755 preload
163 ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
830717a7
AD
164 fi
165 ;;
9b9c6f34
AE
166 os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
167 ;;
60d79001 168 esac
9b9c6f34 169
60d79001 170 ;;
9b9c6f34
AE
171
172*) pldlflags=''
07f3cc2a 173 static_ldflags='CCCDLFLAGS='
b1f5ad7d
JH
174 ;;
175esac
176
de4c0096
TC
177: is Cwd static or dynamic
178static_cwd='define'
04718b47 179list_util_dep='$(PERL_EXE)'
de4c0096
TC
180for f in $dynamic_ext; do
181 case $f in
182 Cwd) static_cwd='undef' ;;
04718b47 183 List/Util) list_util_dep=lib/auto/List/Util/Util.$dlext
de4c0096
TC
184 esac
185done
186
a0d0e21e
LW
187: Prepare dependency lists for Makefile.
188dynamic_list=' '
ec81ed5d 189dynamic_ext_re="lib/auto/re/re.$dlext"
1179df5f 190extra_dep='
635c6126 191ext/Pod-Functions/pm_to_blib: cpan/Pod-Simple/pm_to_blib cpan/Pod-Escapes/pm_to_blib pod/perlfunc.pod
dd3e0aed 192cpan/IO-Compress/pm_to_blib: dist/lib/pm_to_blib
1179df5f 193'
a0d0e21e
LW
194for f in $dynamic_ext; do
195 : the dependency named here will never exist
ecfc5424 196 base=`echo "$f" | sed 's/.*\///'`
dd3e0aed 197 this_target="lib/auto/$f/$base.$dlext"
9f3ef600
NC
198 dynamic_list="$dynamic_list $this_target"
199
200 : Parallel makes reveal that we have some interdependencies
201 case $f in
90e91dd8 202 Math/BigInt/FastCalc|Devel/NYTProf) extra_dep="$extra_dep
04718b47 203$this_target: $list_util_dep" ;;
9f3ef600
NC
204 Unicode/Normalize) extra_dep="$extra_dep
205$this_target: uni.data" ;;
206 esac
a0d0e21e
LW
207done
208
209static_list=' '
a0d0e21e
LW
210for f in $static_ext; do
211 base=`echo "$f" | sed 's/.*\///'`
cd4d8a96 212 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
54f7170d
AD
213 : Parallel makes reveal that we have some interdependencies
214 this_target="lib/auto/$f/$base\$(LIB_EXT)"
215 case $f in
216 Math/BigInt/FastCalc|Devel/NYTProf) extra_dep="$extra_dep
217$this_target: lib/auto/List/Util/Util\$(LIB_EXT)" ;;
218 Unicode/Normalize) extra_dep="$extra_dep
219$this_target: uni.data" ;;
220 esac
a0d0e21e
LW
221done
222
4318d5a0
GB
223nonxs_list=' '
224for f in $nonxs_ext; do
6c0ec79a 225 p=`echo "$f" | tr / -`
a193a2db 226 for d in ext dist cpan; do
321c3589
NC
227 if test -d $d/$p; then
228 nonxs_list="$nonxs_list $d/$p/pm_to_blib"
229 fi
230 done
4318d5a0
GB
231done
232
5ac1e9b2 233dtrace_h=''
efc4bddf
DM
234
235# three object files generated by 'dtrace -G' when dtrace is enabled
236dtrace_perllib_o=''
237dtrace_mini_o=''
238dtrace_main_o=''
239
5ac1e9b2
AA
240case "$usedtrace" in
241define|true)
c2538af7
TC
242 dtrace_h='perldtrace.h'
243 case "$dtraceobject" in
244 define)
efc4bddf
DM
245 dtrace_perllib_o='dtrace_perllib$(OBJ_EXT)'
246 dtrace_mini_o='dtrace_mini$(OBJ_EXT)'
247 dtrace_main_o='dtrace_main$(OBJ_EXT)'
c2538af7
TC
248 ;;
249 esac
5ac1e9b2
AA
250 ;;
251esac
252
5a20539c
VK
253echo "Extracting $Makefile (with variable substitutions)"
254$spitshell >$Makefile <<!GROK!THIS!
255# $Makefile
85e6fe83
LW
256# This file is derived from Makefile.SH. Any changes made here will
257# be lost the next time you run Configure.
655635e8 258# Makefile is used to generate $firstmakefile. The only difference
259# is that $firstmakefile has the dependencies filled in at the end.
0de566d7 260
2304df62 261CC = $cc
232e078e 262LD = $ld
16d20bd9 263
2304df62
AD
264LDFLAGS = $ldflags
265CLDFLAGS = $ldflags
85e6fe83 266
2304df62
AD
267mallocsrc = $mallocsrc
268mallocobj = $mallocobj
85e6fe83 269LNS = $lns
4c901d04
JH
270# NOTE: some systems don't grok "cp -f". XXX Configure test needed?
271CPS = $cp
2304df62 272RMS = rm -f
85e6fe83
LW
273ranlib = $ranlib
274
16d20bd9
AD
275# The following are mentioned only to make metaconfig include the
276# appropriate questions in Configure. If you want to change these,
8e07c86e 277# edit config.sh instead, or specify --man1dir=/wherever on
16d20bd9
AD
278# installman commandline.
279bin = $installbin
280scriptdir = $scriptdir
d96ebe2e 281shrpdir = $archlibexp/CORE
16d20bd9
AD
282privlib = $installprivlib
283man1dir = $man1dir
284man1ext = $man1ext
285man3dir = $man3dir
286man3ext = $man3ext
287
85e6fe83
LW
288# The following are used to build and install shared libraries for
289# dynamic loading.
290LDDLFLAGS = $lddlflags
3c321fdc 291SHRPLDFLAGS = $shrpldflags
85e6fe83 292CCDLFLAGS = $ccdlflags
a0d0e21e 293DLSUFFIX = .$dlext
ecfc5424 294PLDLFLAGS = $pldlflags
d96ebe2e 295LIBPERL = $libperl
d5d19f97 296LLIBPERL= $linklibperl
fe5460cc 297LLIBPERL_NONSHR= $linklibperl_nonshr
ecfc5424 298SHRPENV = $shrpenv
a0d0e21e 299
94c41b70
AD
300# Static targets are ordinarily built without CCCDLFLAGS. However,
301# if building a shared libperl.so that might later be linked into
302# another application, then it might be appropriate to also build static
303# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
07f3cc2a
NC
304# for GNU cc).
305STATIC_LDFLAGS = $static_ldflags
94c41b70 306
6ee623d5 307# The following is used to include the current directory in
5cf1d1f1 308# the dynamic loader path you are building a shared libperl.
6ee623d5
GS
309LDLIBPTH = $ldlibpth
310
cef6ea9d 311# Sometimes running an executable is an adventure.
6aafa456 312RUN =
cef6ea9d 313
b98f6b80
JR
314# When cross-compiling we want to use a (mini)perl built for the host, not the target
315HOST_PERL = $hostperl
316HOST_GENERATE = $hostgenerate
9094a4e8 317SYSTEM_PERL = $perl
b98f6b80 318
5a20539c
VK
319# These variables may need to be manually set for non-Unix systems.
320AR = $full_ar
cf9c4992 321HOST_EXE_EXT = $_exe
5a20539c
VK
322EXE_EXT = $_exe
323LIB_EXT = $_a
324OBJ_EXT = $_o
325PATH_SEP = $p_
326
199863e7
NC
327# Macros to invoke a copy of miniperl during the build. Targets which
328# are built using these macros should depend on \$(MINIPERL_EXE)
329MINIPERL_EXE = miniperl\$(EXE_EXT)
6aafa456 330MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib
199863e7 331
19bf1007
YO
332# Macros to invoke sort the MANIFEST during build
333MANIFEST_SRT = MANIFEST.srt
334
9094a4e8
JR
335!GROK!THIS!
336
337case "$usecrosscompile$perl" in
338define?*)
339 $spitshell >>$Makefile <<!GROK!THIS!
34b80e25
JV
340# Macros to invoke a copy of our fully operational perl during the build.
341PERL_EXE = perl\$(EXE_EXT)
9094a4e8
JR
342RUN_PERL = \$(LDLIBPTH) \$(RUN) $perl\$(EXE_EXT)
343!GROK!THIS!
344 ;;
345*)
346 $spitshell >>$Makefile <<!GROK!THIS!
347# Macros to invoke a copy of our fully operational perl during the build.
348PERL_EXE = perl\$(EXE_EXT)
3d7c117d 349RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) -Ilib -I.
9094a4e8
JR
350!GROK!THIS!
351 ;;
352esac
34b80e25 353
9094a4e8 354$spitshell >>$Makefile <<!GROK!THIS!
5fb77da4
JV
355# Macros to run our tests
356RUN_TESTS = \$(LDLIBPTH) ./runtests
34b80e25 357
a0d0e21e 358dynamic_ext = $dynamic_list
ec81ed5d 359dynamic_ext_re = $dynamic_ext_re
a0d0e21e 360static_ext = $static_list
4318d5a0
GB
361nonxs_ext = $nonxs_list
362ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
908fcb8b 363DYNALOADER = DynaLoader\$(OBJ_EXT)
2304df62 364
9c839522 365libs = $perllibs $cryptlib
2304df62 366
c35c732c 367public = \$(PERL_EXE) utilities
2304df62
AD
368
369shellflags = $shellflags
370
1247ba6e
AB
371# The /dev/tty or the moral equivalent.
372devtty = $devtty
373
d96ebe2e 374# This is set to MAKE=$make if your $make command doesn't
375# do it for you.
376$make_set_make
4633a7c4 377
1fef16b3
JH
378# Mention $gmake here so it gets probed for by Configure.
379
cfe76a0a
JC
380!GROK!THIS!
381
382case "${osname}" in
09617314 383linux*|darwin)
cfe76a0a 384$spitshell >>$Makefile <<!GROK!THIS!
4f9287d3
NC
385# If you're going to use valgrind and it can't be invoked as plain valgrind
386# then you'll need to change this, or override it on the make command line.
c7b956bb
JC
387VALGRIND ?= valgrind
388VG_TEST ?= ./perl -e 1 2>/dev/null
4f9287d3 389
cfe76a0a
JC
390!GROK!THIS!
391 ;;
392esac
393
f2a60c1f
TC
394case "$dtracexnolibs" in
395define) xnolibs=-xnolibs ;;
396*) xnolibs= ;;
397esac
398
cfe76a0a 399$spitshell >>$Makefile <<!GROK!THIS!
f2a60c1f 400DTRACE = $dtrace $xnolibs
5ac1e9b2 401DTRACE_H = $dtrace_h
efc4bddf
DM
402
403DTRACE_PERLLIB_O = $dtrace_perllib_o # "dtrace -G" output for perllib_objs
404DTRACE_MINI_O = $dtrace_mini_o # "dtrace -G" output for common and mini
405DTRACE_MAIN_O = $dtrace_main_o # "dtrace -G" output for perlmain.o
5ac1e9b2 406
4633a7c4
LW
407FIRSTMAKEFILE = $firstmakefile
408
409# Any special object files needed by this architecture, e.g. os2/os2.obj
410ARCHOBJS = $archobjs
411
89ada9f2 412.SUFFIXES: .c \$(OBJ_EXT) .i .s
cd4d8a96 413
d96ebe2e 414# grrr
415SHELL = $sh
655635e8 416
28e8609d
JH
417# how to tr(anslate) newlines
418TRNL = '$trnl'
419
82240bfc
JH
420OPTIMIZE = $optimize
421
3343e82c
JH
422EXTRAS = $extras
423
bf35c3f6
JH
424INSTALLPREFIXEXP = $prefix
425
d56c5707 426!GROK!THIS!
b7b35fc2 427# not used by Makefile but by installperl;
d56c5707
JH
428# mentioned here so that metaconfig picks these up
429# $installusrbinperl
430# $versiononly
b7b35fc2 431
8170cb12
JH
432case "${osname}:${osvers}" in
433darwin:*)
5a20539c 434$spitshell >>$Makefile <<EOF
8170cb12
JH
435
436# Your locales are broken (osname $osname, osvers $osvers)
437# and to avoid the numerous
438# perl: warning: Setting locale failed.
439# warnings during the build process we reset the locale variables.
440
441LC_ALL=C
442LANG=C
443LANGUAGE=C
444EOF
445 ;;
446esac
2304df62 447
85e6fe83 448## In the following dollars and backticks do not need the extra backslash.
5a20539c 449$spitshell >>$Makefile <<'!NO!SUBS!'
2304df62 450
ba0f5503 451CCCMD = sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@
89ada9f2 452
ba0f5503 453CCCMDSRC = sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<
2304df62 454
744ac0ea
NC
455CONFIGPM_FROM_CONFIG_SH = lib/Config.pm lib/Config_heavy.pl
456CONFIGPM = $(CONFIGPM_FROM_CONFIG_SH) lib/Config_git.pl
5a20539c
VK
457
458CONFIGPOD = lib/Config.pod
459
460CONFIGH = config.h
461!NO!SUBS!
5a20539c 462
9719c95b
NC
463SH_to_target() {
464 echo $@ | sed -e s/\\\.SH//g -e s/_/./g
465}
0ff64a71 466
e5a8a0fb 467SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
9719c95b 468shextract=`SH_to_target $SH`
0ff64a71 469
5a20539c 470## In the following dollars and backticks do not need the extra backslash.
0ff64a71 471$spitshell >>$Makefile <<!GROK!THIS!
5a20539c 472
7b4d95f7 473private = preplibrary \$(CONFIGPM) \$(CONFIGPOD) git_version.h lib/buildcustomize.pl
2304df62 474
4633a7c4
LW
475# Files to be built with variable substitution before miniperl
476# is available.
0ff64a71 477sh = $SH
4633a7c4 478
0ff64a71
NC
479shextract = $shextract
480!GROK!THIS!
481
482## In the following dollars and backticks do not need the extra backslash.
483$spitshell >>$Makefile <<'!NO!SUBS!'
4633a7c4 484
2560602c 485addedbyconf = UU $(shextract)
2304df62 486
5ad7e614 487# Unicode data files generated by mktables
3df51b85
KW
488unidatafiles = lib/unicore/Decomposition.pl lib/unicore/TestProp.pl \
489 lib/unicore/CombiningClass.pl lib/unicore/Name.pl \
1a234f2b 490 lib/unicore/UCD.pl lib/unicore/Name.pm \
3e344d15 491 lib/unicore/Heavy.pl lib/unicore/mktables.lst
5ad7e614
NC
492
493# Directories of Unicode data files generated by mktables
494unidatadirs = lib/unicore/To lib/unicore/lib
495
5a20539c 496h1 = EXTERN.h INTERN.h XSUB.h av.h $(CONFIGH) cop.h cv.h dosish.h
4d3a042d 497h2 = embed.h form.h gv.h handy.h hv.h hv_func.h keywords.h mg.h op.h opcode.h
dd2155a4 498h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
219f41b1 499h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
7bbf947b 500h5 = utf8.h warnings.h mydtrace.h op_reg_common.h l1_char_class_tab.h
9d9177be
KW
501h6 = charclass_invlists.h
502h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6)
2304df62 503
8b371338 504c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro_core.c perl.c
00e74f14 505c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c
26ea9e12 506c3 = taint.c toke.c util.c deb.c run.c universal.c pad.c globals.c keywords.c
f832b29a 507c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c dquote.c time64.c
b5bbe64a 508c5 = $(mallocsrc)
2304df62 509
a812f6a9 510c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c opmini.c perlmini.c
2304df62 511
8b371338 512obj1 = $(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_core$(OBJ_EXT) keywords$(OBJ_EXT)
bf799c64 513obj2 = 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)
f832b29a 514obj3 = 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) caretx$(OBJ_EXT) dquote$(OBJ_EXT) time64$(OBJ_EXT)
655635e8 515
98d35ab7
DM
516# split the objects into 3 exclusive sets: those used by both miniperl and
517# perl, and those used by just one or the other. Doesn't include the
518# actual perl(mini)main.o, nor any dtrace objects.
519
520common_objs = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
521mini_only_objs = opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
522main_only_objs = op$(OBJ_EXT) perl$(OBJ_EXT)
523
524miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
efc4bddf 525perllib_objs_nodt = $(main_only_objs) $(common_objs)
98d35ab7 526
728ecd1a
TC
527!NO!SUBS!
528
529# dtrace with -G modifies the source object files, which can cause
530# dependency issues, and can cause the dtrace -G to fail on FreeBSD
531# so separate the objects generated by $(CC) from those used to link
532# the executable when dtrace -G is involved.
533#
534# $(FOO:op%os=np%ns) isn't generally portable but is portable to
535# the makes on darwin, Solaris, FreeBSD and Linux, which is where we
536# use dtrace
537
538case "$usedtrace:$dtraceobject" in
539define:define)
540 $spitshell >>$Makefile <<'!NO!SUBS!'
541
542miniperl_dtrace_objs = $(miniperl_objs_nodt:%=mpdtrace/%)
543perllib_dtrace_objs = $(perllib_objs_nodt:%=libpdtrace/%)
544perlmain_dtrace_objs = maindtrace/perlmain$(OBJ_EXT)
545
546miniperl_objs = $(miniperl_dtrace_objs) $(DTRACE_MINI_O)
547perllib_objs = $(perllib_dtrace_objs) $(DTRACE_PERLLIB_O)
548perlmain_objs = $(perlmain_dtrace_objs) $(DTRACE_MAIN_O)
549
550miniperl_dep = $(DTRACE_MINI_O)
551perllib_dep = $(DTRACE_PERLLIB_O)
552perlmain_dep = $(DTRACE_MAIN_O)
553
554!NO!SUBS!
555 ;;
556*)
557 $spitshell >>$Makefile <<'!NO!SUBS!'
558
efc4bddf
DM
559miniperl_objs = $(miniperl_objs_nodt) $(DTRACE_MINI_O)
560perllib_objs = $(perllib_objs_nodt) $(DTRACE_PERLLIB_O)
561perlmain_objs = perlmain$(OBJ_EXT) $(DTRACE_MAIN_O)
2304df62 562
728ecd1a
TC
563miniperl_dep = $(miniperl_objs)
564perllib_dep = $(perllib_objs)
565perlmain_dep = $(perlmain_objs)
566
567!NO!SUBS!
568 ;;
569esac
570
571$spitshell >>$Makefile <<'!NO!SUBS!'
572
1b510166 573perltoc_pod_prereqs = extra.pods pod/perl5271delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
7eb47696 574generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs)
9387abf8 575generated_headers = uudmap.h bitcount.h mg_data.h
344af494 576
075abff3 577lintflags = \
5f66b61c
AL
578 -b \
579 -n \
075abff3 580 -p \
075abff3
AL
581 -Ncheck=%all \
582 -Nlevel=4 \
bb263b4e
AL
583 -errchk=parentheses \
584 -errhdr=%all \
66a1b24b 585 -errfmt=src \
075abff3 586 -errtags \
5f66b61c 587 -erroff=E_ASSIGN_NARROW_CONV \
075abff3 588 -erroff=E_BAD_PTR_CAST \
5f66b61c
AL
589 -erroff=E_BAD_PTR_CAST_ALIGN \
590 -erroff=E_BAD_PTR_INT_COMBINATION \
591 -erroff=E_BAD_SIGN_EXTEND \
075abff3 592 -erroff=E_BLOCK_DECL_UNUSED \
5f66b61c 593 -erroff=E_CASE_FALLTHRU \
abcf5ada 594 -erroff=E_CONST_EXPR \
075abff3 595 -erroff=E_CONSTANT_CONDITION \
abcf5ada 596 -erroff=E_END_OF_LOOP_CODE_NOT_REACHED \
5f66b61c 597 -erroff=E_EQUALITY_NOT_ASSIGNMENT \
075abff3 598 -erroff=E_EXPR_NULL_EFFECT \
66a1b24b 599 -erroff=E_FALSE_LOGICAL_EXPR \
66a1b24b 600 -erroff=E_INCL_NUSD \
5f66b61c 601 -erroff=E_LOOP_EMPTY \
66a1b24b 602 -erroff=E_MAIN_PARAM \
5f66b61c
AL
603 -erroff=E_POINTER_TO_OBJECT \
604 -erroff=E_PTRDIFF_OVERFLOW \
605 -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L \
606 -erroff=E_STATIC_UNUSED \
05c462c4 607 -erroff=E_TRUE_LOGICAL_EXPR
2304df62 608
e21c97b9 609.c$(OBJ_EXT):
ba0f5503
DM
610 @echo `$(CCCMD)` $(PLDLFLAGS) $*.c
611 @`$(CCCMD)` $(PLDLFLAGS) $*.c
2304df62 612
29b9baac 613.c.i: perl.h config.h
ba0f5503
DM
614 @echo `$(CCCMDSRC)` -E $*.c \> $*.i
615 @`$(CCCMDSRC)` -E $*.c > $*.i
89ada9f2 616
29b9baac 617.c.s: perl.h config.h
ba0f5503
DM
618 @echo `$(CCCMDSRC)` -S $*.c
619 @`$(CCCMDSRC)` -S $*.c
89ada9f2 620
19bf1007 621all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT)
51356d76
NC
622 @echo " ";
623 @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
624
0e9f069a
MA
625$(MANIFEST_SRT): MANIFEST $(PERL_EXE)
626 @$(RUN_PERL) Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \
627 $(RUN_PERL) Porting/manisort -q -o MANIFEST; sh -c true)
19bf1007
YO
628 @touch $(MANIFEST_SRT)
629
c35c732c 630.PHONY: all utilities
8565263a 631
2b63e250
AD
632# Both git_version.h and lib/Config_git.pl are built
633# by make_patchnum.pl.
634git_version.h: lib/Config_git.pl
635
636lib/Config_git.pl: $(MINIPERL_EXE) make_patchnum.pl
199863e7 637 $(MINIPERL) make_patchnum.pl
dcff826f
YO
638
639# make sure that we recompile perl.c if the git version changes
640perl$(OBJ_EXT): git_version.h
6ee623d5 641
d1309555
NC
642!NO!SUBS!
643
c35c732c 644# Making utilities requires Cwd. If we have dynamic
939767c9
AD
645# loading, we only need miniperl and Cwd.$dlext. If we have static
646# loading, we need to build perl first.
de4c0096
TC
647case "$usedl$static_cwd" in
648defineundef)
939767c9 649 util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE'
939767c9 650 ;;
de4c0096
TC
651definedefine)
652 util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
de4c0096 653 ;;
939767c9 654*) util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
939767c9
AD
655 ;;
656esac
657
d1309555 658$spitshell >>$Makefile <<!GROK!THIS!
145bbcac 659utils/Makefile: \$(MINIPERL_EXE) \$(CONFIGPM) utils/Makefile.PL
69b63ee4 660 \$(MINIPERL) utils/Makefile.PL
145bbcac
NC
661
662utilities: utils/Makefile $util_deps
d1309555 663 @echo " "; echo " Making utilities"; cd utils; \$(LDLIBPTH) \$(MAKE) all
909b3858 664
d1309555 665!GROK!THIS!
939767c9 666
d1309555 667$spitshell >>$Makefile <<'!NO!SUBS!'
909b3858 668
16d20bd9
AD
669# This is now done by installman only if you actually want the man pages.
670# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83
LW
671
672# Phony target to force checking subdirectories.
e50aee73 673# Apparently some makes require an action for the FORCE target.
869a466c 674.PHONY: FORCE
85e6fe83 675FORCE:
4633a7c4 676 @sh -c true
aa9e9805 677!NO!SUBS!
4ba7095c 678
aa9e9805 679for file in op perl; do
6cdadb5a
NC
680 if $issymlink $file.c; then
681 $spitshell >>$Makefile <<!GROK!THIS!
682
683# We do a copy of the $file.c instead of a symlink because gcc gets huffy
684# if we have a symlink forest to another disk (it complains about too many
685# levels of symbolic links, even if we have only two)
c015c5e4 686
aa9e9805
NC
687${file}mini.c: $file.c
688 \$(RMS) ${file}mini.c
689 \$(CPS) ${file}.c ${file}mini.c
6cdadb5a
NC
690!GROK!THIS!
691 else
692 $spitshell >>$Makefile <<!GROK!THIS!
693
694${file}mini.c: $file.c
695 \$(RMS) ${file}mini.c
696 \$(LNS) ${file}.c ${file}mini.c
697!GROK!THIS!
698 fi
699
700 $spitshell >>$Makefile <<!GROK!THIS!
bd0dd1d8 701
aa9e9805 702${file}mini\$(OBJ_EXT): ${file}mini.c
ba0f5503
DM
703 echo @\`\$(CCCMD)\` \$(PLDLFLAGS) $DPERL_IS_MINIPERL $DPERL_EXTERNAL_GLOB ${file}mini.c
704 @\`\$(CCCMD)\` \$(PLDLFLAGS) $DPERL_IS_MINIPERL $DPERL_EXTERNAL_GLOB ${file}mini.c
aa9e9805
NC
705!GROK!THIS!
706done
bf799c64 707
aa9e9805 708$spitshell >>$Makefile <<'!NO!SUBS!'
bf799c64 709
9387abf8 710globals$(OBJ_EXT): $(generated_headers)
9444d213 711
6f83ef0e 712uudmap.h mg_data.h: bitcount.h
0f13ebd5 713
6f83ef0e 714generate_uudmap$(OBJ_EXT): mg_raw.h
9444d213 715
b98f6b80
JR
716!NO!SUBS!
717
1ca484ac
BF
718# If hostgerenate isn't defined, then we have to build
719# generate_uudmap and run it. This can potentially mean running
720# it on the target system if we're cross-compiling.
721# If it is defined, then we just run it locally.
722case "$hostgenerate" in
329865d8 723''|'undef')
1ca484ac
BF
724$spitshell >>$Makefile <<!GROK!THIS!
725bitcount.h: generate_uudmap\$(HOST_EXE_EXT)
726 $run ./generate_uudmap\$(HOST_EXE_EXT) \$(generated_headers)
727 -@for f in \$(generated_headers); do \\
728 $from \$\$f; \\
729 done
730
731!GROK!THIS!
732
733$spitshell >>$Makefile <<'!NO!SUBS!'
b98f6b80 734generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
1ca484ac 735 $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
b98f6b80
JR
736
737!NO!SUBS!
1ca484ac
BF
738;;
739*)
740$spitshell >>$Makefile <<'!NO!SUBS!'
741bitcount.h: generate_uudmap$(HOST_EXE_EXT)
742 ./generate_uudmap$(HOST_EXE_EXT) $(generated_headers)
743
aa9e9805 744generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
1ca484ac
BF
745 -@rm generate_uudmap$(HOST_EXE_EXT)
746 $(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT)
9444d213 747
b98f6b80 748!NO!SUBS!
1ca484ac
BF
749;;
750esac
751
218f8ee6
AB
752case "$osname" in
753amigaos*)
754$spitshell >>$Makefile <<'!NO!SUBS!'
755perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib
69b63ee4 756 $(MINIPERL) -MExtUtils::Miniperl -e 'writemain(\\"perlmain.c", @ARGV)' DynaLoader $(static_ext)
218f8ee6
AB
757
758# The file ext.libs is a list of libraries that must be linked in
759# for static extensions, e.g. -lm -lgdbm, etc. The individual
760# static extension Makefile's add to it.
761ext.libs: $(static_ext)
762 -@test -f ext.libs || touch ext.libs
b98f6b80 763
218f8ee6
AB
764!NO!SUBS!
765;;
766*)
b98f6b80 767$spitshell >>$Makefile <<'!NO!SUBS!'
7b4d95f7 768perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib
69b63ee4 769 $(MINIPERL) -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext)
85e6fe83 770
a0d0e21e
LW
771# The file ext.libs is a list of libraries that must be linked in
772# for static extensions, e.g. -lm -lgdbm, etc. The individual
773# static extension Makefile's add to it.
fed7345c 774ext.libs: $(static_ext)
a0d0e21e 775 -@test -f ext.libs || touch ext.libs
85e6fe83 776
ecfc5424 777!NO!SUBS!
218f8ee6
AB
778;;
779esac
599a829f 780
d96ebe2e 781# How to build libperl. This is still rather convoluted.
599a829f 782# Load up custom Makefile.SH fragment for shared loading and executables:
8736538c 783case "$osname" in
8736538c
AS
784*)
785 Makefile_s="$osname/Makefile.SHs"
786 ;;
787esac
788
549a6b10
JH
789case "$osname" in
790aix)
5a20539c 791 $spitshell >>$Makefile <<!GROK!THIS!
9c839522 792LIBS = $perllibs
5f9d9a17
ME
793# In AIX we need to change this for building Perl itself from
794# its earlier definition (which is for building external
795# extensions *after* Perl has been built and installed)
796CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
549a6b10
JH
797
798!GROK!THIS!
799 case "$useshrplib" in
800 define|true|[yY]*)
5a20539c 801 $spitshell >>$Makefile <<'!NO!SUBS!'
549a6b10
JH
802
803LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT)
804MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT)
805
98d35ab7 806$(LIBPERL_NONSHR): $(perllib_objs)
549a6b10 807 $(RMS) $(LIBPERL_NONSHR)
98d35ab7 808 $(AR) rc $(LIBPERL_NONSHR) $(perllib_objs)
549a6b10 809
bf799c64 810$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
a7089531 811 $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
bf799c64 812 opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
549a6b10
JH
813
814MINIPERLEXP = $(MINIPERL_NONSHR)
815
816LIBPERLEXPORT = perl.exp
817
818!NO!SUBS!
819
820 ;;
821 *)
5a20539c 822 $spitshell >>$Makefile <<'!NO!SUBS!'
199863e7 823MINIPERLEXP = $(MINIPERL_EXE)
549a6b10
JH
824
825PERLEXPORT = perl.exp
826
827!NO!SUBS!
828 ;;
829 esac
5a20539c 830 $spitshell >>$Makefile <<'!NO!SUBS!'
e6807d8a 831perl.exp: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH)
5d4e58dc 832 ./$(MINIPERLEXP) makedef.pl --sort-fold PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" > perl.exp
549a6b10
JH
833
834!NO!SUBS!
835 ;;
2c2d71f5 836os2)
5a20539c 837 $spitshell >>$Makefile <<'!NO!SUBS!'
2c2d71f5
JH
838MINIPERLEXP = miniperl
839
e6807d8a 840perl5.def: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH) miniperl.map
46aae397 841 ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def
2c2d71f5
JH
842
843!NO!SUBS!
844 ;;
5f9145a3 845cygwin)
5a20539c 846 $spitshell >>$Makefile <<'!NO!SUBS!'
5f9145a3
RU
847cygwin.c: cygwin/cygwin.c
848 $(LNS) cygwin/cygwin.c
849
850LIBPERL_NONSHR = libperl$(LIB_EXT)
851
98d35ab7 852$(LIBPERL_NONSHR): $(perllib_objs)
5f9145a3 853 $(RMS) $(LIBPERL_NONSHR)
98d35ab7 854 $(AR) rc $(LIBPERL_NONSHR) $(perllib_objs)
5f9145a3
RU
855
856!NO!SUBS!
857 ;;
549a6b10
JH
858esac
859
5f9145a3 860if test -s $Makefile_s ; then
8736538c 861 . $Makefile_s
5a20539c 862 $spitshell >>$Makefile <<!GROK!THIS!
cd4d8a96 863
8736538c 864Makefile: $Makefile_s
cd4d8a96 865!GROK!THIS!
866else
5ac1e9b2
AA
867 case "$dtrace_h" in
868 ?*)
5a20539c 869 $spitshell >>$Makefile <<'!NO!SUBS!'
12b81ca5 870# dtrace dicards const qualifiers from arguments, put them back
5ac1e9b2 871$(DTRACE_H): perldtrace.d
12b81ca5
TC
872 $(DTRACE) -h -s perldtrace.d -o $(DTRACE_H).in
873 sed -e '/const/!s/char \*/const char */g' $(DTRACE_H).in >$(DTRACE_H)
874 $(RMS) $(DTRACE_H).in
5ac1e9b2
AA
875
876mydtrace.h: $(DTRACE_H)
877
878!NO!SUBS!
879 ;;
880 esac
efc4bddf
DM
881 case "$dtraceobject" in
882 define)
5a20539c 883 $spitshell >>$Makefile <<'!NO!SUBS!'
efc4bddf 884$(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt)
728ecd1a
TC
885 -rm -rf mpdtrace
886 mkdir mpdtrace
887 cp $(miniperl_objs_nodt) mpdtrace/
888 $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MINI_O) $(miniperl_dtrace_objs)
efc4bddf
DM
889
890$(DTRACE_PERLLIB_O): perldtrace.d $(perllib_objs_nodt)
728ecd1a
TC
891 -rm -rf libpdtrace
892 mkdir libpdtrace
893 cp $(perllib_objs_nodt) libpdtrace/
894 $(DTRACE) -G -s perldtrace.d -o $(DTRACE_PERLLIB_O) $(perllib_dtrace_objs)
5ac1e9b2 895
efc4bddf 896$(DTRACE_MAIN_O): perldtrace.d perlmain$(OBJ_EXT)
728ecd1a
TC
897 -rm -rf maindtrace
898 mkdir maindtrace
899 cp perlmain$(OBJ_EXT) maindtrace/
900 $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MAIN_O) $(perlmain_dtrace_objs) || \
47a83dc6
TC
901 ( $(ECHO) "No probes in perlmain$(OBJ_EXT), generating a dummy $(DTRACE_MAIN_O)" && \
902 $(ECHO) >dtrace_main.c && \
903 `$(CCCMD)` $(PLDLFLAGS) dtrace_main.c && \
904 rm -f dtrace_main.c )
3d450a5d 905
5ac1e9b2
AA
906!NO!SUBS!
907 ;;
908 esac
5a20539c 909 $spitshell >>$Makefile <<'!NO!SUBS!'
728ecd1a 910$(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLEXPORT)
9c9e9f08 911!NO!SUBS!
d96ebe2e 912 case "$useshrplib" in
913 true)
5a20539c 914 $spitshell >>$Makefile <<'!NO!SUBS!'
0107c41a 915 rm -f $@
98d35ab7 916 $(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
3c321fdc 917!NO!SUBS!
918 case "$osname" in
919 aix)
5a20539c 920 $spitshell >>$Makefile <<'!NO!SUBS!'
28e8609d 921 rm -f libperl$(OBJ_EXT)
3c321fdc 922 mv $@ libperl$(OBJ_EXT)
923 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 924!NO!SUBS!
3c321fdc 925 ;;
926 esac
d96ebe2e 927 ;;
928 *)
5a20539c 929 $spitshell >>$Makefile <<'!NO!SUBS!'
d96ebe2e 930 rm -f $(LIBPERL)
98d35ab7 931 $(AR) rc $(LIBPERL) $(perllib_objs) $(DYNALOADER)
d96ebe2e 932 @$(ranlib) $(LIBPERL)
655635e8 933!NO!SUBS!
d96ebe2e 934 ;;
935 esac
5a20539c 936 $spitshell >>$Makefile <<'!NO!SUBS!'
599a829f
IZ
937
938# How to build executables.
939
940# The $& notation tells Sequent machines that it can do a parallel make,
941# and is harmless otherwise.
942# The miniperl -w -MExporter line is a basic cheap test to catch errors
943# before make goes on to run preplibrary and then MakeMaker on extensions.
944# This is very handy because later errors are often caused by miniperl
945# build problems but that's not obvious to the novice.
946# The Module used here must not depend on Config or any extensions.
947
cb251201
NC
948# The seemingly cranky ordering of having $(MINIPERL_EXE) depend on
949# lib/buildcustomize.pl despite the reality that lib/buildcustomize.pl needs
950# miniperl to exist first permits us to
951# a) have one rule generate both miniperl and lib/buildcustomize.pl
c02d599b 952# (so that lib/buildcustomize.pl is always available. This simplifies things)
cb251201
NC
953# b) have the rest of the Makefile depend on the more obvious $(MINIPERL_EXE)
954
955$(MINIPERL_EXE): lib/buildcustomize.pl
956
ecfb2188
GS
957!NO!SUBS!
958
959 case "${osname}${osvers}" in
218f8ee6
AB
960 amigaos*)
961 $spitshell >>$Makefile <<'!NO!SUBS!'
98d35ab7 962lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
218f8ee6
AB
963 -@rm -f miniperl.xok
964 $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
98d35ab7 965 $(miniperl_objs) $(libs)
218f8ee6
AB
966# $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
967 $(MINIPERL) -f write_buildcustomize.pl
968!NO!SUBS!
969 ;;
b6c36746 970 aix*)
5a20539c 971 $spitshell >>$Makefile <<'!NO!SUBS!'
98d35ab7
DM
972lib/buildcustomize.pl: $& $(miniperl_objs)
973 $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(miniperl_objs) $(libs)
6aafa456 974 $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
b78ac715 975 $(MINIPERL) -f write_buildcustomize.pl
ecfb2188
GS
976!NO!SUBS!
977 ;;
e56d2c04 978 next4*)
5a20539c 979 $spitshell >>$Makefile <<'!NO!SUBS!'
98d35ab7
DM
980lib/buildcustomize.pl: $& $(miniperl_objs) write ldcustomize.pl
981 $(CC) -o $(MINIPERL_EXE) $(miniperl_objs libs)
6aafa456 982 $(LDLIBPTH) ./miniperl$(HOST _EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
b78ac715 983 $(MINIPERL) -f write_buildcustomize.pl
535d2540
JH
984!NO!SUBS!
985 ;;
cb3fc426 986 darwin*)
986530ea
JH
987 case "$osvers" in
988 [1-6].*) ;;
989 *) case "$ldflags" in
990 *"-flat_namespace"*) ;;
991 *) # to allow opmini.o to override stuff in libperl.dylib
5a20539c 992 $spitshell >>$Makefile <<!NO!SUBS!
69625aa9
JH
993NAMESPACEFLAGS = -force_flat_namespace
994!NO!SUBS!
986530ea
JH
995 ;;
996 esac
997 ;;
cb3fc426 998 esac
5a20539c 999 $spitshell >>$Makefile <<'!NO!SUBS!'
98d35ab7 1000lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
cb3fc426 1001 -@rm -f miniperl.xok
199863e7 1002 $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
98d35ab7 1003 $(miniperl_objs) $(libs)
6aafa456 1004 $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
b78ac715 1005 $(MINIPERL) -f write_buildcustomize.pl
cb3fc426
JH
1006!NO!SUBS!
1007 ;;
ecfb2188 1008 *)
b98f6b80 1009 if test "X$hostperl" != X; then
b2b07891 1010 $spitshell >>$Makefile <<!GROK!THIS!
728ecd1a 1011lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl
b98f6b80 1012 -@rm -f miniperl.xok
b2b07891
BF
1013 -@rm \$(MINIPERL_EXE)
1014 \$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
1015 \$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
1016 \$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
1017!GROK!THIS!
b98f6b80
JR
1018 else
1019 $spitshell >>$Makefile <<'!NO!SUBS!'
728ecd1a 1020lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
93c0359c 1021 -@rm -f miniperl.xok
dfef7e50 1022 $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
98d35ab7 1023 $(miniperl_objs) $(libs)
6aafa456 1024 $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
b78ac715 1025 $(MINIPERL) -f write_buildcustomize.pl
ecfb2188 1026!NO!SUBS!
b98f6b80 1027 fi
ecfb2188
GS
1028 ;;
1029 esac
1030
5a20539c 1031 $spitshell >>$Makefile <<'!NO!SUBS!'
599a829f 1032
728ecd1a 1033$(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
93c0359c 1034 -@rm -f miniperl.xok
6711cb4f
TC
1035!NO!SUBS!
1036
1037 case $osname in
c8aec1f6
AB
1038 # In AmigaOS the Perl executable needs to be linked with -ldl,
1039 # but none of the other executables should be.
1040 amigaos) $spitshell >>$Makefile <<'!NO!SUBS!'
efc4bddf 1041 $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs) -ldl
c8aec1f6
AB
1042!NO!SUBS!
1043 ;;
6711cb4f 1044 os390) $spitshell >>$Makefile <<'!NO!SUBS!'
efc4bddf 1045 $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
6711cb4f
TC
1046!NO!SUBS!
1047 ;;
1048 *) $spitshell >>$Makefile <<'!NO!SUBS!'
efc4bddf 1049 $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
6711cb4f
TC
1050!NO!SUBS!
1051 ;;
1052 esac
1053
1054 $spitshell >>$Makefile <<'!NO!SUBS!'
599a829f 1055
f946bb38
JH
1056# Microperl. This is just a convenience thing if one happens to
1057# build also the full Perl and therefore the real big Makefile:
f4db5405 1058# usually one should manually explicitly issue the below command.
f946bb38 1059
869a466c 1060.PHONY: microperl
f946bb38
JH
1061microperl:
1062 $(MAKE) -f Makefile.micro
1063
fe5460cc
RT
1064!NO!SUBS!
1065
599a829f
IZ
1066fi
1067
6d4b7d88
JH
1068# Some environment have no system(), which mkpport uses.
1069# Let's try running the commands with shell.
1070case "${osname}" in
1071catamount)
5a20539c 1072$spitshell >>$Makefile <<!GROK!THIS!
6d4b7d88 1073.PHONY: makeppport
199863e7 1074makeppport: \$(MINIPERL_EXE) \$(CONFIGPM)
6d4b7d88 1075 -@for f in Makefile.PL PPPort_pm.PL PPPort_xs.PL ppport_h.PL; do \
199863e7 1076 (cd ext/Devel-PPPort && `pwd`/run.sh ../../$(MINIPERL_EXE) -I../../lib \$\$f); \
6d4b7d88
JH
1077 done
1078
1079!GROK!THIS!
1080;;
1081*)
5a20539c 1082$spitshell >>$Makefile <<'!NO!SUBS!'
6d4b7d88 1083.PHONY: makeppport
199863e7 1084makeppport: $(MINIPERL_EXE) $(CONFIGPM) $(nonxs_ext)
f6b3c354 1085 $(MINIPERL) mkppport
6d4b7d88
JH
1086
1087!NO!SUBS!
1088;;
1089esac
1090
5a20539c 1091$spitshell >>$Makefile <<'!NO!SUBS!'
599a829f 1092
869a466c 1093.PHONY: preplibrary
7353f64c 1094preplibrary: $(MINIPERL_EXE) $(CONFIGPM) $(PREPLIBRARY_LIBPERL)
2304df62 1095
0f13ebd5
NC
1096$(CONFIGPM_FROM_CONFIG_SH): $(CONFIGPOD)
1097
1098$(CONFIGPOD): config.sh $(MINIPERL_EXE) configpm Porting/Glossary lib/Config_git.pl
199863e7 1099 $(MINIPERL) configpm
2304df62 1100
58fa074c 1101unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data
6c684aee 1102
199863e7 1103uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
f6b3c354 1104 $(MINIPERL) lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p
f86864ac
KW
1105# Commented out so always runs, mktables looks at far more files than we
1106# can in this makefile to decide if needs to run or not
1107# touch uni.data
5ad7e614 1108
f4e064af 1109# $(PERL_EXE) and ext because pod_lib.pl needs Digest::MD5
7eb47696
NC
1110# But also this ensures that all extensions are built before we try to scan
1111# them, which picks up Devel::PPPort's documentation.
34b80e25 1112pod/perltoc.pod: $(perltoc_pod_prereqs) $(PERL_EXE) $(ext) pod/buildtoc
9094a4e8 1113 $(RUN_PERL) -f pod/buildtoc -q
7eb47696 1114
0f13ebd5
NC
1115pod/perlapi.pod: pod/perlintern.pod
1116
f4e064af 1117pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc
199863e7 1118 $(MINIPERL) autodoc.pl
344af494 1119
199863e7 1120pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
f6b3c354 1121 $(MINIPERL) pod/perlmodlib.PL -q
6e2c8928 1122
1b510166
S
1123pod/perl5271delta.pod: pod/perldelta.pod
1124 $(RMS) pod/perl5271delta.pod
1125 $(LNS) perldelta.pod pod/perl5271delta.pod
8e7bc40f 1126
199863e7 1127extra.pods: $(MINIPERL_EXE)
ebbebb7c 1128 -@test ! -f extra.pods || rm -f `cat extra.pods`
72b3d9b4 1129 -@rm -f extra.pods
b4bc034f 1130 -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
72b3d9b4 1131 nx=`echo $$x | sed -e "s/README\.//"`; \
e0be038f 1132 $(LNS) ../$$x "pod/perl"$$nx".pod" ; \
72b3d9b4
GS
1133 echo "pod/perl"$$nx".pod" >> extra.pods ; \
1134 done
ebbebb7c 1135
34b80e25 1136extras.make: $(PERL_EXE)
9094a4e8 1137 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
bf35c3f6 1138
34b80e25 1139extras.test: $(PERL_EXE)
9094a4e8 1140 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
bf35c3f6 1141
34b80e25 1142extras.install: $(PERL_EXE)
9094a4e8 1143 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
bf35c3f6 1144
869a466c 1145.PHONY: install install-strip install-all install-verbose install-silent \
5e2f386f 1146 no-install install.perl install.man install.html
869a466c 1147
70eaf669
IZ
1148# Set this to an empty string to avoid an attempt of rebuild before install
1149INSTALL_DEPENDENCE = all
1150
6784814b
NC
1151no_install no-install: install-notify
1152
1153install: install-all
07f58f84
NC
1154!NO!SUBS!
1155
a9bf3e8f 1156
07f58f84
NC
1157for name in all notify silent strip verbose; do
1158 flags="--$name";
078902ab 1159 flags=`echo $flags | sed -e 's/--all//'`
a9bf3e8f
JR
1160 if test "X$hostperl" != X; then
1161 $spitshell >>$Makefile <<EOT
1162
1163install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman
078902ab
GA
1164 \$(HOST_PERL) installperl --destdir=\$(DESTDIR) $flags \$(INSTALLFLAGS) \$(STRIPFLAGS)
1165 \$(HOST_PERL) installman --destdir=\$(DESTDIR) $flags
a9bf3e8f
JR
1166EOT
1167 else
1168 $spitshell >>$Makefile <<EOT
07f58f84
NC
1169
1170install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman
078902ab
GA
1171 \$(RUN_PERL) installperl --destdir=\$(DESTDIR) $flags \$(INSTALLFLAGS) \$(STRIPFLAGS)
1172 \$(RUN_PERL) installman --destdir=\$(DESTDIR) $flags
07f58f84 1173EOT
a9bf3e8f 1174 fi
3a031125
NC
1175
1176 test $name = notify || echo ' -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '\''@ARGV&&install(@ARGV)'\'' `cat extras.lst`' >>$Makefile
07f58f84
NC
1177done
1178
a9bf3e8f
JR
1179if test "X$hostperl" != X; then
1180 $spitshell >>$Makefile <<'!NO!SUBS!'
1181install.perl: $(INSTALL_DEPENDENCE) installperl
1182 $(HOST_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
1183 -@test ! -s extras.lst || $(MAKE) extras.install
1184
1185install.man: all installman
1186 $(HOST_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
6784814b 1187
a9bf3e8f
JR
1188# XXX Experimental. Hardwired values, but useful for testing.
1189# Eventually Configure could ask for some of these values.
1190install.html: all installhtml
1191 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
1192 $(HOST_PERL) installhtml \
1193 --podroot=. --podpath=. --recurse \
1194 --htmldir=$(privlib)/html \
1195 --htmlroot=$(privlib)/html \
1196 --splithead=pod/perlipc \
1197 --splititem=pod/perlfunc \
1198 --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
1199 --verbose
1200!NO!SUBS!
1201else
1202 $spitshell >>$Makefile <<'!NO!SUBS!'
70eaf669 1203install.perl: $(INSTALL_DEPENDENCE) installperl
34b80e25 1204 $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
d618fe71 1205 -@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
a0d0e21e 1206
b1a1e9f1 1207install.man: all installman
34b80e25 1208 $(RUN_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
16d20bd9 1209
84902520
TB
1210# XXX Experimental. Hardwired values, but useful for testing.
1211# Eventually Configure could ask for some of these values.
1212install.html: all installhtml
40096396 1213 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
34b80e25 1214 $(RUN_PERL) installhtml \
84902520 1215 --podroot=. --podpath=. --recurse \
47ec63d0
RGS
1216 --htmldir=$(privlib)/html \
1217 --htmlroot=$(privlib)/html \
84902520
TB
1218 --splithead=pod/perlipc \
1219 --splititem=pod/perlfunc \
e2b41a3f 1220 --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
84902520 1221 --verbose
a9bf3e8f
JR
1222!NO!SUBS!
1223fi
84902520 1224
a9bf3e8f 1225$spitshell >>$Makefile <<'!NO!SUBS!'
16d20bd9 1226
a0d0e21e 1227# I now supply perly.c with the kits, so the following section is
0de566d7
DM
1228# used only if you force bison to run by saying
1229# make regen_perly
1230# You normally shouldn't remake perly.[ch].
1231
1232.PHONY: regen_perly
1233
59c72abb 1234run_byacc run-byacc:
0de566d7
DM
1235 @echo "run_byacc is obsolete; try 'make regen_perly' instead"
1236
f05e27e5 1237# this outputs perly.h, perly.act and perly.tab
59c72abb 1238regen_perly regen-perly:
0de566d7 1239 perl regen_perly.pl
56febc5e
AD
1240
1241# We don't want to regenerate perly.c and perly.h, but they might
1242# appear out-of-date after a patch is applied or a new distribution is
1243# made.
92c28edd 1244perly.c: perly.y
b233458b
JH
1245 -@sh -c true
1246
92c28edd 1247perly.h: perly.y
b233458b
JH
1248 -@sh -c true
1249
d500e60d 1250SYM = globvar.sym perlio.sym
419eaf7b 1251
907b3e23 1252SYMH = perlvars.h intrpvar.h
419eaf7b 1253
dae78bb1
IZ
1254CHMOD_W = chmod +w
1255
a8581515 1256# The following files are generated automatically
d500e60d 1257# embed.pl: proto.h embed.h embedvar.h perlapi.h perlapi.c
897d3989 1258# opcode.pl: opcode.h opnames.h pp_proto.h
c83f8f39
JH
1259# regcomp.pl: regnodes.h
1260# warnings.pl: warnings.h lib/warnings.pm
f2c01b15 1261# feature.pl: feature.h lib/feature.pm
e50aee73
AD
1262# The correct versions should be already supplied with the perl kit,
1263# in case you don't have perl available.
36bb303b 1264# To force them to be regenerated, run
9ad884cb 1265# perl regen.pl
36bb303b
NC
1266# with your existing copy of perl
1267# (make regen_headers is kept for backwards compatibility)
e1354ed6 1268
d500e60d 1269AUTOGEN_FILES = opcode.h opnames.h pp_proto.h proto.h embed.h embedvar.h \
69bcf1d3 1270 perlapi.h perlapi.c regnodes.h warnings.h lib/warnings.pm \
f2c01b15 1271 lib/feature.pm feature.h
e1354ed6 1272
1e2f36ef 1273.PHONY: regen_headers regen_all
869a466c 1274
95aa0565 1275regen: FORCE
9ad884cb 1276 -perl regen.pl
2caceca9 1277 -perl regen/uconfig_h.pl
8e07c86e 1278
59c72abb 1279regen_headers regen-headers: FORCE
95aa0565 1280 -perl regen.pl -v
2caceca9 1281 -perl regen/uconfig_h.pl -v
95aa0565 1282
bfc0a3e7 1283regen_meta regen-meta: META.yml META.json
de65cabd
JV
1284
1285META.yml: FORCE
9094a4e8 1286 PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -y
bfc0a3e7
CBW
1287
1288META.json: FORCE
9094a4e8 1289 PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -j
de65cabd
JV
1290
1291
59c72abb 1292regen_all regen-all: regen regen_meta
9fec149b 1293
1aea71db
A
1294.PHONY: manisort manicheck
1295
1296manisort: FORCE
4e86fc4b
JH
1297 @perl Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \
1298 perl Porting/manisort -q -o MANIFEST; sh -c true)
1aea71db
A
1299
1300manicheck: FORCE
1301 perl Porting/manicheck
1302
a0d0e21e 1303# Extensions:
4318d5a0
GB
1304# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
1305# automatically get built. There should ordinarily be no need to change
1306# any of this part of makefile.
a0d0e21e
LW
1307#
1308# The dummy dependency is a place holder in case $(dynamic_ext) or
1309# $(static_ext) is empty.
1310#
1311# DynaLoader may be needed for extensions that use Makefile.PL.
1312
5e4c4c91 1313$(DYNALOADER): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE $(nonxs_ext)
aafd5a98 1314 $(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
a0d0e21e 1315
56dba491 1316d_dummy $(dynamic_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) $(LIBPERL)
aafd5a98 1317 $(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
a0d0e21e 1318
5e4c4c91 1319s_dummy $(static_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
aafd5a98 1320 $(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
2304df62 1321
5e4c4c91 1322n_dummy $(nonxs_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE
aafd5a98 1323 $(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL)
9f3ef600
NC
1324!NO!SUBS!
1325
5a20539c 1326$spitshell >>$Makefile <<EOF
9f3ef600
NC
1327$extra_dep
1328EOF
1329
5a20539c 1330$spitshell >>$Makefile <<'!NO!SUBS!'
4318d5a0 1331
a774dfe6
RSG
1332.PHONY: printconfig
1333printconfig:
9094a4e8 1334 @eval `$(RUN_PERL) -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
a774dfe6 1335
869a466c
JH
1336.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
1337 realclean _realcleaner clobber _clobber \
6e2cec71 1338 distclean veryclean _verycleaner
869a466c 1339
dd8235d9 1340clean: realclean
70af249b 1341
6e2cec71 1342realclean: _realcleaner _mopup
fcfe1ab7 1343 @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
70af249b 1344
b37ebb13 1345_clobber:
d9821278 1346 -@rm -f Cross/run-* Cross/to-* Cross/from-* Cross/mkdir
b98f6b80 1347 -rm -rf host
0279961e 1348 rm -f t/test_state
bf35c3f6 1349 rm -f config.sh cppstdin Policy.sh extras.lst
df3c16d0 1350 rm -f $(MANIFEST_SRT)
b37ebb13 1351
6e2cec71 1352clobber: _realcleaner _mopup _clobber
70af249b
CS
1353
1354distclean: clobber
1355
2edbd6da 1356# Like distclean but also removes emacs backups and *.orig.
6e2cec71 1357veryclean: _verycleaner _mopup _clobber
b37ebb13 1358 -@rm -f Obsolete Wanted
2edbd6da 1359
70af249b
CS
1360# Do not 'make _mopup' directly.
1361_mopup:
9387abf8 1362 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c perlmini.c generate_uudmap$(EXE_EXT) $(generated_headers)
1ed50e5b 1363 -rmdir .depending
72b3d9b4 1364 -@test -f extra.pods && rm -f `cat extra.pods`
b4bc034f 1365 -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
60f0ee9d 1366 -rm -f perl.exp ext.libs $(generated_pods) uni.data opmini.o perlmini.o pod/roffitall
d96ebe2e 1367 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
f01ecde8 1368 -rm -f *perl.xok
ce0286c6 1369 -rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
34b80e25 1370 -rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
fc40bd89 1371 -rm -f config.arch config.over $(DTRACE_H)
70af249b 1372
2edbd6da 1373_cleaner1:
4633a7c4 1374 -cd os2; rm -f Makefile
2edbd6da
JH
1375 -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
1376 -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
199863e7 1377 -@if test -f $(MINIPERL_EXE) ; then \
61edc683 1378 for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
63d47850 1379 $(MINIPERL) make_ext.pl --target=$(CLEAN) $$x MAKE="$(MAKE)" ; \
61edc683
NC
1380 done ; \
1381 else \
1382 sh $(CLEAN).sh ; \
1383 fi
1384 rm -f realclean.sh veryclean.sh
e621c5a8 1385 -rm -f `grep -v ^# mkppport.lst | grep . | sed -e 's/$$/\/ppport.h/'`
0d4cbbcf
NC
1386
1387# Dear POSIX, thanks for making the default to xargs to be
1388# run once if nothhing is passed in. It is such a great help.
2edbd6da 1389
2ad994b6 1390# Some systems do not support "?", so keep these files separate.
2edbd6da 1391_cleaner2:
2ad994b6 1392 -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
5033177e 1393 rm -f core *perl.core t/core t/*perl.core core.* t/core.*
f18bc4a8
NC
1394 rm -f t/$(PERL_EXE) t/rantests
1395 rm -rf t/tmp*
a0d0e21e 1396 rm -rf $(addedbyconf)
0827416d 1397 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old utils/Makefile
c27f7bb1 1398 rm -f $(private)
ca12659b 1399 rm -rf $(unidatafiles) $(unidatadirs)
a0d0e21e 1400 rm -rf lib/auto
07a6e20d 1401 rm -f lib/.exists lib/*/.exists lib/*/*/.exists
2560602c 1402 rm -f h2ph.man
a0d0e21e 1403 rm -rf .config
7353f64c 1404 rm -f preload
5daeb5b0
NC
1405 rm -f pod2htmd.tmp
1406 rm -rf pod/perlfunc pod/perlipc
1407 -rmdir ext/B/lib
1408 rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
df61f5a9
SH
1409 -rmdir lib/version lib/threads lib/inc/ExtUtils lib/inc lib/encoding
1410 -rmdir lib/autodie/exception lib/autodie/Scope lib/autodie lib/XS
1411 -rmdir lib/Win32API lib/VMS lib/Unicode/Collate/Locale
1412 -rmdir lib/Unicode/Collate/CJK lib/Unicode/Collate lib/Tie/Hash
a5ab2255
CBW
1413 -rmdir lib/Thread lib/Text lib/Test2/Util lib/Test2/Tools
1414 -rmdir lib/Test2/IPC/Driver lib/Test2/IPC lib/Test2/Hub/Interceptor
1415 -rmdir lib/Test2/Hub lib/Test2/Formatter lib/Test2/Event/TAP
1416 -rmdir lib/Test2/Event lib/Test2/API lib/Test2 lib/Test/use
1417 -rmdir lib/Test/Tester lib/Test/Builder/Tester lib/Test/Builder/IO
1418 -rmdir lib/Test/Builder lib/Test lib/Term lib/TAP/Parser/YAMLish
956a2dcd
JK
1419 -rmdir lib/TAP/Parser/SourceHandler lib/TAP/Parser/Scheduler
1420 -rmdir lib/TAP/Parser/Result lib/TAP/Parser/Iterator lib/TAP/Parser
1421 -rmdir lib/TAP/Harness lib/TAP/Formatter/File
1422 -rmdir lib/TAP/Formatter/Console lib/TAP/Formatter lib/TAP
1423 -rmdir lib/Sys/Syslog lib/Sys lib/Sub lib/Search lib/Scalar
1424 -rmdir lib/Pod/Text lib/Pod/Simple lib/Pod/Perldoc lib/PerlIO/via
1425 -rmdir lib/PerlIO lib/Perl lib/Parse/CPAN lib/Parse lib/Params
1426 -rmdir lib/Net/FTP lib/Module/Load lib/Module/CoreList lib/Module
1427 -rmdir lib/Memoize lib/Math/BigInt lib/Math/BigFloat lib/Math lib/MIME
1428 -rmdir lib/Locale/Maketext lib/Locale/Codes lib/Locale lib/List/Util
1429 -rmdir lib/List lib/JSON/PP lib/JSON lib/IPC lib/IO/Uncompress/Adapter
1430 -rmdir lib/IO/Uncompress lib/IO/Socket lib/IO/Compress/Zlib
1431 -rmdir lib/IO/Compress/Zip lib/IO/Compress/Gzip lib/IO/Compress/Base
d81c2d6a
CBW
1432 -rmdir lib/IO/Compress/Adapter lib/IO/Compress lib/IO
1433 -rmdir lib/I18N/LangTags lib/I18N lib/Hash/Util lib/Hash lib/HTTP
1434 -rmdir lib/Filter/Util lib/Filter lib/File/Spec lib/ExtUtils/Typemaps
88e24181
CBW
1435 -rmdir lib/ExtUtils/ParseXS lib/ExtUtils/MakeMaker/version
1436 -rmdir lib/ExtUtils/MakeMaker lib/ExtUtils/Liblist
1437 -rmdir lib/ExtUtils/Constant lib/ExtUtils/Command
727d4ce6
NC
1438 -rmdir lib/ExtUtils/CBuilder/Platform/Windows
1439 -rmdir lib/ExtUtils/CBuilder/Platform lib/ExtUtils/CBuilder
1440 -rmdir lib/Exporter lib/Encode/Unicode lib/Encode/MIME/Header
1441 -rmdir lib/Encode/MIME lib/Encode/KR lib/Encode/JP lib/Encode/CN
1442 -rmdir lib/Encode lib/Digest lib/Devel lib/Data lib/Config/Perl
79116533
SH
1443 -rmdir lib/Compress/Raw lib/Compress lib/Carp lib/CPAN/Plugin
1444 -rmdir lib/CPAN/Meta/History lib/CPAN/Meta lib/CPAN/LWP
1445 -rmdir lib/CPAN/Kwalify lib/CPAN/HTTP lib/CPAN/FTP lib/CPAN/Exception
1446 -rmdir lib/CPAN/API lib/CPAN lib/Attribute lib/Archive/Tar lib/Archive
a770949e 1447 -rmdir lib/App/Prove/State/Result lib/App/Prove/State lib/App/Prove
6e8fbcb5 1448 -rmdir lib/App lib/Amiga
ecfc5424 1449
f4db5405 1450_realcleaner:
95aef5ce 1451 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=distclean
2edbd6da
JH
1452 @$(LDLIBPTH) $(MAKE) _cleaner2
1453
f4db5405 1454_verycleaner:
2edbd6da
JH
1455 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1456 @$(LDLIBPTH) $(MAKE) _cleaner2
c94787a5 1457 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
2edbd6da 1458
869a466c 1459.PHONY: lint
bf0dfd28 1460lint: $(c)
075abff3 1461 rm -f *.ln
66a1b24b 1462 lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
2304df62 1463
762030fb
JH
1464cscopeflags = -Rb # Recursive, build-only.
1465
1466.PHONY: cscope
1467# To query the cscope.out "cscope -dLnsymbol" where n = 0 means uses,
8a1d10af
JH
1468# 1 = definitions, 2 = callees, 3 = callers, for example
1469# "cscope -dL1Perl_mg_set" or run cscope interactively (no arguments).
762030fb
JH
1470cscope.out cscope: $(c) $(h)
1471 cscope $(cscopeflags)
1472
fb73857a 1473# Need to unset during recursion to go out of loop.
1474# The README below ensures that the dependency list is never empty and
1475# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 1476
84902520 1477MAKEDEPEND = Makefile makedepend
cd4d8a96 1478
fb73857a 1479$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 1480 $(MAKE) depend MAKEDEPEND=
9719c95b
NC
1481!NO!SUBS!
1482
1483for f in $SH; do
1484 file=`SH_to_target $f`
1485 $spitshell >>$Makefile <<!GROK!THIS!
a0d0e21e 1486
9719c95b
NC
1487$file: $f config.sh
1488 \$(SHELL) $f
1489!GROK!THIS!
1490done
1491
1492$spitshell >>$Makefile <<'!NO!SUBS!'
655635e8 1493
869a466c 1494.PHONY: depend
1be0d08e 1495depend: makedepend $(DTRACE_H) $(generated_headers)
63d47850 1496 sh ./makedepend MAKE="$(MAKE)" cflags
2304df62 1497
9988b539 1498.PHONY: test check test_prep test_prep_nodll test_prep_pre \
ec81ed5d 1499 test_prep_reonly test_tty test-tty test_notty test-notty \
499cea6b 1500 test_harness test_harness_notty minitest test-reonly _test
f258a656 1501
9e716730
MB
1502# The _test target is there just for Test::Smoke, which does a make test_prep
1503# always before invoking this target, thus preventing checking again
f258a656 1504_test:
463c96de 1505 $(RUN_TESTS) choose
869a466c 1506
ec861bc1
JH
1507# Cannot delegate rebuilding of t/perl to make
1508# to allow interlaced test and minitest
3e3baf6d 1509
1167a30e
IZ
1510# Architecture-neutral stuff:
1511
1512test_prep_pre: preplibrary utilities $(nonxs_ext)
421103b7 1513!NO!SUBS!
1167a30e 1514
421103b7
JR
1515case "$targethost" in
1516'') $spitshell >>$Makefile <<'!NO!SUBS!'
59c72abb 1517test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
e5a8a0fb 1518 $(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods)
34b80e25 1519 cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
a0ed51b3 1520
421103b7
JR
1521!NO!SUBS!
1522;;
1523*) $spitshell >>$Makefile <<!GROK!THIS!
1524test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE) \
e5a8a0fb 1525 \$(dynamic_ext) \$(TEST_PERL_DLL) runtests \
421103b7
JR
1526 \$(generated_pods)
1527 $to libperl.*
1528 $to t/*
1529 $to lib/*
1530 $to TestInit.pm
1531 $to win32/FindExt.pm
1532 $to regen/*
1533 $to pod/*
1534 $to MANIFEST
1535 $to Porting/*
1536 $to cpan/*/t
1537 $to dist/*/t
1538 $to ext/*/t
ef4ead6d 1539 $to cpan/Archive-Tar/*
4ef422df 1540 $to cpan/Module-Metadata/*
421103b7
JR
1541 $to cpan/Term-Cap/test.pl
1542 $to cpan/Pod-Usage/*
1543 $to cpan/Pod-Parser/*
1544 $to cpan/IO-Compress/*
1545 $to cpan/HTTP-Tiny/lib/*
1546 $to cpan/Filter-Util-Call/filter-util.pl
1547 $to cpan/Digest-MD5/*
1548 $to cpan/Digest-SHA/*
1549 $to cpan/Test-Simple/*
1550 $to cpan/Pod-Parser/lib/*
1551 $to cpan/Test-Harness/*
1552 $to cpan/Scalar-List-Utils/*
1553 $to ext/IPC-Open3/*
1554 $to ext/Tie-Memoize/*
1555 $to ext/POSIX/*
1556 $to dist/IO/*
1557# --- These three are needed by ExtUtils::MM_Unix to verify PERL_CORE
1558 $to config_h.SH
1559 $to perl.h
1560 $to cflags
421103b7 1561 $to *.h
ef4ead6d
BF
1562# --- For t/porting/customized.t
1563 $to vutil.c
1564 $to vxs.inc
b83fd0ae
BF
1565# --- For t/TEST
1566 $to config.sh
421103b7
JR
1567# --- For lib/diagnostics.t with -Duseshrplib
1568 $to \$(PERL_EXE)
1569 cd t && (rm -f \$(PERL_EXE); \$(LNS) ../\$(PERL_EXE) \$(PERL_EXE)) && cd ..
1570 $to t/\$(PERL_EXE)
1571
1572!GROK!THIS!
1573;;
1574esac
1575
1576$spitshell >>$Makefile <<'!NO!SUBS!'
34b80e25 1577test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL)
63d47850 1578 $(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
34b80e25 1579 cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
86bfbb31
JR
1580!NO!SUBS!
1581
1582case "$targethost" in
1583'') $spitshell >>$Makefile <<'!NO!SUBS!'
ec81ed5d 1584
937aca76 1585test check: test_prep
5fb77da4 1586 $(RUN_TESTS) choose
ec861bc1 1587
86bfbb31
JR
1588!NO!SUBS!
1589;;
1590*) $spitshell >>$Makefile <<!GROK!THIS!
1591
1592test check: test_prep
fa142983 1593 $run -cwd $targetdir/t -env "$targetenv LD_LIBRARY_PATH=$targetdir:$targetdir/lib:$targetdir/lib/auto:\$\$LD_LIBRARY_PATH" ./TEST
86bfbb31
JR
1594
1595!GROK!THIS!
1596;;
1597esac
1598
1599$spitshell >>$Makefile <<'!NO!SUBS!'
59c72abb 1600test_tty test-tty: test_prep
5fb77da4 1601 $(RUN_TESTS) tty
ec861bc1 1602
59c72abb 1603test_notty test-notty: test_prep
5fb77da4 1604 $(RUN_TESTS) no-tty
ec861bc1 1605
45ed6be3
JC
1606!NO!SUBS!
1607
1608case "${osname}${osvers}" in
09617314 1609linux*|darwin*)
45ed6be3 1610 $spitshell >>$Makefile <<'!NO!SUBS!'
7a834142
JH
1611# Targets for valgrind testing:
1612
9d4d67dd
NC
1613test.valgrind check.valgrind: test_prep
1614 @echo "Checking usemymalloc='n' in config.sh..."
1615 @grep "^usemymalloc=" config.sh
1616 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
1617 @echo "And of course you have to have valgrind..."
1618 $(VALGRIND) $(VG_TEST) || exit 1
be075caf 1619 PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' TESTFILE=harness $(RUN_TESTS) choose
45ed6be3
JC
1620!NO!SUBS!
1621 ;;
1622esac
1623
1624$spitshell >>$Makefile <<'!NO!SUBS!'
7a834142 1625
9438e34a 1626# minitest can't depend on lib/Config.pm because that might be where miniperl
344479a0 1627# is crashing.
9438e34a 1628minitest_prep:
8a71e97e 1629 -@test -f lib/Config.pm || $(MAKE) lib/Config.pm $(unidatafiles)
4fa3f26e 1630 @echo " "
d96ebe2e 1631 @echo "You may see some irrelevant test failures if you have been unable"
82dee7de 1632 @echo "to build lib/Config.pm, or the Unicode data files."
4fa3f26e 1633 @echo " "
9438e34a
JH
1634 - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE))
1635
1636MINITEST_TESTS = base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t
1637
1638minitest: $(MINIPERL_EXE) minitest_prep
1247ba6e 1639 - cd t && $(RUN_PERL) TEST $(MINITEST_TESTS) <$(devtty)
9438e34a
JH
1640
1641minitest-notty minitest_notty: $(MINIPERL_EXE) minitest_prep
1642 - cd t && PERL_SKIP_TTY_TEST=1 $(RUN_PERL) TEST $(MINITEST_TESTS)
16d20bd9 1643
1167a30e
IZ
1644# Test via harness
1645
59c72abb 1646test_harness test-harness: test_prep
5fb77da4 1647 TESTFILE=harness $(RUN_TESTS) choose
1167a30e 1648
69bfbd2f 1649test_harness_notty: test_prep
5fb77da4 1650 HARNESS_NOTTY=1 TESTFILE=harness $(RUN_TESTS) choose
69bfbd2f 1651
59c72abb 1652test_reonly test-reonly: test_prep_reonly
5fb77da4 1653 TEST_ARGS='-re \bre\/' TESTFILE=harness $(RUN_TESTS) choose
4979e288 1654
1e547844
JV
1655
1656# Porting tests (well-formedness of pod, manifest, etc)
1657
59c72abb 1658test_porting test-porting: test_prep
48d97dac 1659 cd t && $(RUN_PERL) harness porting/*.t ../lib/diagnostics.t
1e547844 1660
fb73857a 1661# Handy way to run perlbug -ok without having to install and run the
84902520 1662# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 1663# Please *don't* use this unless all tests pass.
1d2dff63 1664# If you want to report test failures, use "make nok" instead.
869a466c
JH
1665
1666.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1667
188cd53f 1668ok: utilities
9094a4e8 1669 $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)'
84902520 1670
105f9295 1671okfile: utilities
9094a4e8 1672 $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 1673
890b8eb0 1674oknack: utilities
9094a4e8 1675 $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -A
890b8eb0
NC
1676
1677okfilenack: utilities
9094a4e8 1678 $(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
890b8eb0 1679
1d2dff63 1680nok: utilities
9094a4e8 1681 $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 1682
b4e8cfaf 1683nokfile: utilities
9094a4e8 1684 $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
b4e8cfaf 1685
890b8eb0 1686noknack: utilities
9094a4e8 1687 $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -A
890b8eb0
NC
1688
1689nokfilenack: utilities
9094a4e8 1690 $(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
890b8eb0 1691
655e5c9e 1692.PHONY: clist hlist
869a466c 1693
85e6fe83 1694clist: $(c)
92c28edd 1695 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 1696
85e6fe83 1697hlist: $(h)
92c28edd 1698 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 1699
869a466c 1700.PHONY: distcheck
599a829f 1701distcheck: FORCE
760ac839
LW
1702 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1703
dde299c1 1704.PHONY: ctags
3ee700d1 1705
e8d46ec9
RU
1706TAGS: $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
1707 etags $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
1708
5c36f626 1709ctags:
bf799c64 1710 ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c --exclude=perlmini.c *.c *.h
5c36f626 1711
2304df62
AD
1712# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1713# If this runs make out of memory, delete /usr/include lines.
1714!NO!SUBS!
1715
85e6fe83 1716$eunicefix Makefile
cd4d8a96 1717$rm -f $firstmakefile
5ff3f7a4
GS
1718
1719# Now do any special processing required before building.
1720
1721case "$ebcdic" in
2d340b60 1722define)
5ff3f7a4 1723 xxx=''
2d340b60 1724 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
7a66b286 1725case "$osname" in
25e9a2e3 1726os390|posix-bc)
7a66b286 1727 ;;
aa34f189 1728*)
e9d08790 1729 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 1730 ;;
fe572743 1731esac
5ff3f7a4
GS
1732 case "$xxx" in
1733 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1734 esac
1735 ;;
1736esac
1737
075abff3 1738# ex: set ts=8 sts=4 sw=4 noet: