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