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