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