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