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