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