This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid temporaries on recursion
[perl5.git] / Makefile.SH
CommitLineData
599a829f 1#! /bin/sh
2304df62
AD
2case $CONFIG in
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
AD
21case "$d_dosuid" in
22*define*) suidperl='suidperl' ;;
23*) suidperl='';;
24esac
25
d5d19f97 26linklibperl='$(LIBPERL)'
3c321fdc 27shrpldflags='$(LDDLFLAGS)'
6ee623d5 28ldlibpth=''
d96ebe2e
PP
29case "$useshrplib" in
30true)
6ee623d5
GS
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
PP
37 case "${osname}${osvers}" in
38 next4*)
3c321fdc
PP
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
GS
43 # NeXT uses a different name.
44 ldlibpth="DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH"
45 ;;
46 os2*) # OS/2 doesn't need anything special for LD_LIBRARY_PATH.
47 ldlibpth=''
d96ebe2e 48 ;;
dec5cd44 49 sunos*|freebsd[23]*|netbsd*)
d5d19f97
UP
50 linklibperl="-lperl"
51 ;;
3c321fdc
PP
52 aix*)
53 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
1553ab04
TB
54 case "$osvers" in
55 3*)
56 shrpldflags="$shrpldflags -e _nostart $ldflags $libs $cryptlib"
57 ;;
58 *)
59 shrpldflags="$shrpldflags -b noentry $ldflags $libs $cryptlib"
60 ;;
61 esac
3c321fdc
PP
62 aixinstdir=`pwd | sed 's/\/UU$//'`
63 linklibperl="-L $archlibexp/CORE -L $aixinstdir -lperl"
64 ;;
fb73857a
PP
65 hpux10*)
66 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+b$archlibexp/CORE -lperl"
67 ;;
655635e8 68 esac
d5d19f97 69 ;;
f0efd8cf 70*) pldlflags=''
d96ebe2e 71 ;;
ecfc5424
AD
72esac
73
a0d0e21e
LW
74: Prepare dependency lists for Makefile.
75dynamic_list=' '
76for f in $dynamic_ext; do
77 : the dependency named here will never exist
ecfc5424 78 base=`echo "$f" | sed 's/.*\///'`
75f92628 79 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
a0d0e21e
LW
80done
81
82static_list=' '
a0d0e21e
LW
83for f in $static_ext; do
84 base=`echo "$f" | sed 's/.*\///'`
cd4d8a96 85 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
a0d0e21e
LW
86done
87
4318d5a0
GB
88nonxs_list=' '
89for f in $nonxs_ext; do
90 base=`echo "$f" | sed 's/.*\///'`
91 nonxs_list="$nonxs_list ext/$f/pm_to_blib"
92done
93
2304df62 94echo "Extracting Makefile (with variable substitutions)"
655635e8 95$spitshell >Makefile <<!GROK!THIS!
a0d0e21e 96# Makefile.SH
85e6fe83
LW
97# This file is derived from Makefile.SH. Any changes made here will
98# be lost the next time you run Configure.
655635e8
PP
99# Makefile is used to generate $firstmakefile. The only difference
100# is that $firstmakefile has the dependencies filled in at the end.
2304df62 101#
fed7345c 102#
2304df62
AD
103# I now supply perly.c with the kits, so don't remake perly.c without byacc
104BYACC = $byacc
105CC = $cc
232e078e 106LD = $ld
16d20bd9 107
2304df62
AD
108LDFLAGS = $ldflags
109CLDFLAGS = $ldflags
85e6fe83 110
2304df62
AD
111SMALL = $small
112LARGE = $large $split
113mallocsrc = $mallocsrc
114mallocobj = $mallocobj
85e6fe83 115LNS = $lns
2304df62 116RMS = rm -f
85e6fe83
LW
117ranlib = $ranlib
118
16d20bd9
AD
119# The following are mentioned only to make metaconfig include the
120# appropriate questions in Configure. If you want to change these,
8e07c86e 121# edit config.sh instead, or specify --man1dir=/wherever on
16d20bd9
AD
122# installman commandline.
123bin = $installbin
124scriptdir = $scriptdir
d96ebe2e 125shrpdir = $archlibexp/CORE
16d20bd9
AD
126privlib = $installprivlib
127man1dir = $man1dir
128man1ext = $man1ext
129man3dir = $man3dir
130man3ext = $man3ext
131
85e6fe83
LW
132# The following are used to build and install shared libraries for
133# dynamic loading.
134LDDLFLAGS = $lddlflags
3c321fdc 135SHRPLDFLAGS = $shrpldflags
85e6fe83 136CCDLFLAGS = $ccdlflags
a0d0e21e 137DLSUFFIX = .$dlext
ecfc5424 138PLDLFLAGS = $pldlflags
d96ebe2e 139LIBPERL = $libperl
d5d19f97 140LLIBPERL= $linklibperl
ecfc5424 141SHRPENV = $shrpenv
a0d0e21e 142
6ee623d5
GS
143# The following is used to include the current directory in
144# LD_LIBRARY_PATH if you are building a shared libperl.so.
145LDLIBPTH = $ldlibpth
146
a0d0e21e
LW
147dynamic_ext = $dynamic_list
148static_ext = $static_list
4318d5a0
GB
149nonxs_ext = $nonxs_list
150ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
cd4d8a96 151DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
2304df62
AD
152
153libs = $libs $cryptlib
154
909b3858 155public = perl $suidperl utilities translators
2304df62
AD
156
157shellflags = $shellflags
158
d96ebe2e
PP
159# This is set to MAKE=$make if your $make command doesn't
160# do it for you.
161$make_set_make
4633a7c4 162
dfe9444c 163# These variables may need to be manually set for non-Unix systems.
4633a7c4 164AR = $ar
dfe9444c
AD
165EXE_EXT = $_exe
166LIB_EXT = $_a
167OBJ_EXT = $_o
168PATH_SEP = $p_
4633a7c4
LW
169
170FIRSTMAKEFILE = $firstmakefile
171
172# Any special object files needed by this architecture, e.g. os2/os2.obj
173ARCHOBJS = $archobjs
174
cd4d8a96
PP
175.SUFFIXES: .c \$(OBJ_EXT)
176
d96ebe2e
PP
177# grrr
178SHELL = $sh
655635e8 179
2304df62
AD
180!GROK!THIS!
181
85e6fe83 182## In the following dollars and backticks do not need the extra backslash.
2304df62
AD
183$spitshell >>Makefile <<'!NO!SUBS!'
184
d96ebe2e 185CCCMD = `sh $(shellflags) cflags $(LIBPERL) $@`
2304df62 186
fed7345c 187private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
2304df62 188
4633a7c4
LW
189# Files to be built with variable substitution before miniperl
190# is available.
191sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
192 makedir.SH perl_exp.SH writemain.SH
193
194shextract = Makefile cflags config.h makeaperl makedepend \
655635e8 195 makedir perl.exp writemain
4633a7c4
LW
196
197# Files to be built with variable substitution after miniperl is
198# available. Dependencies handled manually below (for now).
2304df62 199
909b3858 200pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL
4633a7c4 201
909b3858 202plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text
4633a7c4
LW
203
204addedbyconf = UU $(shextract) $(plextract) pstruct
2304df62 205
fed7345c 206h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
a0d0e21e 207h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
2304df62 208h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
12ca11f6 209h4 = regexp.h scope.h sv.h unixish.h util.h perlio.h thread.h
33b839e2
MB
210h5 = bytecode.h byterun.h
211h = $(h1) $(h2) $(h3) $(h4) $(h5)
2304df62 212
33b839e2 213c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c byterun.c
a0d0e21e 214c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
760ac839 215c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c globals.c perlio.c
2304df62 216
a0d0e21e 217c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
2304df62 218
33b839e2 219obj1 = $(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 220obj2 = 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)
760ac839 221obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT)
655635e8 222
4633a7c4 223obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
2304df62 224
a0d0e21e
LW
225# Once perl has been Configure'd and built ok you build different
226# perl variants (Debugging, Embedded, Multiplicity etc) by saying:
d96ebe2e 227# make clean; make LIBPERL=libperl<type>.a
a0d0e21e
LW
228# where <type> is some combination of 'd' and(or) 'e' or 'm'.
229# See cflags to understand how this works.
230#
d96ebe2e
PP
231# This mechanism is getting clunky and might not even work any more.
232# EMBEDDING is on by default, and MULTIPLICITY doesn't work.
233#
a0d0e21e 234
2304df62
AD
235lintflags = -hbvxac
236
cd4d8a96 237.c$(OBJ_EXT):
d96ebe2e 238 $(CCCMD) $(PLDLFLAGS) $*.c
2304df62 239
4318d5a0 240all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext) $(nonxs_ext)
909b3858
PP
241 @echo " "; echo " Everything is up to date."
242
6ee623d5
GS
243compile: all
244 echo "testing compilation" > testcompile;
245 cd utils; $(MAKE) compile;
246 cd x2p; $(MAKE) compile;
247 cd pod; $(MAKE) compile;
248
909b3858 249translators: miniperl lib/Config.pm FORCE
6ee623d5 250 @echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
8e07c86e 251
909b3858 252utilities: miniperl lib/Config.pm FORCE
6ee623d5 253 @echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
909b3858
PP
254
255
16d20bd9
AD
256# This is now done by installman only if you actually want the man pages.
257# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
85e6fe83
LW
258
259# Phony target to force checking subdirectories.
e50aee73 260# Apparently some makes require an action for the FORCE target.
85e6fe83 261FORCE:
4633a7c4 262 @sh -c true
85e6fe83 263
cd4d8a96 264miniperlmain$(OBJ_EXT): miniperlmain.c
d96ebe2e 265 $(CCCMD) $(PLDLFLAGS) $*.c
ecfc5424 266
655635e8 267perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
a0d0e21e
LW
268 sh writemain $(DYNALOADER) $(static_ext) > tmp
269 sh mv-if-diff tmp perlmain.c
85e6fe83 270
cd4d8a96 271perlmain$(OBJ_EXT): perlmain.c
d96ebe2e 272 $(CCCMD) $(PLDLFLAGS) $*.c
85e6fe83 273
a0d0e21e
LW
274# The file ext.libs is a list of libraries that must be linked in
275# for static extensions, e.g. -lm -lgdbm, etc. The individual
276# static extension Makefile's add to it.
fed7345c 277ext.libs: $(static_ext)
a0d0e21e 278 -@test -f ext.libs || touch ext.libs
85e6fe83 279
ecfc5424 280!NO!SUBS!
599a829f 281
d96ebe2e 282# How to build libperl. This is still rather convoluted.
599a829f 283# Load up custom Makefile.SH fragment for shared loading and executables:
d96ebe2e
PP
284if test -r $osname/Makefile.SHs ; then
285 . $osname/Makefile.SHs
286 $spitshell >>Makefile <<!GROK!THIS!
cd4d8a96
PP
287
288Makefile: $osname/Makefile.SHs
cd4d8a96
PP
289!GROK!THIS!
290else
f0efd8cf 291 $spitshell >>Makefile <<'!NO!SUBS!'
9c9e9f08
PP
292$(LIBPERL): $& perl$(OBJ_EXT) $(obj)
293!NO!SUBS!
d96ebe2e
PP
294 case "$useshrplib" in
295 true)
296 $spitshell >>Makefile <<'!NO!SUBS!'
3c321fdc
PP
297 $(LD) $(SHRPLDFLAGS) -o $@ perl$(OBJ_EXT) $(obj)
298!NO!SUBS!
299 case "$osname" in
300 aix)
301 $spitshell >>Makefile <<'!NO!SUBS!'
302 mv $@ libperl$(OBJ_EXT)
303 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
ecfc5424 304!NO!SUBS!
3c321fdc
PP
305 ;;
306 esac
d96ebe2e
PP
307 ;;
308 *)
309 $spitshell >>Makefile <<'!NO!SUBS!'
310 rm -f $(LIBPERL)
311 $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
312 @$(ranlib) $(LIBPERL)
655635e8 313!NO!SUBS!
d96ebe2e
PP
314 ;;
315 esac
599a829f
IZ
316 $spitshell >>Makefile <<'!NO!SUBS!'
317
318# How to build executables.
319
320# The $& notation tells Sequent machines that it can do a parallel make,
321# and is harmless otherwise.
322# The miniperl -w -MExporter line is a basic cheap test to catch errors
323# before make goes on to run preplibrary and then MakeMaker on extensions.
324# This is very handy because later errors are often caused by miniperl
325# build problems but that's not obvious to the novice.
326# The Module used here must not depend on Config or any extensions.
327
328miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)
6ee623d5
GS
329 $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL) $(libs)
330 @ $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
599a829f
IZ
331
332perl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 333 $(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f
IZ
334
335pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 336 $(SHRPENV) $(LDLIBPTH) purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
599a829f 337
dbadb36a 338purecovperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 339 $(SHRPENV) $(LDLIBPTH) purecov $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o purecovperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
dbadb36a 340
599a829f 341quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 342 $(SHRPENV) $(LDLIBPTH) quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62
AD
343
344# This version, if specified in Configure, does ONLY those scripts which need
345# set-id emulation. Suidperl must be setuid root. It contains the "taint"
346# checks as well as the special code to validate that the script in question
347# has been invoked correctly.
348
d96ebe2e 349suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
6ee623d5 350 $(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
2304df62 351
599a829f
IZ
352!NO!SUBS!
353
354fi
355
356$spitshell >>Makefile <<'!NO!SUBS!'
357
cd4d8a96 358sperl$(OBJ_EXT): perl.c perly.h patchlevel.h $(h)
2304df62 359 $(RMS) sperl.c
85e6fe83 360 $(LNS) perl.c sperl.c
d96ebe2e 361 $(CCCMD) -DIAMSUID sperl.c
2304df62
AD
362 $(RMS) sperl.c
363
fec02dd3
AD
364# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
365# test -d lib/auto || mkdir lib/auto
366#
4633a7c4 367preplibrary: miniperl lib/Config.pm $(plextract)
cd4d8a96 368 @sh ./makedir lib/auto
a0d0e21e 369 @echo " AutoSplitting perl library"
6ee623d5 370 @$(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
a0d0e21e 371 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
2304df62 372
75f92628 373# Take care to avoid modifying lib/Config.pm without reason
fb73857a
PP
374# (If trying to create a new port and having problems with the configpm script,
375# try 'make minitest' and/or commenting out the tests at the end of configpm.)
655635e8 376lib/Config.pm: config.sh miniperl configpm
6ee623d5 377 $(LDLIBPTH) ./miniperl configpm tmp
75f92628 378 sh mv-if-diff tmp lib/Config.pm
2304df62 379
37120919 380lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
6ee623d5 381 $(LDLIBPTH) ./miniperl minimod.pl > tmp && mv tmp $@
fed7345c 382
4633a7c4 383$(plextract): miniperl lib/Config.pm
474d7bc5 384 $(LDLIBPTH) ./miniperl -Ilib $@.PL
6ee623d5 385
16d20bd9
AD
386install: all install.perl install.man
387
cd4d8a96 388install.perl: all installperl
6ee623d5
GS
389 if [ -n "$(COMPILE)" ]; \
390 then \
391 cd utils; $(MAKE) compile; \
392 cd ../x2p; $(MAKE) compile; \
393 cd ../pod; $(MAKE) compile; \
394 fi
395 $(LDLIBPTH) ./perl installperl
a0d0e21e 396
cd4d8a96 397install.man: all installman
6ee623d5 398 $(LDLIBPTH) ./perl installman
16d20bd9 399
84902520
TB
400# XXX Experimental. Hardwired values, but useful for testing.
401# Eventually Configure could ask for some of these values.
402install.html: all installhtml
6ee623d5 403 $(LDLIBPTH) ./perl installhtml \
84902520
TB
404 --podroot=. --podpath=. --recurse \
405 --htmldir=$(privlib)/html \
406 --htmlroot=$(privlib)/html \
407 --splithead=pod/perlipc \
408 --splititem=pod/perlfunc \
409 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
410 --verbose
411
16d20bd9 412
a0d0e21e 413# I now supply perly.c with the kits, so the following section is
56febc5e
AD
414# used only if you force byacc to run by saying
415# make run_byacc
416# Since we patch up the byacc output, the perly.fixer script needs
417# to run with precisely the same version of byacc as I use. You
418# normally shouldn't remake perly.[ch].
419
232e078e 420run_byacc: FORCE
28757baa 421 @ echo 'Expect' 113 shift/reduce and 1 reduce/reduce conflict
56febc5e 422 $(BYACC) -d perly.y
fb73857a 423 chmod 664 perly.c
56febc5e 424 sh $(shellflags) ./perly.fixer y.tab.c perly.c
55497cff
PP
425 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
426 -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
427 echo 'extern YYSTYPE yylval;' >>y.tab.h
428 cmp -s y.tab.h perly.h && rm -f y.tab.h || mv y.tab.h perly.h
fb73857a
PP
429 chmod 664 vms/perly_c.vms vms/perly_h.vms
430 perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
56febc5e
AD
431
432# We don't want to regenerate perly.c and perly.h, but they might
433# appear out-of-date after a patch is applied or a new distribution is
434# made.
435perly.c: perly.y
cd4d8a96 436 -@sh -c true
56febc5e
AD
437
438perly.h: perly.y
cd4d8a96 439 -@sh -c true
a0d0e21e 440
bd656b61
JH
441# No compat3.sym here since and including the 5.004_50.
442SYM = global.sym interp.sym perlio.sym thread.sym
419eaf7b
JH
443
444SYMH = perlvars.h thrdvar.h
445
a8581515 446# The following files are generated automatically
e50aee73
AD
447# keywords.h: keywords.pl
448# opcode.h: opcode.pl
449# embed.h: embed.pl global.sym interp.sym
a8581515
MB
450# byterun.h: bytecode.pl
451# byterun.c: bytecode.pl
452# lib/B/Asmdata.pm: bytecode.pl
e50aee73
AD
453# The correct versions should be already supplied with the perl kit,
454# in case you don't have perl available.
455# To force them to run, type
456# make regen_headers
457regen_headers: FORCE
458 perl keywords.pl
459 perl opcode.pl
460 perl embed.pl
a8581515 461 perl bytecode.pl
8e07c86e 462
a0d0e21e 463# Extensions:
4318d5a0
GB
464# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
465# automatically get built. There should ordinarily be no need to change
466# any of this part of makefile.
a0d0e21e
LW
467#
468# The dummy dependency is a place holder in case $(dynamic_ext) or
469# $(static_ext) is empty.
470#
471# DynaLoader may be needed for extensions that use Makefile.PL.
472
473$(DYNALOADER): miniperl preplibrary FORCE
6ee623d5 474 @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e
LW
475
476d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
6ee623d5 477 @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
a0d0e21e
LW
478
479s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
6ee623d5 480 @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
2304df62 481
4318d5a0
GB
482n_dummy $(nonxs_ext): miniperl preplibrary $(DYNALOADER) FORCE
483 @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
484
17b893d8 485clean: _tidy _mopup
70af249b
CS
486
487realclean: _cleaner _mopup
4e2a5f63 488 @echo "Note that make realclean does not delete config.sh or Policy.sh"
70af249b
CS
489
490clobber: _cleaner _mopup
4e2a5f63 491 rm -f config.sh cppstdin Policy.sh
70af249b
CS
492
493distclean: clobber
494
495# Do not 'make _mopup' directly.
496_mopup:
cd4d8a96 497 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
fed7345c 498 rm -f perl.exp ext.libs
d96ebe2e 499 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
70af249b
CS
500 rm -f perl suidperl miniperl $(LIBPERL)
501
502# Do not 'make _tidy' directly.
503_tidy:
a0d0e21e 504 -cd pod; $(MAKE) clean
909b3858
PP
505 -cd utils; $(MAKE) clean
506 -cd x2p; $(MAKE) clean
4318d5a0 507 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
fb73857a 508 sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
a0d0e21e 509 done
6ee623d5 510 rm -f testcompile compilelog
ff68c719
PP
511
512# Do not 'make _cleaner' directly.
513_cleaner:
4633a7c4 514 -cd os2; rm -f Makefile
909b3858
PP
515 -cd pod; $(MAKE) realclean
516 -cd utils; $(MAKE) realclean
517 -cd x2p; $(MAKE) realclean
4318d5a0 518 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
fb73857a 519 sh ext/util/make_ext realclean $$x MAKE=$(MAKE) ; \
a0d0e21e 520 done
42793c05 521 rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
a0d0e21e 522 rm -rf $(addedbyconf)
cd4d8a96 523 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
fed7345c 524 rm -f $(private)
a0d0e21e 525 rm -rf lib/auto
232e078e 526 rm -f lib/.exists
16d20bd9 527 rm -f h2ph.man pstruct
a0d0e21e 528 rm -rf .config
6ee623d5 529 rm -f testcompile compilelog
ecfc5424 530
2304df62
AD
531# The following lint has practically everything turned on. Unfortunately,
532# you have to wade through a lot of mumbo jumbo that can't be suppressed.
533# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
534# for that spot.
535
536lint: perly.c $(c)
537 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
538
fb73857a
PP
539# Need to unset during recursion to go out of loop.
540# The README below ensures that the dependency list is never empty and
541# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
cd4d8a96 542
84902520 543MAKEDEPEND = Makefile makedepend
cd4d8a96 544
fb73857a 545$(FIRSTMAKEFILE): README $(MAKEDEPEND)
cd4d8a96 546 $(MAKE) depend MAKEDEPEND=
a0d0e21e 547
599a829f 548config.h: config_h.SH config.sh
655635e8
PP
549 $(SHELL) config_h.SH
550
419eaf7b
JH
551# This is an AIXism.
552perl.exp: perl_exp.SH config.sh $(SYM) $(SYMH)
655635e8 553 $(SHELL) perl_exp.SH
75f92628 554
a0d0e21e 555# When done, touch perlmain.c so that it doesn't get remade each time.
2304df62 556depend: makedepend
fb73857a 557 sh ./makedepend MAKE=$(MAKE)
a0d0e21e 558 - test -s perlmain.c && touch perlmain.c
2304df62
AD
559 cd x2p; $(MAKE) depend
560
cd4d8a96
PP
561# Cannot postpone this until $firstmakefile is ready ;-)
562makedepend: makedepend.SH config.sh
563 sh ./makedepend.SH
564
4318d5a0 565test-prep: miniperl perl preplibrary utilities $(dynamic_ext) $(nonxs_ext)
3e3baf6d
TB
566 cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT))
567
568test check: test-prep
6ee623d5 569 cd t && $(LDLIBPTH) ./perl TEST </dev/tty
3e3baf6d
TB
570
571# For testing without a tty or controling terminal. See t/op/stat.t
572test-notty: test-prep
6ee623d5 573 cd t && PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) ./perl TEST
2304df62 574
d96ebe2e
PP
575# Can't depend on lib/Config.pm because that might be where miniperl
576# is crashing.
599a829f 577minitest: miniperl
d96ebe2e
PP
578 @echo "You may see some irrelevant test failures if you have been unable"
579 @echo "to build lib/Config.pm."
cd4d8a96 580 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
6ee623d5 581 && $(LDLIBPTH) ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t </dev/tty
16d20bd9 582
fb73857a 583# Handy way to run perlbug -ok without having to install and run the
84902520 584# installed perlbug. We don't re-run the tests here - we trust the user.
fb73857a 585# Please *don't* use this unless all tests pass.
1d2dff63 586# If you want to report test failures, use "make nok" instead.
188cd53f 587ok: utilities
6ee623d5 588 $(LBLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
84902520 589
1d2dff63
GS
590nok: utilities
591 $(LBLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
592
85e6fe83 593clist: $(c)
2304df62
AD
594 echo $(c) | tr ' ' '\012' >.clist
595
85e6fe83 596hlist: $(h)
2304df62
AD
597 echo $(h) | tr ' ' '\012' >.hlist
598
85e6fe83 599shlist: $(sh)
2304df62
AD
600 echo $(sh) | tr ' ' '\012' >.shlist
601
4633a7c4
LW
602pllist: $(pl)
603 echo $(pl) | tr ' ' '\012' >.pllist
604
599a829f 605Makefile: Makefile.SH ./config.sh
760ac839
LW
606 $(SHELL) Makefile.SH
607
599a829f 608distcheck: FORCE
760ac839
LW
609 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
610
3ee700d1
IZ
611etags:
612 sh emacs/ptags
613
2304df62
AD
614# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
615# If this runs make out of memory, delete /usr/include lines.
616!NO!SUBS!
617
85e6fe83 618$eunicefix Makefile
2304df62
AD
619case `pwd` in
620*SH)
85e6fe83 621 $rm -f ../Makefile
cd4d8a96 622 $ln Makefile ../Makefile
2304df62
AD
623 ;;
624esac
cd4d8a96 625$rm -f $firstmakefile