additions to Thread.pm docs from Tuomas J. Lukka
[p5sagit/p5-mst-13.2.git] / Makefile.SH
CommitLineData
599a829f 1#! /bin/sh
2000072c 2case $CONFIGDOTSH in
2304df62 3'')
4 if test -f config.sh; then TOP=.;
5 elif test -f ../config.sh; then TOP=..;
6 elif test -f ../../config.sh; then TOP=../..;
7 elif test -f ../../../config.sh; then TOP=../../..;
8 elif test -f ../../../../config.sh; then TOP=../../../..;
9 else
10 echo "Can't find config.sh."; exit 1
11 fi
12 . $TOP/config.sh
13 ;;
14esac
15: This forces SH files to create target in same directory as SH file.
16: This is so that make depend always knows where to find SH derivatives.
17case "$0" in
18*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
19esac
20
2304df62 21case "$d_dosuid" in
22*define*) suidperl='suidperl' ;;
23*) suidperl='';;
24esac
25
d5d19f97 26linklibperl='$(LIBPERL)'
3c321fdc 27shrpldflags='$(LDDLFLAGS)'
6ee623d5 28ldlibpth=''
d96ebe2e 29case "$useshrplib" in
30true)
6ee623d5 31 # Prefix all runs of 'miniperl' and 'perl' with
32 # $ldlibpth so that ./perl finds *this* libperl.so.
33 ldlibpth="LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH"
34
d5d19f97 35 pldlflags="$cccdlflags"
f0efd8cf 36 # NeXT-4 specific stuff. Can't we do this in the hint file?
d96ebe2e 37 case "${osname}${osvers}" in
38 next4*)
3c321fdc 39 ld=libtool
40 lddlflags="-dynamic -undefined warning -framework System \
41 -compatibility_version 1 -current_version $patchlevel \
42 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
6ee623d5 43 # NeXT uses a different name.
44 ldlibpth="DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH"
45 ;;
8f1f23e8 46 rhapsody*)
47 ldlibpth="DYLD_LIBRARY_PATH=`pwd`/Perl:$DYLD_LIBRARY_PATH"
48 ;;
6ee623d5 49 os2*) # OS/2 doesn't need anything special for LD_LIBRARY_PATH.
50 ldlibpth=''
d96ebe2e 51 ;;
73d40b3e 52 sunos*)
d5d19f97 53 linklibperl="-lperl"
54 ;;
73d40b3e 55 netbsd*|freebsd[234]*)
099685bc 56 linklibperl="-L. -lperl"
57 ;;
3c321fdc 58 aix*)
59 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
1553ab04 60 case "$osvers" in
61 3*)
62 shrpldflags="$shrpldflags -e _nostart $ldflags $libs $cryptlib"
63 ;;
64 *)
65 shrpldflags="$shrpldflags -b noentry $ldflags $libs $cryptlib"
66 ;;
67 esac
3c321fdc 68 aixinstdir=`pwd | sed 's/\/UU$//'`
69 linklibperl="-L $archlibexp/CORE -L $aixinstdir -lperl"
70 ;;
1c7d1a19 71 hpux*)
72 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
73 ldlibpth="SHLIB_PATH=`pwd`:${SHLIB_PATH}"
fb73857a 74 ;;
46193409 75 beos*) ldlibpth="LIBRARY_PATH=`pwd`:$LIBRARY_PATH"
76 ;;
655635e8 77 esac
d5d19f97 78 ;;
f0efd8cf 79*) pldlflags=''
d96ebe2e 80 ;;
ecfc5424 81esac
82
a0d0e21e 83: Prepare dependency lists for Makefile.
84dynamic_list=' '
85for f in $dynamic_ext; do
86 : the dependency named here will never exist
ecfc5424 87 base=`echo "$f" | sed 's/.*\///'`
75f92628 88 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
a0d0e21e 89done
90
91static_list=' '
a0d0e21e 92for f in $static_ext; do
93 base=`echo "$f" | sed 's/.*\///'`
cd4d8a96 94 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
a0d0e21e 95done
96
4318d5a0 97nonxs_list=' '
98for f in $nonxs_ext; do
99 base=`echo "$f" | sed 's/.*\///'`
100 nonxs_list="$nonxs_list ext/$f/pm_to_blib"
101done
102
2304df62 103echo "Extracting Makefile (with variable substitutions)"
655635e8 104$spitshell >Makefile <<!GROK!THIS!
a0d0e21e 105# Makefile.SH
85e6fe83 106# This file is derived from Makefile.SH. Any changes made here will
107# be lost the next time you run Configure.
655635e8 108# Makefile is used to generate $firstmakefile. The only difference
109# is that $firstmakefile has the dependencies filled in at the end.
2304df62 110#
fed7345c 111#
2304df62 112# I now supply perly.c with the kits, so don't remake perly.c without byacc
113BYACC = $byacc
114CC = $cc
232e078e 115LD = $ld
16d20bd9 116
2304df62 117LDFLAGS = $ldflags
118CLDFLAGS = $ldflags
85e6fe83 119
2304df62 120SMALL = $small
121LARGE = $large $split
122mallocsrc = $mallocsrc
123mallocobj = $mallocobj
85e6fe83 124LNS = $lns
2304df62 125RMS = rm -f
85e6fe83 126ranlib = $ranlib
127
16d20bd9 128# The following are mentioned only to make metaconfig include the
129# appropriate questions in Configure. If you want to change these,
8e07c86e 130# edit config.sh instead, or specify --man1dir=/wherever on
16d20bd9 131# installman commandline.
132bin = $installbin
133scriptdir = $scriptdir
d96ebe2e 134shrpdir = $archlibexp/CORE
16d20bd9 135privlib = $installprivlib
136man1dir = $man1dir
137man1ext = $man1ext
138man3dir = $man3dir
139man3ext = $man3ext
140
85e6fe83 141# The following are used to build and install shared libraries for
142# dynamic loading.
143LDDLFLAGS = $lddlflags
3c321fdc 144SHRPLDFLAGS = $shrpldflags
85e6fe83 145CCDLFLAGS = $ccdlflags
a0d0e21e 146DLSUFFIX = .$dlext
ecfc5424 147PLDLFLAGS = $pldlflags
d96ebe2e 148LIBPERL = $libperl
d5d19f97 149LLIBPERL= $linklibperl
ecfc5424 150SHRPENV = $shrpenv
a0d0e21e 151
6ee623d5 152# The following is used to include the current directory in
153# LD_LIBRARY_PATH if you are building a shared libperl.so.
154LDLIBPTH = $ldlibpth
155
a0d0e21e 156dynamic_ext = $dynamic_list
157static_ext = $static_list
4318d5a0 158nonxs_ext = $nonxs_list
159ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
cd4d8a96 160DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
2304df62 161
162libs = $libs $cryptlib
163
909b3858 164public = perl $suidperl utilities translators
2304df62 165
166shellflags = $shellflags
167
d96ebe2e 168# This is set to MAKE=$make if your $make command doesn't
169# do it for you.
170$make_set_make
4633a7c4 171
dfe9444c 172# These variables may need to be manually set for non-Unix systems.
ccc7f9b3 173AR = $full_ar
dfe9444c 174EXE_EXT = $_exe
175LIB_EXT = $_a
176OBJ_EXT = $_o
177PATH_SEP = $p_
4633a7c4 178
179FIRSTMAKEFILE = $firstmakefile
180
181# Any special object files needed by this architecture, e.g. os2/os2.obj
182ARCHOBJS = $archobjs
183
cd4d8a96 184.SUFFIXES: .c \$(OBJ_EXT)
185
d96ebe2e 186# grrr
187SHELL = $sh
655635e8 188
28e8609d 189# how to tr(anslate) newlines
190TRNL = '$trnl'
191
2304df62 192!GROK!THIS!
193
85e6fe83 194## In the following dollars and backticks do not need the extra backslash.
2304df62 195$spitshell >>Makefile <<'!NO!SUBS!'
196
d96ebe2e 197CCCMD = `sh $(shellflags) cflags $(LIBPERL) $@`
2304df62 198
fed7345c 199private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
2304df62 200
4633a7c4 201# Files to be built with variable substitution before miniperl
202# is available.
203sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
204 makedir.SH perl_exp.SH writemain.SH
205
206shextract = Makefile cflags config.h makeaperl makedepend \
655635e8 207 makedir perl.exp writemain
4633a7c4 208
209# Files to be built with variable substitution after miniperl is
210# available. Dependencies handled manually below (for now).
2304df62 211
efb12ca0 212pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL \
213 pod/pod2usage.PL pod/podchecker.PL pod/podselect.PL
4633a7c4 214
efb12ca0 215plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text \
216 pod/pod2usage pod/podchecker pod/podselect
4633a7c4 217
218addedbyconf = UU $(shextract) $(plextract) pstruct
2304df62 219
fed7345c 220h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
a0d0e21e 221h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
2304df62 222h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
219f41b1 223h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
599cee73 224h5 = bytecode.h byterun.h utf8.h warning.h
33b839e2 225h = $(h1) $(h2) $(h3) $(h4) $(h5)
2304df62 226
33b839e2 227c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c byterun.c
a0ed51b3 228c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c
760ac839 229c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c globals.c perlio.c
2304df62 230
a0d0e21e 231c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
2304df62 232
33b839e2 233obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) byterun$(OBJ_EXT)
cd4d8a96 234obj2 = 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)
a0ed51b3 235obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT)
655635e8 236
4633a7c4 237obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
2304df62 238
a0d0e21e 239# Once perl has been Configure'd and built ok you build different
240# perl variants (Debugging, Embedded, Multiplicity etc) by saying:
d96ebe2e 241# make clean; make LIBPERL=libperl<type>.a
a0d0e21e 242# where <type> is some combination of 'd' and(or) 'e' or 'm'.
243# See cflags to understand how this works.
244#
d96ebe2e 245# This mechanism is getting clunky and might not even work any more.
246# EMBEDDING is on by default, and MULTIPLICITY doesn't work.
247#
a0d0e21e 248
2304df62 249lintflags = -hbvxac
250
cd4d8a96 251.c$(OBJ_EXT):
d96ebe2e 252 $(CCCMD) $(PLDLFLAGS) $*.c
2304df62 253
4318d5a0 254all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext) $(nonxs_ext)
248e23d9 255 @echo " ";
256 @echo " Everything is up to date. 'make test' to run test suite."
909b3858 257
6ee623d5 258compile: all
259 echo "testing compilation" > testcompile;
260 cd utils; $(MAKE) compile;
261 cd x2p; $(MAKE) compile;
262 cd pod; $(MAKE) compile;
263
909b3858 264translators: miniperl lib/Config.pm FORCE
6ee623d5 265 @echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
8e07c86e 266
909b3858 267utilities: miniperl lib/Config.pm FORCE
6ee623d5 268 @echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
909b3858 269
270
16d20bd9 271# This is now done by installman only if you actually want the man pages.
272# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83 273
274# Phony target to force checking subdirectories.
e50aee73 275# Apparently some makes require an action for the FORCE target.
85e6fe83 276FORCE:
4633a7c4 277 @sh -c true
85e6fe83 278
cd4d8a96 279miniperlmain$(OBJ_EXT): miniperlmain.c
d96ebe2e 280 $(CCCMD) $(PLDLFLAGS) $*.c
ecfc5424 281
655635e8 282perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
e8827f64 283 sh writemain $(DYNALOADER) $(static_ext) > writemain.tmp
284 sh mv-if-diff writemain.tmp perlmain.c
85e6fe83 285
cd4d8a96 286perlmain$(OBJ_EXT): perlmain.c
d96ebe2e 287 $(CCCMD) $(PLDLFLAGS) $*.c
85e6fe83 288
a0d0e21e 289# The file ext.libs is a list of libraries that must be linked in
290# for static extensions, e.g. -lm -lgdbm, etc. The individual
291# static extension Makefile's add to it.
fed7345c 292ext.libs: $(static_ext)
a0d0e21e 293 -@test -f ext.libs || touch ext.libs
85e6fe83 294
ecfc5424 295!NO!SUBS!
599a829f 296
d96ebe2e 297# How to build libperl. This is still rather convoluted.
599a829f 298# Load up custom Makefile.SH fragment for shared loading and executables:
d96ebe2e 299if test -r $osname/Makefile.SHs ; then
300 . $osname/Makefile.SHs
301 $spitshell >>Makefile <<!GROK!THIS!
cd4d8a96 302
303Makefile: $osname/Makefile.SHs
cd4d8a96 304!GROK!THIS!
305else
f0efd8cf 306 $spitshell >>Makefile <<'!NO!SUBS!'
9c9e9f08 307$(LIBPERL): $& perl$(OBJ_EXT) $(obj)
308!NO!SUBS!
d96ebe2e 309 case "$useshrplib" in
310 true)
311 $spitshell >>Makefile <<'!NO!SUBS!'
3c321fdc 312 $(LD) $(SHRPLDFLAGS) -o $@ perl$(OBJ_EXT) $(obj)
313!NO!SUBS!
314 case "$osname" in
315 aix)
316 $spitshell >>Makefile <<'!NO!SUBS!'
28e8609d 317 rm -f libperl$(OBJ_EXT)
3c321fdc 318 mv $@ libperl$(OBJ_EXT)
319 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 320!NO!SUBS!
3c321fdc 321 ;;
322 esac
d96ebe2e 323 ;;
324 *)
325 $spitshell >>Makefile <<'!NO!SUBS!'
326 rm -f $(LIBPERL)
327 $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
328 @$(ranlib) $(LIBPERL)
655635e8 329!NO!SUBS!
d96ebe2e 330 ;;
331 esac
599a829f 332 $spitshell >>Makefile <<'!NO!SUBS!'
333
334# How to build executables.
335
336# The $& notation tells Sequent machines that it can do a parallel make,
337# and is harmless otherwise.
338# The miniperl -w -MExporter line is a basic cheap test to catch errors
339# before make goes on to run preplibrary and then MakeMaker on extensions.
340# This is very handy because later errors are often caused by miniperl
341# build problems but that's not obvious to the novice.
342# The Module used here must not depend on Config or any extensions.
343
344miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)
6ee623d5 345 $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL) $(libs)
bfc6b1eb 346 $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
599a829f 347
348perl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 349 $(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 350
351pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 352 $(SHRPENV) $(LDLIBPTH) purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 353
dbadb36a 354purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 355 $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
dbadb36a 356
599a829f 357quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 358 $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 359
360# This version, if specified in Configure, does ONLY those scripts which need
361# set-id emulation. Suidperl must be setuid root. It contains the "taint"
362# checks as well as the special code to validate that the script in question
363# has been invoked correctly.
364
d96ebe2e 365suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 366 $(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 367
599a829f 368!NO!SUBS!
369
370fi
371
372$spitshell >>Makefile <<'!NO!SUBS!'
373
cd4d8a96 374sperl$(OBJ_EXT): perl.c perly.h patchlevel.h $(h)
2304df62 375 $(RMS) sperl.c
85e6fe83 376 $(LNS) perl.c sperl.c
d96ebe2e 377 $(CCCMD) -DIAMSUID sperl.c
2304df62 378 $(RMS) sperl.c
379
fec02dd3 380# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
381# test -d lib/auto || mkdir lib/auto
382#
4633a7c4 383preplibrary: miniperl lib/Config.pm $(plextract)
cd4d8a96 384 @sh ./makedir lib/auto
a0d0e21e 385 @echo " AutoSplitting perl library"
bfc6b1eb 386 $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
a0d0e21e 387 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
2304df62 388
75f92628 389# Take care to avoid modifying lib/Config.pm without reason
fb73857a 390# (If trying to create a new port and having problems with the configpm script,
391# try 'make minitest' and/or commenting out the tests at the end of configpm.)
655635e8 392lib/Config.pm: config.sh miniperl configpm
e8827f64 393 $(LDLIBPTH) ./miniperl configpm configpm.tmp
394 sh mv-if-diff configpm.tmp $@
2304df62 395
37120919 396lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
e8827f64 397 $(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
398 sh mv-if-diff minimod.tmp $@
fed7345c 399
56953603 400lib/re.pm: ext/re/re.pm
ceb0239c 401 rm -f $@
56953603 402 cat ext/re/re.pm > $@
403
404$(plextract): miniperl lib/Config.pm lib/re.pm
474d7bc5 405 $(LDLIBPTH) ./miniperl -Ilib $@.PL
6ee623d5 406
16d20bd9 407install: all install.perl install.man
408
cd4d8a96 409install.perl: all installperl
6ee623d5 410 if [ -n "$(COMPILE)" ]; \
411 then \
412 cd utils; $(MAKE) compile; \
413 cd ../x2p; $(MAKE) compile; \
414 cd ../pod; $(MAKE) compile; \
83673e1f 415 else :; \
6ee623d5 416 fi
417 $(LDLIBPTH) ./perl installperl
a0d0e21e 418
cd4d8a96 419install.man: all installman
6ee623d5 420 $(LDLIBPTH) ./perl installman
16d20bd9 421
84902520 422# XXX Experimental. Hardwired values, but useful for testing.
423# Eventually Configure could ask for some of these values.
424install.html: all installhtml
6ee623d5 425 $(LDLIBPTH) ./perl installhtml \
84902520 426 --podroot=. --podpath=. --recurse \
427 --htmldir=$(privlib)/html \
428 --htmlroot=$(privlib)/html \
429 --splithead=pod/perlipc \
430 --splititem=pod/perlfunc \
431 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
432 --verbose
433
16d20bd9 434
a0d0e21e 435# I now supply perly.c with the kits, so the following section is
56febc5e 436# used only if you force byacc to run by saying
437# make run_byacc
438# Since we patch up the byacc output, the perly.fixer script needs
439# to run with precisely the same version of byacc as I use. You
440# normally shouldn't remake perly.[ch].
441
232e078e 442run_byacc: FORCE
28757baa 443 @ echo 'Expect' 113 shift/reduce and 1 reduce/reduce conflict
56febc5e 444 $(BYACC) -d perly.y
fb73857a 445 chmod 664 perly.c
56febc5e 446 sh $(shellflags) ./perly.fixer y.tab.c perly.c
55497cff 447 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
448 -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
ebb99254 449 sed -e '/^extern YYSTYPE yy/D' y.tab.h >yh.tmp && mv yh.tmp y.tab.h
55497cff 450 cmp -s y.tab.h perly.h && rm -f y.tab.h || mv y.tab.h perly.h
fb73857a 451 chmod 664 vms/perly_c.vms vms/perly_h.vms
452 perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
56febc5e 453
454# We don't want to regenerate perly.c and perly.h, but they might
455# appear out-of-date after a patch is applied or a new distribution is
456# made.
457perly.c: perly.y
cd4d8a96 458 -@sh -c true
56febc5e 459
460perly.h: perly.y
cd4d8a96 461 -@sh -c true
a0d0e21e 462
bd656b61 463# No compat3.sym here since and including the 5.004_50.
e4d5a464 464# No interp.sym since 5.005_03.
22c35a8c 465SYM = global.sym globvar.sym perlio.sym pp.sym
419eaf7b 466
22c35a8c 467SYMH = perlvars.h intrpvar.h thrdvar.h
419eaf7b 468
a8581515 469# The following files are generated automatically
e50aee73 470# keywords.h: keywords.pl
471# opcode.h: opcode.pl
22c35a8c 472# pp_proto.h: opcode.pl
473# pp.sym: opcode.pl
474# embed.h: embed.pl [* needs pp.sym generated by opcode.pl! *]
475# embedvar.h: embed.pl [* needs pp.sym generated by opcode.pl! *]
a8581515 476# byterun.h: bytecode.pl
477# byterun.c: bytecode.pl
478# lib/B/Asmdata.pm: bytecode.pl
d09b2d29 479# regnodes.h: regcomp.pl
599cee73 480# warning.h lib/warning.pm: warning.pl
e50aee73 481# The correct versions should be already supplied with the perl kit,
482# in case you don't have perl available.
483# To force them to run, type
484# make regen_headers
485regen_headers: FORCE
486 perl keywords.pl
487 perl opcode.pl
488 perl embed.pl
a8581515 489 perl bytecode.pl
d09b2d29 490 perl regcomp.pl
599cee73 491 perl warning.pl
8e07c86e 492
a0d0e21e 493# Extensions:
4318d5a0 494# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
495# automatically get built. There should ordinarily be no need to change
496# any of this part of makefile.
a0d0e21e 497#
498# The dummy dependency is a place holder in case $(dynamic_ext) or
499# $(static_ext) is empty.
500#
501# DynaLoader may be needed for extensions that use Makefile.PL.
502
503$(DYNALOADER): miniperl preplibrary FORCE
6ee623d5 504 @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 505
506d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
6ee623d5 507 @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e 508
509s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
6ee623d5 510 @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
2304df62 511
4318d5a0 512n_dummy $(nonxs_ext): miniperl preplibrary $(DYNALOADER) FORCE
513 @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
514
17b893d8 515clean: _tidy _mopup
70af249b 516
517realclean: _cleaner _mopup
4e2a5f63 518 @echo "Note that make realclean does not delete config.sh or Policy.sh"
70af249b 519
520clobber: _cleaner _mopup
4e2a5f63 521 rm -f config.sh cppstdin Policy.sh
70af249b 522
523distclean: clobber
524
525# Do not 'make _mopup' directly.
526_mopup:
cd4d8a96 527 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
fed7345c 528 rm -f perl.exp ext.libs
d96ebe2e 529 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
1cfa4ec7 530 -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
70af249b 531 rm -f perl suidperl miniperl $(LIBPERL)
532
533# Do not 'make _tidy' directly.
534_tidy:
e3f83878 535 -cd pod; $(LDLIBPTH) $(MAKE) clean
536 -cd utils; $(LDLIBPTH) $(MAKE) clean
537 -cd x2p; $(LDLIBPTH) $(MAKE) clean
4318d5a0 538 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
e3f83878 539 $(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
a0d0e21e 540 done
6ee623d5 541 rm -f testcompile compilelog
ff68c719 542
543# Do not 'make _cleaner' directly.
544_cleaner:
4633a7c4 545 -cd os2; rm -f Makefile
e3f83878 546 -cd pod; $(LDLIBPTH) $(MAKE) realclean
547 -cd utils; $(LDLIBPTH) $(MAKE) realclean
548 -cd x2p; $(LDLIBPTH) $(MAKE) realclean
4318d5a0 549 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
e3f83878 550 $(LDLIBPTH) sh ext/util/make_ext realclean $$x MAKE=$(MAKE) ; \
a0d0e21e 551 done
8544a514 552 rm -f *.orig */*.orig *~ */*~ core core.perl.*.? core.miniperl.*.? perl.core miniperl.core t/core t/core.perl.*.? t/perl.core t/tmp???? t/c t/perl so_locations t/nonexistent1
a0d0e21e 553 rm -rf $(addedbyconf)
cd4d8a96 554 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
fed7345c 555 rm -f $(private)
a0d0e21e 556 rm -rf lib/auto
181ea953 557 rm -f lib/.exists lib/*/.exists
16d20bd9 558 rm -f h2ph.man pstruct
a0d0e21e 559 rm -rf .config
6ee623d5 560 rm -f testcompile compilelog
ecfc5424 561
2304df62 562# The following lint has practically everything turned on. Unfortunately,
563# you have to wade through a lot of mumbo jumbo that can't be suppressed.
564# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
565# for that spot.
566
567lint: perly.c $(c)
568 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
569
fb73857a 570# Need to unset during recursion to go out of loop.
571# The README below ensures that the dependency list is never empty and
572# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 573
84902520 574MAKEDEPEND = Makefile makedepend
cd4d8a96 575
fb73857a 576$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 577 $(MAKE) depend MAKEDEPEND=
a0d0e21e 578
599a829f 579config.h: config_h.SH config.sh
655635e8 580 $(SHELL) config_h.SH
581
419eaf7b 582# This is an AIXism.
583perl.exp: perl_exp.SH config.sh $(SYM) $(SYMH)
655635e8 584 $(SHELL) perl_exp.SH
75f92628 585
a0d0e21e 586# When done, touch perlmain.c so that it doesn't get remade each time.
2304df62 587depend: makedepend
fb73857a 588 sh ./makedepend MAKE=$(MAKE)
a0d0e21e 589 - test -s perlmain.c && touch perlmain.c
2304df62 590 cd x2p; $(MAKE) depend
591
cd4d8a96 592# Cannot postpone this until $firstmakefile is ready ;-)
593makedepend: makedepend.SH config.sh
594 sh ./makedepend.SH
595
4318d5a0 596test-prep: miniperl perl preplibrary utilities $(dynamic_ext) $(nonxs_ext)
3e3baf6d 597 cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT))
598
994e9bc0 599# Second branch is for testing without a tty or controling terminal.
600# See t/op/stat.t
3e3baf6d 601test check: test-prep
994e9bc0 602 if (true </dev/tty) >/dev/null 2>&1; then \
603 cd t && $(LDLIBPTH) ./perl TEST </dev/tty; \
604 else \
605 cd t && PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) ./perl TEST; \
606 fi
3e3baf6d 607
a0ed51b3 608utest ucheck: test-prep
994e9bc0 609 if (true </dev/tty) >/dev/null 2>&1; then \
610 cd t && $(LDLIBPTH) ./perl UTEST </dev/tty; \
611 else \
612 cd t && PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) ./perl UTEST; \
613 fi
a0ed51b3 614
3e3baf6d 615# For testing without a tty or controling terminal. See t/op/stat.t
616test-notty: test-prep
6ee623d5 617 cd t && PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) ./perl TEST
2304df62 618
d96ebe2e 619# Can't depend on lib/Config.pm because that might be where miniperl
620# is crashing.
a35c6d74 621minitest: miniperl lib/re.pm
d96ebe2e 622 @echo "You may see some irrelevant test failures if you have been unable"
623 @echo "to build lib/Config.pm."
cd4d8a96 624 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
6ee623d5 625 && $(LDLIBPTH) ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t </dev/tty
16d20bd9 626
fb73857a 627# Handy way to run perlbug -ok without having to install and run the
84902520 628# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 629# Please *don't* use this unless all tests pass.
1d2dff63 630# If you want to report test failures, use "make nok" instead.
188cd53f 631ok: utilities
39fa2da7 632 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 633
105f9295 634okfile: utilities
39fa2da7 635 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
105f9295 636
1d2dff63 637nok: utilities
39fa2da7 638 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1d2dff63 639
85e6fe83 640clist: $(c)
28e8609d 641 echo $(c) | tr ' ' $(TRNL) >.clist
2304df62 642
85e6fe83 643hlist: $(h)
28e8609d 644 echo $(h) | tr ' ' $(TRNL) >.hlist
2304df62 645
85e6fe83 646shlist: $(sh)
28e8609d 647 echo $(sh) | tr ' ' $(TRNL) >.shlist
2304df62 648
4633a7c4 649pllist: $(pl)
28e8609d 650 echo $(pl) | tr ' ' $(TRNL) >.pllist
4633a7c4 651
599a829f 652Makefile: Makefile.SH ./config.sh
760ac839 653 $(SHELL) Makefile.SH
654
599a829f 655distcheck: FORCE
760ac839 656 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
657
771c4874 658elc: emacs/cperl-mode.elc
659
660emacs/cperl-mode.elc: emacs/cperl-mode.el
661 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
662
663etags: emacs/cperl-mode.elc
3ee700d1 664 sh emacs/ptags
01e22528 665 perl emacs/e2ctags.pl TAGS > tags
666
667ctags: etags
3ee700d1 668
2304df62 669# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
670# If this runs make out of memory, delete /usr/include lines.
671!NO!SUBS!
672
85e6fe83 673$eunicefix Makefile
2304df62 674case `pwd` in
675*SH)
85e6fe83 676 $rm -f ../Makefile
cd4d8a96 677 $ln Makefile ../Makefile
2304df62 678 ;;
679esac
cd4d8a96 680$rm -f $firstmakefile
5ff3f7a4 681
682# Now do any special processing required before building.
683
684case "$ebcdic" in
685$define)
686 xxx=''
687 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
7a66b286 688case "$osname" in
25e9a2e3 689os390|posix-bc)
5ff3f7a4 690 rm -f y.tab.c y.tab.h
e9d08790 691 # yacc must be a reentrant ("pure") Bison in BS2000 Posix!
5ff3f7a4 692 yacc -d perly.y >/dev/null 2>&1
693 if cmp -s y.tab.c perly.c; then
694 rm -f y.tab.c
695 else
696 echo "perly.y -> perly.c" >&2
697 mv -f y.tab.c perly.c
698 chmod u+w perly.c
c8dba6f3 699 sed -e '/^#include "perl\.h"/a\
700\
701#define yydebug PL_yydebug\
702#define yynerrs PL_yynerrs\
703#define yyerrflag PL_yyerrflag\
704#define yychar PL_yychar\
c8dba6f3 705#define yyval PL_yyval\
706#define yylval PL_yylval' \
707 -e '/YYSTYPE *yyval;/D' \
708 -e '/YYSTYPE *yylval;/D' \
709 -e '/int yychar,/,/yynerrs;/D' \
710 -e 's/int yydebug = 0;/yydebug = 0;/' \
711 -e 's/[^_]realloc(/PerlMem_realloc(/g' \
712 -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
5ff3f7a4 713 -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
714 xxx="$xxx perly.c"
715 fi
716 if cmp -s y.tab.h perly.h; then
717 rm -f y.tab.h
718 else
719 echo "perly.y -> perly.h" >&2
720 mv -f y.tab.h perly.h
721 xxx="$xxx perly.h"
722 fi
e9d08790 723 if cd x2p
5ff3f7a4 724 then
e9d08790 725 rm -f y.tab.c y.tab.h
5928ee40 726 case "$osname" in
727 posix-bc)
728 # we are using two different yaccs in BS2000 Posix!
729 byacc a2p.y >/dev/null 2>&1
730 ;;
731 *) # e.g. os390
732 yacc a2p.y >/dev/null 2>&1
733 ;;
734 esac
e9d08790 735 if cmp -s y.tab.c a2p.c
736 then
737 rm -f y.tab.c
738 else
739 echo "a2p.y -> a2p.c" >&2
740 mv -f y.tab.c a2p.c
741 chmod u+w a2p.c
742 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
743 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
744 xxx="$xxx a2p.c"
745 fi
746 # In case somebody yacc -d:ed the a2p.y.
747 if test -f y.tab.h
748 then
749 if cmp -s y.tab.h a2p.h
750 then
751 rm -f y.tab.h
752 else
753 echo "a2p.h -> a2p.h" >&2
754 mv -f y.tab.h a2p.h
755 xxx="$xxx a2p.h"
756 fi
757 fi
758 cd ..
5ff3f7a4 759 fi
7a66b286 760 ;;
761vmesa)
762 # Do nothing in VM/ESA.
763 ;;
aa34f189 764*)
e9d08790 765 echo "'$osname' is an EBCDIC system I don't know that well." >&4
aa34f189 766 ;;
fe572743 767esac
5ff3f7a4 768 case "$xxx" in
769 '') echo "No parser files were regenerated. That's okay." >&2 ;;
770 esac
771 ;;
772esac
773