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