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