This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Math::BigInt 1.40.
[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
12: This forces SH files to create target in same directory as SH file.
13: This is so that make depend always knows where to find SH derivatives.
14case "$0" in
15*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
16esac
17
2304df62
AD
18case "$d_dosuid" in
19*define*) suidperl='suidperl' ;;
20*) suidperl='';;
21esac
22
d5d19f97 23linklibperl='$(LIBPERL)'
3c321fdc 24shrpldflags='$(LDDLFLAGS)'
6ee623d5 25ldlibpth=''
ac9901e0 26DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
d96ebe2e 27case "$useshrplib" in
28true)
f4db5405 29 # Prefix all runs of 'miniperl' and 'perl' with
5cf1d1f1 30 # $ldlibpth so that ./perl finds *this* shared libperl.
c1b49bc0
GS
31 case "$LD_LIBRARY_PATH" in
32 '')
33 ldlibpth="LD_LIBRARY_PATH=`pwd`";;
34 *)
35 ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
36 esac
6ee623d5 37
d5d19f97 38 pldlflags="$cccdlflags"
d96ebe2e 39 case "${osname}${osvers}" in
40 next4*)
3c321fdc 41 ld=libtool
42 lddlflags="-dynamic -undefined warning -framework System \
43 -compatibility_version 1 -current_version $patchlevel \
44 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
6ee623d5 45 ;;
f556e5b9
JH
46 rhapsody*|darwin*)
47 shrpldflags="${ldflags} -dynamiclib \
c1e7a127
W
48 -compatibility_version \
49 ${api_revision}.${api_version}.${api_subversion} \
f556e5b9 50 -current_version \
c1e7a127 51 ${revision}.${patchlevel}.${subversion} \
f556e5b9
JH
52 -install_name \$(shrpdir)/\$@"
53 ;;
5cf1d1f1 54 cygwin*)
8736538c
AS
55 linklibperl="-lperl"
56 ;;
73d40b3e 57 sunos*)
d5d19f97
UP
58 linklibperl="-lperl"
59 ;;
43039de7 60 netbsd*|freebsd[234]*|openbsd*)
099685bc
JH
61 linklibperl="-L. -lperl"
62 ;;
3c321fdc 63 aix*)
64 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
1553ab04 65 case "$osvers" in
549a6b10 66 3*) shrpldflags="$shrpldflags -e _nostart"
1553ab04 67 ;;
549a6b10 68 *) shrpldflags="$shrpldflags -b noentry"
1553ab04
TB
69 ;;
70 esac
9c839522 71 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
549a6b10 72 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
3c321fdc 73 ;;
1c7d1a19
GS
74 hpux*)
75 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
46193409 76 ;;
ac9901e0 77 os390*)
f2766b05 78 shrpldflags='-W l,dll'
ac9901e0
PP
79 linklibperl='libperl.x'
80 DPERL_EXTERNAL_GLOB=''
81 ;;
655635e8 82 esac
5cf1d1f1
JH
83 case "$ldlibpthname" in
84 '') ;;
85 *)
86 case "$osname" in
87 os2)
88 ldlibpth=''
89 ;;
5cf1d1f1
JH
90 *)
91 eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\""
92 ;;
93 esac
c1b49bc0
GS
94 # Strip off any trailing :'s
95 ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
5cf1d1f1
JH
96 ;;
97 esac
d5d19f97 98 ;;
f0efd8cf 99*) pldlflags=''
d96ebe2e 100 ;;
ecfc5424
AD
101esac
102
a0d0e21e
LW
103: Prepare dependency lists for Makefile.
104dynamic_list=' '
105for f in $dynamic_ext; do
106 : the dependency named here will never exist
ecfc5424 107 base=`echo "$f" | sed 's/.*\///'`
75f92628 108 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
a0d0e21e
LW
109done
110
111static_list=' '
a0d0e21e
LW
112for f in $static_ext; do
113 base=`echo "$f" | sed 's/.*\///'`
cd4d8a96 114 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
a0d0e21e
LW
115done
116
4318d5a0
GB
117nonxs_list=' '
118for f in $nonxs_ext; do
119 base=`echo "$f" | sed 's/.*\///'`
120 nonxs_list="$nonxs_list ext/$f/pm_to_blib"
121done
122
f1f802f7
JH
123# Handle the usage of different yaccs in posix-bc (During Configure we
124# us yacc for perly.y and byacc for a2p.y. The makefiles must use the
125# same configuration for run_byacc!):
126case "$osname" in
127 posix-bc)
128 byacc=$yacc
129 ;;
130esac
131
2304df62 132echo "Extracting Makefile (with variable substitutions)"
655635e8 133$spitshell >Makefile <<!GROK!THIS!
a0d0e21e 134# Makefile.SH
85e6fe83
LW
135# This file is derived from Makefile.SH. Any changes made here will
136# be lost the next time you run Configure.
655635e8 137# Makefile is used to generate $firstmakefile. The only difference
138# is that $firstmakefile has the dependencies filled in at the end.
2304df62 139#
fed7345c 140#
2304df62
AD
141# I now supply perly.c with the kits, so don't remake perly.c without byacc
142BYACC = $byacc
143CC = $cc
232e078e 144LD = $ld
16d20bd9 145
2304df62
AD
146LDFLAGS = $ldflags
147CLDFLAGS = $ldflags
85e6fe83 148
2304df62
AD
149mallocsrc = $mallocsrc
150mallocobj = $mallocobj
85e6fe83 151LNS = $lns
4c901d04
JH
152# NOTE: some systems don't grok "cp -f". XXX Configure test needed?
153CPS = $cp
2304df62 154RMS = rm -f
85e6fe83
LW
155ranlib = $ranlib
156
16d20bd9
AD
157# The following are mentioned only to make metaconfig include the
158# appropriate questions in Configure. If you want to change these,
8e07c86e 159# edit config.sh instead, or specify --man1dir=/wherever on
16d20bd9
AD
160# installman commandline.
161bin = $installbin
162scriptdir = $scriptdir
d96ebe2e 163shrpdir = $archlibexp/CORE
16d20bd9
AD
164privlib = $installprivlib
165man1dir = $man1dir
166man1ext = $man1ext
167man3dir = $man3dir
168man3ext = $man3ext
169
85e6fe83
LW
170# The following are used to build and install shared libraries for
171# dynamic loading.
172LDDLFLAGS = $lddlflags
3c321fdc 173SHRPLDFLAGS = $shrpldflags
85e6fe83 174CCDLFLAGS = $ccdlflags
a0d0e21e 175DLSUFFIX = .$dlext
ecfc5424 176PLDLFLAGS = $pldlflags
d96ebe2e 177LIBPERL = $libperl
d5d19f97 178LLIBPERL= $linklibperl
ecfc5424 179SHRPENV = $shrpenv
a0d0e21e 180
6ee623d5 181# The following is used to include the current directory in
5cf1d1f1 182# the dynamic loader path you are building a shared libperl.
6ee623d5
GS
183LDLIBPTH = $ldlibpth
184
a0d0e21e
LW
185dynamic_ext = $dynamic_list
186static_ext = $static_list
4318d5a0
GB
187nonxs_ext = $nonxs_list
188ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
cd4d8a96 189DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
2304df62 190
9c839522 191libs = $perllibs $cryptlib
2304df62 192
909b3858 193public = perl $suidperl utilities translators
2304df62
AD
194
195shellflags = $shellflags
196
d96ebe2e 197# This is set to MAKE=$make if your $make command doesn't
198# do it for you.
199$make_set_make
4633a7c4 200
dfe9444c 201# These variables may need to be manually set for non-Unix systems.
ccc7f9b3 202AR = $full_ar
dfe9444c
AD
203EXE_EXT = $_exe
204LIB_EXT = $_a
205OBJ_EXT = $_o
206PATH_SEP = $p_
4633a7c4
LW
207
208FIRSTMAKEFILE = $firstmakefile
209
210# Any special object files needed by this architecture, e.g. os2/os2.obj
211ARCHOBJS = $archobjs
212
89ada9f2 213.SUFFIXES: .c \$(OBJ_EXT) .i .s
cd4d8a96 214
d96ebe2e 215# grrr
216SHELL = $sh
655635e8 217
28e8609d
JH
218# how to tr(anslate) newlines
219TRNL = '$trnl'
220
82240bfc
JH
221OPTIMIZE = $optimize
222
3343e82c
JH
223EXTRAS = $extras
224
bf35c3f6
JH
225INSTALLPREFIXEXP = $prefix
226
d56c5707 227!GROK!THIS!
b7b35fc2 228# not used by Makefile but by installperl;
d56c5707
JH
229# mentioned here so that metaconfig picks these up
230# $installusrbinperl
231# $versiononly
b7b35fc2 232
2304df62 233
85e6fe83 234## In the following dollars and backticks do not need the extra backslash.
2304df62
AD
235$spitshell >>Makefile <<'!NO!SUBS!'
236
1167a30e 237CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $(LIBPERL) $@`
89ada9f2 238
1167a30e 239CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $(LIBPERL) $<`
2304df62 240
fed7345c 241private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
2304df62 242
4633a7c4
LW
243# Files to be built with variable substitution before miniperl
244# is available.
245sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
4755096e 246 makedir.SH myconfig.SH writemain.SH pod/Makefile.SH
4633a7c4 247
3ebb1980 248shextract = Makefile cflags config.h makeaperl makedepend \
4755096e 249 makedir myconfig writemain pod/Makefile
4633a7c4
LW
250
251# Files to be built with variable substitution after miniperl is
252# available. Dependencies handled manually below (for now).
2304df62 253
efb12ca0 254pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
4755096e
GS
255 pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL \
256 pod/buildtoc.PL
4633a7c4 257
4755096e 258# lib/lib.pm is not listed here because it has a rule of its own.
efb12ca0 259plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
4755096e
GS
260 pod/pod2usage pod/podchecker pod/podselect \
261 pod/buildtoc
4633a7c4 262
4755096e 263addedbyconf = UU $(shextract) $(plextract) lib/lib.pm pstruct
2304df62 264
fed7345c 265h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
a0d0e21e 266h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
6f4183fe 267h3 = opcode.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
219f41b1 268h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
4438c4b7 269h5 = utf8.h warnings.h
33b839e2 270h = $(h1) $(h2) $(h3) $(h4) $(h5)
2304df62 271
e8edd1e6 272c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
a0ed51b3 273c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c
09bef843 274c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c xsutils.c
a6ec74c1 275c4 = globals.c perlio.c perlapi.c numeric.c locale.c pp_pack.c
2304df62 276
09bef843 277c = $(c1) $(c2) $(c3) $(c4) miniperlmain.c perlmain.c
2304df62 278
e8edd1e6 279obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT)
cd4d8a96 280obj2 = 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)
a6ec74c1 281obj3 = 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) locale$(OBJ_EXT) pp_pack$(OBJ_EXT)
655635e8 282
4633a7c4 283obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
2304df62 284
a0d0e21e
LW
285# Once perl has been Configure'd and built ok you build different
286# perl variants (Debugging, Embedded, Multiplicity etc) by saying:
d96ebe2e 287# make clean; make LIBPERL=libperl<type>.a
a0d0e21e
LW
288# where <type> is some combination of 'd' and(or) 'e' or 'm'.
289# See cflags to understand how this works.
290#
d96ebe2e 291# This mechanism is getting clunky and might not even work any more.
292# EMBEDDING is on by default, and MULTIPLICITY doesn't work.
293#
a0d0e21e 294
2304df62
AD
295lintflags = -hbvxac
296
cd4d8a96 297.c$(OBJ_EXT):
d96ebe2e 298 $(CCCMD) $(PLDLFLAGS) $*.c
2304df62 299
89ada9f2
JH
300.c.i:
301 $(CCCMDSRC) -E $*.c > $*.i
302
303.c.s:
304 $(CCCMDSRC) -S $*.c
305
869a466c
JH
306.PHONY: all compile translators utilities
307
bf35c3f6 308all: $(FIRSTMAKEFILE) miniperl extra.pods $(private) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
248e23d9
GS
309 @echo " ";
310 @echo " Everything is up to date. 'make test' to run test suite."
909b3858 311
6ee623d5
GS
312compile: all
313 echo "testing compilation" > testcompile;
314 cd utils; $(MAKE) compile;
f4db5405 315 cd x2p; $(MAKE) compile;
6ee623d5
GS
316 cd pod; $(MAKE) compile;
317
909b3858 318translators: miniperl lib/Config.pm FORCE
6ee623d5 319 @echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
8e07c86e 320
4755096e 321utilities: miniperl lib/Config.pm $(plextract) lib/lib.pm FORCE
6ee623d5 322 @echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
909b3858 323
324
16d20bd9
AD
325# This is now done by installman only if you actually want the man pages.
326# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83
LW
327
328# Phony target to force checking subdirectories.
e50aee73 329# Apparently some makes require an action for the FORCE target.
869a466c 330.PHONY: FORCE
85e6fe83 331FORCE:
4633a7c4 332 @sh -c true
ac9901e0
PP
333!NO!SUBS!
334$spitshell >>Makefile <<!GROK!THIS!
85e6fe83 335
4ba7095c
JH
336# We do a copy of the op.c instead of a symlink because gcc gets huffy
337# if we have a symlink forest to another disk (it complains about too many
338# levels of symbolic links, even if we have only two)
339
ac9901e0
PP
340opmini\$(OBJ_EXT): op.c config.h
341 \$(RMS) opmini.c
342 \$(CPS) op.c opmini.c
343 \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
344 \$(RMS) opmini.c
bd0dd1d8 345
ac9901e0
PP
346!GROK!THIS!
347$spitshell >>Makefile <<'!NO!SUBS!'
517e7c64 348miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
92c28edd 349 $(CCCMD) $(PLDLFLAGS) $*.c
ecfc5424 350
92c28edd 351perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
e8827f64 352 sh writemain $(DYNALOADER) $(static_ext) > writemain.tmp
92c28edd 353 sh mv-if-diff writemain.tmp perlmain.c
85e6fe83 354
cd4d8a96 355perlmain$(OBJ_EXT): perlmain.c
92c28edd 356 $(CCCMD) $(PLDLFLAGS) $*.c
85e6fe83 357
a0d0e21e
LW
358# The file ext.libs is a list of libraries that must be linked in
359# for static extensions, e.g. -lm -lgdbm, etc. The individual
360# static extension Makefile's add to it.
fed7345c 361ext.libs: $(static_ext)
a0d0e21e 362 -@test -f ext.libs || touch ext.libs
85e6fe83 363
ecfc5424 364!NO!SUBS!
599a829f 365
d96ebe2e 366# How to build libperl. This is still rather convoluted.
599a829f 367# Load up custom Makefile.SH fragment for shared loading and executables:
8736538c 368case "$osname" in
8736538c
AS
369*)
370 Makefile_s="$osname/Makefile.SHs"
371 ;;
372esac
373
549a6b10
JH
374case "$osname" in
375aix)
376 $spitshell >>Makefile <<!GROK!THIS!
9c839522 377LIBS = $perllibs
5f9d9a17
ME
378# In AIX we need to change this for building Perl itself from
379# its earlier definition (which is for building external
380# extensions *after* Perl has been built and installed)
381CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
549a6b10
JH
382
383!GROK!THIS!
384 case "$useshrplib" in
385 define|true|[yY]*)
386 $spitshell >>Makefile <<'!NO!SUBS!'
387
388LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT)
389MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT)
390
391$(LIBPERL_NONSHR): perl$(OBJ_EXT) $(obj)
392 $(RMS) $(LIBPERL_NONSHR)
393 $(AR) rcu $(LIBPERL_NONSHR) perl$(OBJ_EXT) $(obj)
394
bd0dd1d8 395$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
a7089531
GS
396 $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
397 opmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
549a6b10
JH
398
399MINIPERLEXP = $(MINIPERL_NONSHR)
400
401LIBPERLEXPORT = perl.exp
402
403!NO!SUBS!
404
405 ;;
406 *)
407 $spitshell >>Makefile <<'!NO!SUBS!'
408MINIPERLEXP = miniperl$(EXE_EXT)
409
410PERLEXPORT = perl.exp
411
412!NO!SUBS!
413 ;;
414 esac
415 $spitshell >>Makefile <<'!NO!SUBS!'
416perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
417 ./$(MINIPERLEXP) makedef.pl PLATFORM=aix | sort -u | sort -f > perl.exp.tmp
418 sh mv-if-diff perl.exp.tmp perl.exp
419
420!NO!SUBS!
421 ;;
2c2d71f5
JH
422os2)
423 $spitshell >>Makefile <<'!NO!SUBS!'
424MINIPERLEXP = miniperl
425
426perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
427 ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) > perl.exp.tmp
428 sh mv-if-diff perl.exp.tmp perl5.def
429
430!NO!SUBS!
431 ;;
549a6b10
JH
432esac
433
8736538c
AS
434if test -r $Makefile_s ; then
435 . $Makefile_s
d96ebe2e 436 $spitshell >>Makefile <<!GROK!THIS!
cd4d8a96 437
8736538c 438Makefile: $Makefile_s
cd4d8a96 439!GROK!THIS!
440else
f0efd8cf 441 $spitshell >>Makefile <<'!NO!SUBS!'
549a6b10 442$(LIBPERL): $& perl$(OBJ_EXT) $(obj) $(LIBPERLEXPORT)
9c9e9f08 443!NO!SUBS!
d96ebe2e 444 case "$useshrplib" in
445 true)
446 $spitshell >>Makefile <<'!NO!SUBS!'
f2766b05 447 $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj)
3c321fdc 448!NO!SUBS!
449 case "$osname" in
450 aix)
451 $spitshell >>Makefile <<'!NO!SUBS!'
28e8609d 452 rm -f libperl$(OBJ_EXT)
3c321fdc 453 mv $@ libperl$(OBJ_EXT)
454 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 455!NO!SUBS!
3c321fdc 456 ;;
457 esac
d96ebe2e 458 ;;
459 *)
460 $spitshell >>Makefile <<'!NO!SUBS!'
461 rm -f $(LIBPERL)
462 $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
463 @$(ranlib) $(LIBPERL)
655635e8 464!NO!SUBS!
d96ebe2e 465 ;;
466 esac
599a829f
IZ
467 $spitshell >>Makefile <<'!NO!SUBS!'
468
469# How to build executables.
470
471# The $& notation tells Sequent machines that it can do a parallel make,
472# and is harmless otherwise.
473# The miniperl -w -MExporter line is a basic cheap test to catch errors
474# before make goes on to run preplibrary and then MakeMaker on extensions.
475# This is very handy because later errors are often caused by miniperl
476# build problems but that's not obvious to the novice.
477# The Module used here must not depend on Config or any extensions.
478
ecfb2188
GS
479!NO!SUBS!
480
481 case "${osname}${osvers}" in
535d2540 482 next4*)
ecfb2188 483 $spitshell >>Makefile <<'!NO!SUBS!'
bd0dd1d8 484miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
ecfb2188
GS
485 $(CC) -o miniperl `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
486 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
bd0dd1d8 487 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188
GS
488!NO!SUBS!
489 ;;
535d2540
JH
490 aix*)
491 $spitshell >>Makefile <<'!NO!SUBS!'
492miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
493 $(CC) -o miniperl $(CLDFLAGS) \
494 `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
495 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
496 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
497!NO!SUBS!
498 ;;
ecfb2188
GS
499 *)
500 $spitshell >>Makefile <<'!NO!SUBS!'
bd0dd1d8 501miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
93c0359c 502 -@rm -f miniperl.xok
5869b1f1 503 $(LDLIBPTH) $(CC) $(CLDFLAGS) -o miniperl \
a7089531 504 miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(LLIBPERL) $(libs)
bd0dd1d8 505 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
ecfb2188
GS
506!NO!SUBS!
507 ;;
508 esac
509
510 $spitshell >>Makefile <<'!NO!SUBS!'
599a829f 511
549a6b10 512perl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
93c0359c 513 -@rm -f miniperl.xok
51a35ef1 514 $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 515
4ae3d70a
JH
516# Purify/Quantify Perls.
517
549a6b10 518pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f2766b05 519 $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 520
549a6b10 521purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f2766b05 522 $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
dbadb36a 523
549a6b10 524quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f2766b05 525 $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 526
4ae3d70a
JH
527# Third Degree Perl (Tru64 only)
528
719561de 529perl.config.dashg:
83f0ef60
JH
530 @echo "Checking optimize='-g' in config.sh..."
531 @grep "^optimize=" config.sh
532 @grep "^optimize='-g'" config.sh >/dev/null || exit 1
4ae3d70a
JH
533
534perl.third.config: config.sh
535 @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
6e36760b 536 @$(MAKE) perl.config.dashg
83f0ef60
JH
537 @echo "Checking usemymalloc='n' in config.sh..."
538 @grep "^usemymalloc=" config.sh
539 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
170ba846 540
412c6516 541perl.third: /usr/bin/atom perl.third.config perl
15615bfd 542 atom -tool third -L. -all -gp -toolargs="-quiet -invalid -uninit heap+stack+partword+copy -min 0" perl
83f0ef60 543 @echo "Now you may run perl.third and then study perl.3log."
15615bfd 544
4ae3d70a
JH
545# Pixie Perls (Tru64 and IRIX only)
546
719561de 547perl.pixie.config: config.sh
4ae3d70a 548 @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
6e36760b 549 @$(MAKE) perl.config.dashg
4ae3d70a 550
719561de 551perl.pixie.atom: /usr/bin/atom perl
4ae3d70a
JH
552 atom -tool pixie -L. -all -toolargs="-quiet" perl
553
554perl.pixie.irix: perl
555 pixie perl
556
719561de 557perl.pixie: /usr/bin/pixie perl.pixie.config perl
4ae3d70a
JH
558 if test -x /usr/bin/atom; then \
559 $(MAKE) perl.pixie.atom; \
560 else \
561 $(MAKE) perl.pixie.irix; \
562 fi
83f0ef60
JH
563 @echo "Now you may run perl.pixie and then run pixie."
564
565# Gprof Perl
566
567perl.config.dashpg:
568 @echo "Checking optimize='-pg' in config.sh..."
569 @grep "^optimize=" config.sh
64778e5f 570 @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
83f0ef60
JH
571
572perl.gprof.config: config.sh
573 @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
574 @$(MAKE) perl.config.dashpg
575
576perl.gprof: /usr/bin/gprof perl.gprof.config
64778e5f 577 @-rm -f perl
51a35ef1 578 $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
83f0ef60 579 @echo "Now you may run perl.gprof and then run gprof perl.gprof."
4ae3d70a 580
51a35ef1
JH
581# Gcov Perl
582
583perl.config.gcov:
584 @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
585 @echo "Checking gccversion in config.sh..."
586 @grep "^gccversion=" config.sh
587 @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
588 @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
589 @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
590 @grep "^ccflags=" config.sh
591 @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
592
593perl.gcov: perl.config.gcov
594 @-rm -f perl
595 $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
596 @echo "Now you may run perl.gcov and then run gcov some.c."
597
f946bb38
JH
598# Microperl. This is just a convenience thing if one happens to
599# build also the full Perl and therefore the real big Makefile:
f4db5405 600# usually one should manually explicitly issue the below command.
f946bb38 601
869a466c 602.PHONY: microperl
f946bb38
JH
603microperl:
604 $(MAKE) -f Makefile.micro
605
2304df62
AD
606# This version, if specified in Configure, does ONLY those scripts which need
607# set-id emulation. Suidperl must be setuid root. It contains the "taint"
608# checks as well as the special code to validate that the script in question
609# has been invoked correctly.
610
549a6b10 611suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
f2766b05 612 $(SHRPENV) $(LDLIBPTH) $(CC) -o suidperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 613
599a829f
IZ
614!NO!SUBS!
615
616fi
617
618$spitshell >>Makefile <<'!NO!SUBS!'
619
bf0dfd28 620sperl$(OBJ_EXT): perl.c $(h)
2304df62 621 $(RMS) sperl.c
85e6fe83 622 $(LNS) perl.c sperl.c
d96ebe2e 623 $(CCCMD) -DIAMSUID sperl.c
2304df62
AD
624 $(RMS) sperl.c
625
fec02dd3
AD
626# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
627# test -d lib/auto || mkdir lib/auto
628#
869a466c 629.PHONY: preplibrary
aff90337 630preplibrary: miniperl lib/Config.pm lib/lib.pm lib/re.pm
cd4d8a96 631 @sh ./makedir lib/auto
a0d0e21e 632 @echo " AutoSplitting perl library"
92c28edd
JH
633 $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
634 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
2304df62 635
75f92628 636# Take care to avoid modifying lib/Config.pm without reason
f4db5405 637# (If trying to create a new port and having problems with the configpm script,
fb73857a 638# try 'make minitest' and/or commenting out the tests at the end of configpm.)
06605284 639lib/Config.pm: config.sh miniperl configpm lib/re.pm
e8827f64 640 $(LDLIBPTH) ./miniperl configpm configpm.tmp
92c28edd 641 sh mv-if-diff configpm.tmp $@
2304df62 642
92c28edd 643lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
e8827f64 644 $(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
92c28edd 645 sh mv-if-diff minimod.tmp $@
fed7345c 646
92c28edd 647lib/re.pm: ext/re/re.pm
42c30c63 648 @-rm -f $@
92c28edd 649 cat ext/re/re.pm > $@
7cfc0d09 650
06605284 651$(plextract): miniperl lib/Config.pm
42c30c63 652 @-rm -f $@
92c28edd 653 $(LDLIBPTH) ./miniperl -Ilib $@.PL
72b3d9b4 654
4755096e 655lib/lib.pm: miniperl lib/Config.pm
42c30c63 656 @-rm -f $@
4755096e
GS
657 $(LDLIBPTH) ./miniperl -Ilib lib/lib_pm.PL
658
b1a1e9f1 659extra.pods: miniperl
fec93702 660 -@test -f extra.pods && rm -f `cat extra.pods`
72b3d9b4 661 -@rm -f extra.pods
b4bc034f 662 -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
72b3d9b4 663 nx=`echo $$x | sed -e "s/README\.//"`; \
40096396 664 cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
72b3d9b4
GS
665 echo "pod/perl"$$nx".pod" >> extra.pods ; \
666 done
bf35c3f6 667 -@rm -f pod/perlvms.pod
40096396 668 -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
72b3d9b4 669
a40613e1
JH
670extras.make: perl
671 -@test -s extras.lst && $(LDLIBPTH) PATH=`pwd`:${PATH} PERL5LIB=`pwd`/lib ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
bf35c3f6 672
a40613e1
JH
673extras.test: perl
674 -@test -s extras.lst && $(LDLIBPTH) PATH=`pwd`:${PATH} PERL5LIB=`pwd`/lib ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
bf35c3f6 675
a40613e1
JH
676extras.install: perl
677 -@test -s extras.lst && $(LDLIBPTH) PATH=`pwd`:${PATH} PERL5LIB=`pwd`/lib ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
bf35c3f6 678
869a466c
JH
679.PHONY: install install-strip install-all install-verbose install-silent \
680 no-install install.perl install.man installman install.html installhtml
681
f556e5b9
JH
682install-strip:
683 $(MAKE) STRIPFLAGS=-s install
684
adbebc0b 685install install-all:
c458b76c 686 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS)
c77385cf 687
4ad019ef
A
688install-verbose:
689 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V
c458b76c 690
4ad019ef 691install-silent:
8d0b2130 692 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S
4ad019ef
A
693
694no-install:
695 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n
16d20bd9 696
bf35c3f6 697install.perl: all installperl
6ee623d5
GS
698 if [ -n "$(COMPILE)" ]; \
699 then \
700 cd utils; $(MAKE) compile; \
701 cd ../x2p; $(MAKE) compile; \
702 cd ../pod; $(MAKE) compile; \
83673e1f 703 else :; \
6ee623d5 704 fi
c77385cf 705 $(LDLIBPTH) ./perl installperl $(INSTALLFLAGS) $(STRIPFLAGS)
bf35c3f6 706 $(MAKE) extras.install
a0d0e21e 707
b1a1e9f1 708install.man: all installman
c77385cf 709 $(LDLIBPTH) ./perl installman $(INSTALLFLAGS)
16d20bd9 710
84902520
TB
711# XXX Experimental. Hardwired values, but useful for testing.
712# Eventually Configure could ask for some of these values.
713install.html: all installhtml
40096396 714 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
6ee623d5 715 $(LDLIBPTH) ./perl installhtml \
84902520
TB
716 --podroot=. --podpath=. --recurse \
717 --htmldir=$(privlib)/html \
718 --htmlroot=$(privlib)/html \
719 --splithead=pod/perlipc \
720 --splititem=pod/perlfunc \
721 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
722 --verbose
723
16d20bd9 724
a0d0e21e 725# I now supply perly.c with the kits, so the following section is
56febc5e
AD
726# used only if you force byacc to run by saying
727# make run_byacc
728# Since we patch up the byacc output, the perly.fixer script needs
729# to run with precisely the same version of byacc as I use. You
730# normally shouldn't remake perly.[ch].
731
869a466c
JH
732.PHONY: check_byacc run_byacc
733
001465dc
JH
734check_byacc:
735 @$(BYACC) -V 2>&1 | grep 'version 1\.8\.2'
736
737run_byacc: FORCE check_byacc
56febc5e 738 $(BYACC) -d perly.y
cecd0ad1 739 -chmod 664 perly.c perly.h
56febc5e 740 sh $(shellflags) ./perly.fixer y.tab.c perly.c
55497cff 741 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
742 -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
ebb99254 743 sed -e '/^extern YYSTYPE yy/D' y.tab.h >yh.tmp && mv yh.tmp y.tab.h
55497cff 744 cmp -s y.tab.h perly.h && rm -f y.tab.h || mv y.tab.h perly.h
f4db5405 745 perl -i perlyline.pl perly.c
fb73857a 746 chmod 664 vms/perly_c.vms vms/perly_h.vms
747 perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
56febc5e
AD
748
749# We don't want to regenerate perly.c and perly.h, but they might
750# appear out-of-date after a patch is applied or a new distribution is
751# made.
92c28edd 752perly.c: perly.y
b233458b
JH
753 -@sh -c true
754
92c28edd 755perly.h: perly.y
b233458b
JH
756 -@sh -c true
757
9fec149b
JH
758PERLYVMS = vms/perly_c.vms vms/perly_h.vms
759
760$(PERLYVMS): perly.c perly.h vms/vms_yfix.pl
761 perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
762
bd656b61 763# No compat3.sym here since and including the 5.004_50.
e4d5a464 764# No interp.sym since 5.005_03.
22c35a8c 765SYM = global.sym globvar.sym perlio.sym pp.sym
419eaf7b 766
22c35a8c 767SYMH = perlvars.h intrpvar.h thrdvar.h
419eaf7b 768
dae78bb1
IZ
769CHMOD_W = chmod +w
770
a8581515 771# The following files are generated automatically
c83f8f39
JH
772# keywords.pl: keywords.h
773# opcode.pl: opcode.h opnames.h pp_proto.h pp.sym
774# [* embed.pl needs pp.sym generated by opcode.pl! *]
775# embed.pl: proto.h embed.h embedvar.h global.sym objXSUB.h
776# perlapi.h perlapi.c pod/perlintern.pod
777# pod/perlapi.pod
778# bytecode.pl: ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c
779# ext/B/B/Asmdata.pm
780# regcomp.pl: regnodes.h
781# warnings.pl: warnings.h lib/warnings.pm
e50aee73
AD
782# The correct versions should be already supplied with the perl kit,
783# in case you don't have perl available.
e1354ed6 784# To force them to be regenerated, type
e50aee73 785# make regen_headers
e1354ed6 786
9fec149b
JH
787keywords.h: keywords.pl
788 -perl keywords.pl
789
5bab1179
NC
790OPCODE_PL_OUTPUT = opcode.h opnames.h pp_proto.h pp.sym
791
792$(OPCODE_PL_OUTPUT): opcode.pl
9fec149b
JH
793 -perl opcode.pl
794
5bab1179
NC
795# Really the prerequisites for the next rule should only be "embed.pl pp.sym"
796# Writing it this way gives make a big hint to always run opcode.pl before
797# embed.pl. The alternative - running embed.pl then opcode.pl causes embed.pl
798# to be re-run next make invocation, and then all object files get recompiled.
799
800proto.h embed.h embedvar.h global.sym objXSUB.h perlapi.h perlapi.c pod/perlintern.pod pod/perlapi.pod: embed.pl $(OPCODE_PL_OUTPUT)
9fec149b
JH
801 -perl embed.pl
802
803ext/ByteLoader/byterun.h ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm: bytecode.pl
804 -perl bytecode.pl
805
806regnodes.h: regcomp.pl
807 -perl regcomp.pl
808
809warnings.h lib/warnings.pm: warnings.pl
810 -perl warnings.pl
811
b4d4469a
JH
812AUTOGEN_FILES = keywords.h opcode.h opnames.h pp_proto.h pp.sym proto.h \
813 embed.h embedvar.h global.sym \
814 pod/perlintern.pod pod/perlapi.pod \
c83f8f39
JH
815 objXSUB.h perlapi.h perlapi.c ext/ByteLoader/byterun.h \
816 ext/ByteLoader/byterun.c ext/B/B/Asmdata.pm regnodes.h \
817 warnings.h lib/warnings.pm
e1354ed6 818
869a466c
JH
819.PHONY: regen_headers regen_pods regen_all
820
e50aee73 821regen_headers: FORCE
b4d4469a
JH
822 -$(CHMOD_W) $(AUTOGEN_FILES)
823 -perl keywords.pl
824 -perl opcode.pl
825 -perl embed.pl
826 -perl bytecode.pl
827 -perl regcomp.pl
828 -perl warnings.pl
8e07c86e 829
4755096e
GS
830regen_pods: FORCE
831 -cd pod; $(LDLIBPTH) make regen_pods
832
9fec149b
JH
833regen_all: $(PERLYVMS) regen_headers regen_pods
834
a0d0e21e 835# Extensions:
4318d5a0
GB
836# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
837# automatically get built. There should ordinarily be no need to change
838# any of this part of makefile.
a0d0e21e
LW
839#
840# The dummy dependency is a place holder in case $(dynamic_ext) or
841# $(static_ext) is empty.
842#
843# DynaLoader may be needed for extensions that use Makefile.PL.
844
845$(DYNALOADER): miniperl preplibrary FORCE
92c28edd 846 @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e
LW
847
848d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
1475152f 849 @-rm -f lib/re.pm
dc3d4a49 850 @cat ext/re/re.pm > lib/re.pm
92c28edd 851 @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e
LW
852
853s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
1475152f 854 @-rm -f lib/re.pm
dc3d4a49 855 @cat ext/re/re.pm > lib/re.pm
92c28edd 856 @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
2304df62 857
4318d5a0 858n_dummy $(nonxs_ext): miniperl preplibrary $(DYNALOADER) FORCE
92c28edd 859 @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
4318d5a0 860
869a466c
JH
861.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
862 realclean _realcleaner clobber _clobber \
863 distclean veryclean _verycleaner
864
17b893d8 865clean: _tidy _mopup
70af249b 866
2edbd6da 867realclean: _realcleaner _mopup
4e2a5f63 868 @echo "Note that make realclean does not delete config.sh or Policy.sh"
70af249b 869
b37ebb13 870_clobber:
5440bc8e 871 -@rm -f Cross/run-* Cross/to-* Cross/from-*
bf35c3f6 872 rm -f config.sh cppstdin Policy.sh extras.lst
b37ebb13
JH
873
874clobber: _realcleaner _mopup _clobber
70af249b
CS
875
876distclean: clobber
877
2edbd6da 878# Like distclean but also removes emacs backups and *.orig.
b37ebb13
JH
879veryclean: _verycleaner _mopup _clobber
880 -@rm -f Obsolete Wanted
2edbd6da 881
70af249b
CS
882# Do not 'make _mopup' directly.
883_mopup:
cd4d8a96 884 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
72b3d9b4 885 -@test -f extra.pods && rm -f `cat extra.pods`
b4bc034f 886 -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
ac83e8b0 887 -rm -f perl.exp ext.libs extra.pods opmini.o
d96ebe2e 888 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
1cfa4ec7 889 -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
9d4d067b 890 -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
6a966751 891 -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
93c0359c 892 -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
e708dd94 893 rm -f perl suidperl miniperl $(LIBPERL) libperl.* microperl
70af249b
CS
894
895# Do not 'make _tidy' directly.
896_tidy:
e3f83878
JH
897 -cd pod; $(LDLIBPTH) $(MAKE) clean
898 -cd utils; $(LDLIBPTH) $(MAKE) clean
899 -cd x2p; $(LDLIBPTH) $(MAKE) clean
4318d5a0 900 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
e3f83878 901 $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
a0d0e21e 902 done
6ee623d5 903 rm -f testcompile compilelog
ff68c719 904
2edbd6da 905_cleaner1:
4633a7c4 906 -cd os2; rm -f Makefile
2edbd6da
JH
907 -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
908 -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
909 -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
4318d5a0 910 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
2edbd6da 911 $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
a0d0e21e 912 done
2edbd6da
JH
913
914_cleaner2:
9fba8746 915 rm -f core core.*perl.*.? *perl.core t/core t/core.perl.*.? t/*perl.core t/misctmp* t/forktmp* t/tmp* t/c t/perl t/rantests .?*.c so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
a0d0e21e 916 rm -rf $(addedbyconf)
cd4d8a96 917 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
fed7345c 918 rm -f $(private)
a0d0e21e 919 rm -rf lib/auto
07a6e20d 920 rm -f lib/.exists lib/*/.exists lib/*/*/.exists
16d20bd9 921 rm -f h2ph.man pstruct
a0d0e21e 922 rm -rf .config
6ee623d5 923 rm -f testcompile compilelog
b82b1de5 924 -rmdir lib/B lib/Data lib/Digest lib/Encode lib/IO/Socket lib/IO lib/Filter/Util lib/List lib/MIME lib/PerlIO lib/Scalar lib/Sys lib/Thread lib/XS
ecfc5424 925
f4db5405 926_realcleaner:
2edbd6da
JH
927 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
928 @$(LDLIBPTH) $(MAKE) _cleaner2
929
f4db5405 930_verycleaner:
2edbd6da
JH
931 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
932 @$(LDLIBPTH) $(MAKE) _cleaner2
c94787a5 933 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
2edbd6da 934
2304df62
AD
935# The following lint has practically everything turned on. Unfortunately,
936# you have to wade through a lot of mumbo jumbo that can't be suppressed.
937# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
938# for that spot.
939
869a466c 940.PHONY: lint
bf0dfd28 941lint: $(c)
2304df62
AD
942 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
943
fb73857a 944# Need to unset during recursion to go out of loop.
945# The README below ensures that the dependency list is never empty and
946# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 947
84902520 948MAKEDEPEND = Makefile makedepend
cd4d8a96 949
fb73857a 950$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 951 $(MAKE) depend MAKEDEPEND=
a0d0e21e 952
599a829f 953config.h: config_h.SH config.sh
655635e8 954 $(SHELL) config_h.SH
955
a0d0e21e 956# When done, touch perlmain.c so that it doesn't get remade each time.
869a466c 957.PHONY: depend
2304df62 958depend: makedepend
fb73857a 959 sh ./makedepend MAKE=$(MAKE)
a0d0e21e 960 - test -s perlmain.c && touch perlmain.c
2304df62
AD
961 cd x2p; $(MAKE) depend
962
cd4d8a96 963# Cannot postpone this until $firstmakefile is ready ;-)
92c28edd
JH
964makedepend: makedepend.SH config.sh
965 sh ./makedepend.SH
cd4d8a96 966
1167a30e 967.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
869a466c
JH
968 test_tty test-tty _test_tty test_notty test-notty _test_notty \
969 utest ucheck test.utf8 check.utf8 \
970 test.third check.third utest.third ucheck.third test_notty.third \
971 test.deparse test_notty.deparse \
972 minitest
973
ec861bc1
JH
974# Cannot delegate rebuilding of t/perl to make
975# to allow interlaced test and minitest
3e3baf6d 976
1167a30e
IZ
977TESTFILE=TEST
978
979_test_prep:
ec861bc1 980 cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
3e3baf6d 981
1167a30e
IZ
982# Architecture-neutral stuff:
983
984test_prep_pre: preplibrary utilities $(nonxs_ext)
985
986test_prep: test_prep_pre miniperl ./perl$(EXE_EXT) $(dynamic_ext) $(TEST_PERL_DLL)
5fe84fd2 987 PERL=./perl $(MAKE) _test_prep
ec861bc1 988
5fe84fd2 989_test_tty:
1167a30e 990 cd t && $(LDLIBPTH) $(PERL_DEBUG) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
ec861bc1 991
5fe84fd2 992_test_notty:
1167a30e 993 cd t && $(LDLIBPTH) $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(PERL) $(TESTFILE) $(TEST_ARGS)
ec861bc1
JH
994
995# The second branch is for testing without a tty or controlling terminal,
996# see t/op/stat.t
997_test:
994e9bc0 998 if (true </dev/tty) >/dev/null 2>&1; then \
1167a30e 999 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty ; \
994e9bc0 1000 else \
1167a30e 1001 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
994e9bc0 1002 fi
3d8f1d64 1003 @echo "Ran tests" > t/rantests
a0ed51b3 1004
937aca76 1005test check: test_prep
ec861bc1
JH
1006 PERL=./perl $(MAKE) _test
1007
937aca76 1008test_tty: test_prep
5fe84fd2 1009 PERL=./perl $(MAKE) _test_tty
ec861bc1 1010
937aca76 1011test_notty: test_prep
5fe84fd2 1012 PERL=./perl $(MAKE) _test_notty
ec861bc1 1013
83f0ef60 1014utest ucheck test.utf8 check.utf8: test_prep
35117553 1015 PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1016
48a293f8 1017test-prep: test_prep
5fe84fd2
JH
1018
1019test-tty: test_tty
1020
1021test-notty: test_notty
1022
ec861bc1
JH
1023# Targets for Third Degree testing.
1024
1167a30e 1025test_prep.third: test_prep perl.third perl.third$(EXE_EXT)
5fe84fd2 1026 PERL=./perl.third $(MAKE) _test_prep
ec861bc1 1027
937aca76 1028test.third check.third: test_prep.third perl.third
ec861bc1
JH
1029 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1030
937aca76 1031utest.third ucheck.third: test_prep.third perl.third
35117553 1032 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
ec861bc1 1033
937aca76 1034test_notty.third: test_prep.third perl.third
5fe84fd2 1035 PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
2304df62 1036
35117553
JH
1037# Targets for Deparse testing.
1038
1039test.deparse: test_prep
1040 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1041
1042test_notty.deparse: test_prep
1043 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1044
d96ebe2e 1045# Can't depend on lib/Config.pm because that might be where miniperl
1046# is crashing.
a35c6d74 1047minitest: miniperl lib/re.pm
d96ebe2e 1048 @echo "You may see some irrelevant test failures if you have been unable"
1049 @echo "to build lib/Config.pm."
cd4d8a96 1050 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
aabd84f8 1051 && $(LDLIBPTH) ./perl TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t </dev/tty
16d20bd9 1052
1167a30e
IZ
1053# Test via harness
1054
1055test_harness: test_prep
1056 PERL=./perl $(MAKE) TESTFILE=harness _test
1057
fb73857a 1058# Handy way to run perlbug -ok without having to install and run the
84902520 1059# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 1060# Please *don't* use this unless all tests pass.
1d2dff63 1061# If you want to report test failures, use "make nok" instead.
869a466c
JH
1062
1063.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1064
188cd53f 1065ok: utilities
92c28edd 1066 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 1067
105f9295 1068okfile: utilities
92c28edd 1069 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 1070
890b8eb0
NC
1071oknack: utilities
1072 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1073
1074okfilenack: utilities
1075 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1076
1d2dff63 1077nok: utilities
92c28edd 1078 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 1079
b4e8cfaf
GS
1080nokfile: utilities
1081 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1082
890b8eb0
NC
1083noknack: utilities
1084 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1085
1086nokfilenack: utilities
1087 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1088
869a466c
JH
1089.PHONY: clist hlist shlist pllist
1090
85e6fe83 1091clist: $(c)
92c28edd 1092 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 1093
85e6fe83 1094hlist: $(h)
92c28edd 1095 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 1096
85e6fe83 1097shlist: $(sh)
92c28edd 1098 echo $(sh) | tr ' ' $(TRNL) >.shlist
2304df62 1099
4633a7c4 1100pllist: $(pl)
92c28edd 1101 echo $(pl) | tr ' ' $(TRNL) >.pllist
4633a7c4 1102
92c28edd
JH
1103Makefile: Makefile.SH ./config.sh
1104 $(SHELL) Makefile.SH
760ac839 1105
869a466c 1106.PHONY: distcheck
599a829f 1107distcheck: FORCE
760ac839
LW
1108 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1109
869a466c 1110.PHONY: elc
771c4874
IZ
1111elc: emacs/cperl-mode.elc
1112
1113emacs/cperl-mode.elc: emacs/cperl-mode.el
1114 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1115
869a466c
JH
1116.PHONY: etags ctags tags
1117
d6a255e6
IZ
1118etags: TAGS
1119
1120TAGS: emacs/cperl-mode.elc
3ee700d1 1121 sh emacs/ptags
01e22528 1122
d6a255e6
IZ
1123ctags: tags
1124
1125# Let's hope make will not go into an infinite loop on case-unsensitive systems
1126# This may also fail if . is in the head of the path, since perl will
1127# require -Ilib
1128tags: TAGS
1129 perl emacs/e2ctags.pl TAGS > tags
3ee700d1 1130
2304df62
AD
1131# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1132# If this runs make out of memory, delete /usr/include lines.
1133!NO!SUBS!
1134
85e6fe83 1135$eunicefix Makefile
2304df62
AD
1136case `pwd` in
1137*SH)
85e6fe83 1138 $rm -f ../Makefile
cd4d8a96 1139 $ln Makefile ../Makefile
2304df62
AD
1140 ;;
1141esac
cd4d8a96 1142$rm -f $firstmakefile
5ff3f7a4
GS
1143
1144# Now do any special processing required before building.
1145
1146case "$ebcdic" in
1147$define)
1148 xxx=''
1149 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
7a66b286 1150case "$osname" in
25e9a2e3 1151os390|posix-bc)
5ff3f7a4 1152 rm -f y.tab.c y.tab.h
e9d08790 1153 # yacc must be a reentrant ("pure") Bison in BS2000 Posix!
5ff3f7a4
GS
1154 yacc -d perly.y >/dev/null 2>&1
1155 if cmp -s y.tab.c perly.c; then
1156 rm -f y.tab.c
1157 else
1158 echo "perly.y -> perly.c" >&2
1159 mv -f y.tab.c perly.c
1160 chmod u+w perly.c
c8dba6f3
GS
1161 sed -e '/^#include "perl\.h"/a\
1162\
1163#define yydebug PL_yydebug\
1164#define yynerrs PL_yynerrs\
1165#define yyerrflag PL_yyerrflag\
1166#define yychar PL_yychar\
c8dba6f3
GS
1167#define yyval PL_yyval\
1168#define yylval PL_yylval' \
1169 -e '/YYSTYPE *yyval;/D' \
1170 -e '/YYSTYPE *yylval;/D' \
1171 -e '/int yychar,/,/yynerrs;/D' \
1172 -e 's/int yydebug = 0;/yydebug = 0;/' \
1173 -e 's/[^_]realloc(/PerlMem_realloc(/g' \
1174 -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
5ff3f7a4
GS
1175 -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
1176 xxx="$xxx perly.c"
1177 fi
1178 if cmp -s y.tab.h perly.h; then
1179 rm -f y.tab.h
1180 else
1181 echo "perly.y -> perly.h" >&2
1182 mv -f y.tab.h perly.h
1183 xxx="$xxx perly.h"
1184 fi
e9d08790 1185 if cd x2p
5ff3f7a4 1186 then
e9d08790 1187 rm -f y.tab.c y.tab.h
5928ee40
JH
1188 case "$osname" in
1189 posix-bc)
1190 # we are using two different yaccs in BS2000 Posix!
1191 byacc a2p.y >/dev/null 2>&1
1192 ;;
1193 *) # e.g. os390
1194 yacc a2p.y >/dev/null 2>&1
1195 ;;
1196 esac
e9d08790
JH
1197 if cmp -s y.tab.c a2p.c
1198 then
1199 rm -f y.tab.c
1200 else
1201 echo "a2p.y -> a2p.c" >&2
1202 mv -f y.tab.c a2p.c
1203 chmod u+w a2p.c
1204 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
f1f802f7 1205 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
e9d08790
JH
1206 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1207 xxx="$xxx a2p.c"
1208 fi
1209 # In case somebody yacc -d:ed the a2p.y.
1210 if test -f y.tab.h
1211 then
1212 if cmp -s y.tab.h a2p.h
1213 then
1214 rm -f y.tab.h
1215 else
1216 echo "a2p.h -> a2p.h" >&2
1217 mv -f y.tab.h a2p.h
1218 xxx="$xxx a2p.h"
1219 fi
1220 fi
1221 cd ..
5ff3f7a4 1222 fi
7a66b286
JH
1223 ;;
1224vmesa)
1225 # Do nothing in VM/ESA.
1226 ;;
aa34f189 1227*)
e9d08790 1228 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 1229 ;;
fe572743 1230esac
5ff3f7a4
GS
1231 case "$xxx" in
1232 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1233 esac
1234 ;;
1235esac
1236