This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module::CoreList (to 2.58) for 5.15.5.
[perl5.git] / Cross / Makefile-cross-SH
CommitLineData
8ed6d636
VK
1#! /bin/sh
2
3# This file is used to create generic Makefile for cross-compile
4# (borrowed from Makefile.SH)
5# (now only small changes are done to establish cross-compilation)
6# miniperl removed from here, as this is built on HOST
7
8Makefile=Makefile-cross-$CROSS_NAME
9
10. Cross/config-${CROSS_NAME}.sh
11
12# H.Merijn Brand [17 Feb 2004]
13# This comment is just to ensure that Configure will find variables that
14# are removed/replaced in patches on blead, but are still needed in the
8534470b 15# 5.8.x, 5.6.x and 5.005.x maintenance tracks.
8ed6d636
VK
16# metaconfig -m will scan all .SH files on this level (not deeper), and
17# not in x2p and other subfolders. This file is as good as any .SH
18# patch references
19# #22227 $baserev
20# #22302 $yacc $byacc
21
22# H.Merijn Brand [30 Oct 2004]
23# Mentioned for the same reason for future reference
24# #23434 $d_strlcat $d_strlcpy
25
26: This forces SH files to create target in same directory as SH file.
27: This is so that make depend always knows where to find SH derivatives.
28case "$0" in
29*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
30esac
31
8ed6d636
VK
32linklibperl='$(LIBPERL)'
33shrpldflags='$(LDDLFLAGS)'
34ldlibpth=''
35DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
36case "$useshrplib" in
37true)
38 # Prefix all runs of 'miniperl' and 'perl' with
39 # $ldlibpth so that ./perl finds *this* shared libperl.
40 case "$LD_LIBRARY_PATH" in
41 '')
42 ldlibpth="LD_LIBRARY_PATH=`pwd`";;
43 *)
44 ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
45 esac
46
47 pldlflags="$cccdlflags"
3b333d01 48 static_ldflags=''
8ed6d636
VK
49 case "${osname}${osvers}" in
50 next4*)
51 ld=libtool
52 lddlflags="-dynamic -undefined warning -framework System \
53 -compatibility_version 1 -current_version $patchlevel \
54 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
55 ;;
56 rhapsody*|darwin*)
57 shrpldflags="${ldflags} -dynamiclib \
58 -compatibility_version \
59 ${api_revision}.${api_version}.${api_subversion} \
60 -current_version \
61 ${revision}.${patchlevel}.${subversion} \
62 -install_name \$(shrpdir)/\$@"
63 ;;
64 cygwin*)
65 linklibperl="-lperl"
66 ;;
67 sunos*)
68 linklibperl="-lperl"
69 ;;
70 netbsd*|freebsd[234]*|openbsd*|dragonfly*)
71 linklibperl="-L. -lperl"
72 ;;
73 interix*)
74 linklibperl="-L. -lperl"
75 shrpldflags="$shrpldflags -Wl,--image-base,0x57000000"
76 ;;
77 linux*)
78 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
79 ;;
80 aix*)
81 shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
82 case "$osvers" in
83 3*) shrpldflags="$shrpldflags -e _nostart"
84 ;;
85 *) shrpldflags="$shrpldflags -b noentry"
86 ;;
87 esac
88 shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
89 linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
90 ;;
91 hpux*)
92 linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
93 ;;
94 os390*)
95 shrpldflags='-W l,XPLINK,dll'
96 linklibperl='libperl.x'
97 DPERL_EXTERNAL_GLOB=''
98 ;;
99 esac
100 case "$ldlibpthname" in
101 '') ;;
102 *)
103 case "$osname" in
104 os2)
105 ldlibpth=''
106 ;;
107 *)
108 eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\""
109 ;;
110 esac
111 # Strip off any trailing :'s
112 ldlibpth=`echo $ldlibpth | sed 's/:*$//'`
113 ;;
114 esac
115
116 case "$ldlibpth" in
117 # Protect any spaces
118 *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;;
119 esac
120
121 case "$osname" in
122 linux)
123 # If there is a pre-existing $libperl from a previous
124 # installation, Linux needs to use LD_PRELOAD to
125 # override the LD_LIBRARY_PATH setting. See the
126 # INSTALL file, under "Building a shared perl library".
127 # If there is no pre-existing $libperl, we don't need
128 # to do anything further.
129 if test -f $archlib/CORE/$libperl; then
130 rm -f preload
131 cat <<'EOT' > preload
132#! /bin/sh
133lib=$1
134shift
135test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
136exec "$@"
137EOT
138 chmod 755 preload
139 ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
140 fi
141 ;;
142 os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
143 ;;
144 esac
145
146 ;;
147
148*) pldlflags=''
3b333d01 149 static_ldflags='CCCDLFLAGS='
8ed6d636
VK
150 ;;
151esac
152
153: Prepare dependency lists for Makefile.
154dynamic_list=' '
155extra_dep=''
156for f in $dynamic_ext; do
157 : the dependency named here will never exist
158 base=`echo "$f" | sed 's/.*\///'`
159 this_target="lib/auto/$f/$base.$dlext"
160 dynamic_list="$dynamic_list $this_target"
161
162 : Parallel makes reveal that we have some interdependencies
163 case $f in
164 Math/BigInt/FastCalc) extra_dep="$extra_dep
165$this_target: lib/auto/List/Util/Util.$dlext" ;;
166 Unicode/Normalize) extra_dep="$extra_dep
167$this_target: uni.data" ;;
168 esac
169done
170
171static_list=' '
172for f in $static_ext; do
173 base=`echo "$f" | sed 's/.*\///'`
174 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
175done
176
177nonxs_list=' '
178for f in $nonxs_ext; do
179 base=`echo "$f" | sed 's/.*\///'`
180 nonxs_list="$nonxs_list ext/$f/pm_to_blib"
181done
182
183echo "Extracting $Makefile (with variable substitutions)"
184$spitshell >$Makefile <<!GROK!THIS!
185# $Makefile.SH
186# This file is derived from $Makefile.SH. Any changes made here will
187# be lost the next time you run Configure.
188# $Makefile is used to generate $firstmakefile. The only difference
189# is that $firstmakefile has the dependencies filled in at the end.
190
191CC = $cc
192LD = $ld
193
194LDFLAGS = $ldflags
195CLDFLAGS = $ldflags
196
197mallocsrc = $mallocsrc
198mallocobj = $mallocobj
199madlysrc = $madlysrc
200madlyobj = $madlyobj
201LNS = $lns
202# NOTE: some systems don't grok "cp -f". XXX Configure test needed?
203CPS = $cp
204RMS = rm -f
205ranlib = $ranlib
206
207# The following are mentioned only to make metaconfig include the
208# appropriate questions in Configure. If you want to change these,
209# edit config.sh instead, or specify --man1dir=/wherever on
210# installman commandline.
211bin = $installbin
212scriptdir = $scriptdir
213shrpdir = $archlibexp/CORE
214privlib = $installprivlib
215man1dir = $man1dir
216man1ext = $man1ext
217man3dir = $man3dir
218man3ext = $man3ext
219
220# The following are used to build and install shared libraries for
221# dynamic loading.
222LDDLFLAGS = $lddlflags
223SHRPLDFLAGS = $shrpldflags
224CCDLFLAGS = $ccdlflags
225DLSUFFIX = .$dlext
226PLDLFLAGS = $pldlflags
227LIBPERL = $libperl
228LLIBPERL= $linklibperl
229SHRPENV = $shrpenv
230
231# Static targets are ordinarily built without CCCDLFLAGS. However,
232# if building a shared libperl.so that might later be linked into
233# another application, then it might be appropriate to also build static
234# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
3b333d01
NC
235# for GNU cc).
236STATIC_LDFLAGS = $static_ldflags
8ed6d636
VK
237
238# The following is used to include the current directory in
239# the dynamic loader path you are building a shared libperl.
240LDLIBPTH = $ldlibpth
241
242dynamic_ext = $dynamic_list
243static_ext = $static_list
244nonxs_ext = $nonxs_list
245ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
246DYNALOADER = DynaLoader\$(OBJ_EXT)
247
248libs = $perllibs $cryptlib
249
cc69b689 250public = perl\$(EXE_EXT) utilities translators
8ed6d636
VK
251
252shellflags = $shellflags
253
254# This is set to MAKE=$make if your $make command doesn't
255# do it for you.
256$make_set_make
257
258# Mention $gmake here so it gets probed for by Configure.
259
260# These variables may need to be manually set for non-Unix systems.
261AR = $full_ar
262EXE_EXT = $_exe
263LIB_EXT = $_a
264OBJ_EXT = $_o
265PATH_SEP = $p_
266
267# If you're going to use valgrind and it can't be invoked as plain valgrind
268# then you'll need to change this, or override it on the make command line.
269VALGRIND=valgrind
270
271FIRSTMAKEFILE = $firstmakefile
272
273# Any special object files needed by this architecture, e.g. os2/os2.obj
274ARCHOBJS = $archobjs
275
276.SUFFIXES: .c \$(OBJ_EXT) .i .s
277
278# grrr
279SHELL = $sh
280
281# how to tr(anslate) newlines
282TRNL = '$trnl'
283
284OPTIMIZE = $optimize
285
286EXTRAS = $extras
287
288INSTALLPREFIXEXP = $prefix
289
290!GROK!THIS!
291# not used by Makefile but by installperl;
292# mentioned here so that metaconfig picks these up
293# $installusrbinperl
294# $versiononly
295
296case "${osname}:${osvers}" in
297darwin:*)
298$spitshell >>$Makefile <<EOF
299
300# Your locales are broken (osname $osname, osvers $osvers)
301# and to avoid the numerous
302# perl: warning: Setting locale failed.
303# warnings during the build process we reset the locale variables.
304
305LC_ALL=C
306LANG=C
307LANGUAGE=C
308EOF
309 ;;
310esac
311
312$spitshell >>$Makefile <<!GROK!THIS!
313CROSS_NAME = ${CROSS_NAME}
314CROSS_LIB = xlib/${CROSS_NAME}
315
316CCCMD = \`sh \$(shellflags) cflags-cross-${CROSS_NAME} "optimize='\$(OPTIMIZE)'" \$@\`
317
318CCCMDSRC = \`sh \$(shellflags) cflags-cross-${CROSS_NAME} "optimize='\$(OPTIMIZE)'" \$<\`
319
320!GROK!THIS!
321
322## In the following dollars and backticks do not need the extra backslash.
323$spitshell >>$Makefile <<'!NO!SUBS!'
324
608969de 325CONFIGPM = xlib/$(CROSS_NAME)/Config.pm
8ed6d636 326
5e4c4c91 327private = preplibrary $(CONFIGPM) $(CROSS_LIB)/Config.pod lib/buildcustomize.pl
8ed6d636 328
cbeaa189 329shextract = Makefile cflags config.h makedepend \
8ed6d636
VK
330 makedir myconfig writemain pod/Makefile
331
467132b9 332addedbyconf = UU $(shextract) lib/lib.pm pstruct
8ed6d636
VK
333
334# Unicode data files generated by mktables
3df51b85
KW
335unidatafiles = lib/unicore/Decomposition.pl lib/unicore/TestProp.pl \
336 lib/unicore/CombiningClass.pl lib/unicore/Name.pl \
1a234f2b 337 lib/unicore/UCD.pl lib/unicore/Name.pm \
3e344d15 338 lib/unicore/Heavy.pl lib/unicore/mktables.lst
8ed6d636
VK
339
340# Directories of Unicode data files generated by mktables
341unidatadirs = lib/unicore/To lib/unicore/lib
342
343h1 = EXTERN.h INTERN.h XSUB.h av.h xconfig.h cop.h cv.h dosish.h
344h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h opcode.h
345h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
346h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
347h5 = utf8.h warnings.h
348h = $(h1) $(h2) $(h3) $(h4) $(h5)
349
350c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro.c perl.c
351c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c
26ea9e12 352c3 = taint.c toke.c util.c deb.c run.c universal.c pad.c globals.c keywords.c
8ed6d636
VK
353c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c
354c5 = $(madlysrc) $(mallocsrc)
355
356c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c perlmain.c opmini.c
357
358obj1 = $(madlyobj) $(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) mro$(OBJ_EXT)
359obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) perl$(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)
48462a74 360obj3 = 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) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT)
8ed6d636
VK
361
362obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
363
364lintflags = \
365 -b \
366 -n \
367 -p \
368 -Ncheck=%all \
369 -Nlevel=4 \
370 -errchk=parentheses \
371 -errhdr=%all \
372 -errfmt=src \
373 -errtags \
374 -erroff=E_ASSIGN_NARROW_CONV \
375 -erroff=E_BAD_PTR_CAST \
376 -erroff=E_BAD_PTR_CAST_ALIGN \
377 -erroff=E_BAD_PTR_INT_COMBINATION \
378 -erroff=E_BAD_SIGN_EXTEND \
379 -erroff=E_BLOCK_DECL_UNUSED \
380 -erroff=E_CASE_FALLTHRU \
381 -erroff=E_CONST_EXPR \
382 -erroff=E_CONSTANT_CONDITION \
383 -erroff=E_END_OF_LOOP_CODE_NOT_REACHED \
384 -erroff=E_EQUALITY_NOT_ASSIGNMENT \
385 -erroff=E_EXPR_NULL_EFFECT \
386 -erroff=E_FALSE_LOGICAL_EXPR \
387 -erroff=E_INCL_NUSD \
388 -erroff=E_LOOP_EMPTY \
389 -erroff=E_MAIN_PARAM \
390 -erroff=E_POINTER_TO_OBJECT \
391 -erroff=E_PTRDIFF_OVERFLOW \
392 -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L \
393 -erroff=E_STATIC_UNUSED \
394 -erroff=E_TRUE_LOGICAL_EXPR
395
396splintflags = \
397 -I/usr/lib/gcc/i486-linux-gnu/4.0.2/include/ \
398 -D__builtin_va_list=va_list \
399 -Dsigjmp_buf=jmp_buf \
400 -warnposix \
401 \
402 +boolint \
403 +charintliteral \
404 -fixedformalarray \
405 -mustfreefresh \
406 -nestedextern \
407 -predboolint \
408 -predboolothers \
409 -preproc \
410 -boolops \
411 -shadow \
412 -nullstate \
413 +longintegral \
414 +matchanyintegral \
415 -type \
416 \
417 +line-len 999 \
418 +weak
419
420splintfiles = $(c1)
421
422.c$(OBJ_EXT):
423 $(CCCMD) -I$(CROSS_LIB) $(PLDLFLAGS) $*.c
424
425.c.i:
426 $(CCCMDSRC) -E $*.c > $*.i
427
428.c.s:
429 $(CCCMDSRC) -S $*.c
430
431all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) extra.pods $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
432 @echo " ";
433 @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
434
435.PHONY: all
436
437
438# This is now done by installman only if you actually want the man pages.
439# @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
440
441# Phony target to force checking subdirectories.
442# Apparently some makes require an action for the FORCE target.
443.PHONY: FORCE
444FORCE:
445 @sh -c true
446!NO!SUBS!
447$spitshell >>$Makefile <<!GROK!THIS!
448
449# We do a copy of the op.c instead of a symlink because gcc gets huffy
450# if we have a symlink forest to another disk (it complains about too many
451# levels of symbolic links, even if we have only two)
452
453opmini.c: op.c
454 \$(RMS) opmini.c
455 \$(CPS) op.c opmini.c
456
457opmini\$(OBJ_EXT): opmini.c
458 \$(CCCMD) \$(PLDLFLAGS) $DPERL_EXTERNAL_GLOB opmini.c
459
460globals\$(OBJ_EXT):
461
462!GROK!THIS!
463$spitshell >>$Makefile <<'!NO!SUBS!'
464miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
465 $(CCCMD) $(PLDLFLAGS) $*.c
466
467perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
468 sh writemain $(DYNALOADER) $(static_ext) > perlmain.c
469
470!NO!SUBS!
471case "$osname" in
472cygwin)
473 ;; # Let cygwin/Makefile.SHs do its work.
474*)
475 $spitshell >>$Makefile <<'!NO!SUBS!'
476perlmain$(OBJ_EXT): perlmain.c
477 $(CCCMD) $(PLDLFLAGS) $*.c
478
479!NO!SUBS!
480 ;;
481esac
482$spitshell >>$Makefile <<'!NO!SUBS!'
483# The file ext.libs is a list of libraries that must be linked in
484# for static extensions, e.g. -lm -lgdbm, etc. The individual
485# static extension Makefile's add to it.
486ext.libs: $(static_ext)
487 -@test -f ext.libs || touch ext.libs
488
489!NO!SUBS!
490
491# How to build libperl. This is still rather convoluted.
492# Load up custom Makefile.SH fragment for shared loading and executables:
493case "$osname" in
494*)
495 Makefile_s="$osname/Makefile.SHs"
496 ;;
497esac
498
499case "$osname" in
500aix)
501 $spitshell >>$Makefile <<!GROK!THIS!
502LIBS = $perllibs
503# In AIX we need to change this for building Perl itself from
504# its earlier definition (which is for building external
505# extensions *after* Perl has been built and installed)
506CCDLFLAGS = `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
507
508!GROK!THIS!
509 case "$useshrplib" in
510 define|true|[yY]*)
511 $spitshell >>$Makefile <<'!NO!SUBS!'
512
513LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT)
514MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT)
515
516$(LIBPERL_NONSHR): $(obj)
517 $(RMS) $(LIBPERL_NONSHR)
518 $(AR) rcu $(LIBPERL_NONSHR) $(obj)
519
520$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)
521 $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
522 opmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
523
524MINIPERLEXP = $(MINIPERL_NONSHR)
525
526LIBPERLEXPORT = perl.exp
527
528!NO!SUBS!
529
530 ;;
531 *)
532 $spitshell >>$Makefile <<'!NO!SUBS!'
533MINIPERLEXP = miniperl$(EXE_EXT)
534
535PERLEXPORT = perl.exp
536
537!NO!SUBS!
538 ;;
539 esac
540 $spitshell >>$Makefile <<'!NO!SUBS!'
541perl.exp: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH)
542 ./$(MINIPERLEXP) makedef.pl PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" | sort -u | sort -f > perl.exp
543
544!NO!SUBS!
545 ;;
546os2)
547 $spitshell >>$Makefile <<'!NO!SUBS!'
548MINIPERLEXP = miniperl
549
550perl5.def: $(MINIPERLEXP) makedef.pl config.sh $(SYM) $(SYMH) miniperl.map
551 ./$(MINIPERLEXP) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def
552
553!NO!SUBS!
554 ;;
555esac
556
557if test -r $Makefile_s ; then
558 . $Makefile_s
559 $spitshell >>$Makefile <<!GROK!THIS!
560
561$Makefile: $Makefile_s
562!GROK!THIS!
563else
564 $spitshell >>$Makefile <<'!NO!SUBS!'
565$(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT)
566!NO!SUBS!
567 case "$useshrplib" in
568 true)
569 $spitshell >>$Makefile <<'!NO!SUBS!'
570 rm -f $@
571 $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs)
572!NO!SUBS!
573 case "$osname" in
574 aix)
575 $spitshell >>$Makefile <<'!NO!SUBS!'
576 rm -f libperl$(OBJ_EXT)
577 mv $@ libperl$(OBJ_EXT)
578 $(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
579!NO!SUBS!
580 ;;
581 esac
582 ;;
583 *)
584 $spitshell >>$Makefile <<'!NO!SUBS!'
585 rm -f $(LIBPERL)
586 $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER)
587 @$(ranlib) $(LIBPERL)
588!NO!SUBS!
589 ;;
590 esac
591 $spitshell >>$Makefile <<'!NO!SUBS!'
592
593# How to build executables.
594
595# The $& notation tells Sequent machines that it can do a parallel make,
596# and is harmless otherwise.
597# The miniperl -w -MExporter line is a basic cheap test to catch errors
598# before make goes on to run preplibrary and then MakeMaker on extensions.
599# This is very handy because later errors are often caused by miniperl
600# build problems but that's not obvious to the novice.
601# The Module used here must not depend on Config or any extensions.
602
603!NO!SUBS!
604
605
606 $spitshell >>$Makefile <<'!NO!SUBS!'
607
608perl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
609 -@rm -f miniperl.xok
610 $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX)dyn$(EXE_EXT) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
611 $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX)$(EXE_EXT) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
612
613# Purify/Quantify Perls.
614
615pureperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
616 $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
617
618purecovperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
619 $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
620
621quantperl$(EXE_EXT): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT)
622 $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
623
624# Valgrind perl (currently Linux only)
625
626perl.valgrind.config: config.sh
627 @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..."
628 @$(MAKE) perl.config.dashg
629 @echo "Checking usemymalloc='n' in config.sh..."
630 @grep "^usemymalloc=" config.sh
631 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
632 @echo "And of course you have to have valgrind..."
633 $(VALGRIND) ./perl -e 1 2>/dev/null || exit 1
634
635# Third Degree Perl (Tru64 only)
636
637perl.config.dashg:
638 @echo "Checking optimize='-g' in config.sh..."
639 @grep "^optimize=" config.sh
640 @egrep "^optimize='(.*-g.*)'" config.sh >/dev/null || exit 1
641
642perl.third.config: config.sh
643 @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..."
644 @$(MAKE) perl.config.dashg
645 @echo "Checking usemymalloc='n' in config.sh..."
646 @grep "^usemymalloc=" config.sh
647 @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
648
649perl.third: /usr/bin/atom perl.third.config perl
650 atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl
651 @echo "Now you may run perl.third and then study perl.3log."
652
653# Pixie Perls (Tru64 and IRIX only)
654
655perl.pixie.config: config.sh
656 @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..."
657 @$(MAKE) perl.config.dashg
658
659perl.pixie.atom: /usr/bin/atom perl
660 atom -tool pixie -L. -all -toolargs="-quiet" perl
661
662perl.pixie.irix: perl
663 pixie perl
664
665perl.pixie: /usr/bin/pixie perl.pixie.config perl
666 if test -x /usr/bin/atom; then \
667 $(MAKE) perl.pixie.atom; \
668 else \
669 $(MAKE) perl.pixie.irix; \
670 fi
671 @echo "Now you may run perl.pixie and then run pixie."
672
673# Gprof Perl
674
675perl.config.dashpg:
676 @echo "Checking optimize='-pg' in config.sh..."
677 @grep "^optimize=" config.sh
678 @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1
679
680perl.gprof.config: config.sh
681 @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..."
682 @$(MAKE) perl.config.dashpg
683
684perl.gprof: /usr/bin/gprof perl.gprof.config
685 @-rm -f perl
686 $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl
687 @echo "Now you may run perl.gprof and then run gprof perl.gprof."
688
689# Gcov Perl
690
691perl.config.gcov:
692 @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..."
693 @echo "Checking gccversion in config.sh..."
694 @grep "^gccversion=" config.sh
695 @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1
696 @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..."
697 @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..."
698 @grep "^ccflags=" config.sh
699 @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1
700
701perl.gcov: perl.config.gcov
702 @-rm -f perl
703 $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl
704 @echo "Now you may run perl.gcov and then run gcov some.c."
705
706# Microperl. This is just a convenience thing if one happens to
707# build also the full Perl and therefore the real big Makefile:
708# usually one should manually explicitly issue the below command.
709
710.PHONY: microperl
711microperl:
712 $(MAKE) -f Makefile.micro
713
8ed6d636
VK
714!NO!SUBS!
715
716fi
717
718$spitshell >>$Makefile <<'!NO!SUBS!'
719
8ed6d636 720.PHONY: preplibrary
7353f64c 721preplibrary: miniperl $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
8ed6d636
VK
722
723.PHONY: makeppport
724makeppport: miniperl$(EXE_EXT) $(CONFIGPM)
725 $(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib mkppport
726
727$(CROSS_LIB)/Config.pod: config.sh miniperl configpm Porting/Glossary
608969de
VK
728 $(LDLIBPTH) ./miniperl -Ilib configpm --cross=$(CROSS_NAME)
729 cp *.h $(CROSS_LIB)/
730 cp ext/re/re.pm $(LIBDIR)/
731
732$(CONFIGPM): $(CROSS_LIB)/Config.pod xconfig.h
8ed6d636
VK
733
734lib/re.pm: ext/re/re.pm
735 @-rm -f $@
736 cp ext/re/re.pm lib/re.pm
737
5e4c4c91
NC
738lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl
739 $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl
740
8ed6d636
VK
741unidatafiles $(unidatafiles): uni.data
742
743uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
3df51b85
KW
744 cd lib/unicore && $(LDLIBPTH) ../../miniperl -I../../lib mktables -P ../../pod -maketest -makelist -p
745# Commented out so always runs, mktables looks at far more files than we
746# can in this makefile to decide if needs to run or not
747# touch uni.data
8ed6d636
VK
748
749extra.pods: miniperl
750 -@test ! -f extra.pods || rm -f `cat extra.pods`
751 -@rm -f extra.pods
752 -@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
753 nx=`echo $$x | sed -e "s/README\.//"`; \
754 cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
755 echo "pod/perl"$$nx".pod" >> extra.pods ; \
756 done
757 -@rm -f pod/perlvms.pod
758 -@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
759 -@rm -f pod/perldelta.pod
4d7c7898 760 -@test -f pod/perl5100delta.pod && cd pod && $(LNS) perl5100delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods # See buildtoc
8ed6d636
VK
761
762extras.make: perl$(EXE_EXT)
763 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
764
765extras.test: perl$(EXE_EXT)
766 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
767
768extras.install: perl$(EXE_EXT)
769 -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
770
771.PHONY: install install-strip install-all install-verbose install-silent \
772 no-install install.perl install.man install.html
773
774META.yml: Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
775 $(LDLIBPTH) ./miniperl -Ilib Porting/makemeta
776
777install-strip:
778 $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
779
780install install-all:
781 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)"
782
783install-verbose:
784 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)"
785
786install-silent:
787 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)"
788
789no-install:
790 $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
791
792# Set this to an empty string to avoid an attempt of rebuild before install
793INSTALL_DEPENDENCE = all
794
795install.perl: $(INSTALL_DEPENDENCE) installperl
796 $(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
797 -@test ! -s extras.lst || $(MAKE) extras.install
798
799install.man: all installman
800 $(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
801
802# XXX Experimental. Hardwired values, but useful for testing.
803# Eventually Configure could ask for some of these values.
804install.html: all installhtml
805 -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
806 $(LDLIBPTH) ./perl installhtml \
807 --podroot=. --podpath=. --recurse \
808 --htmldir=$(privlib)/html \
809 --htmlroot=$(privlib)/html \
810 --splithead=pod/perlipc \
811 --splititem=pod/perlfunc \
812 --libpods=perlfunc:perlguts:perlvar:perlrun:perlop \
e2b41a3f 813 --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
8ed6d636
VK
814 --verbose
815
816
817# I now supply perly.c with the kits, so the following section is
818# used only if you force bison to run by saying
819# make regen_perly
820# You normally shouldn't remake perly.[ch].
821
822.PHONY: regen_perly
823
824run_byacc:
825 @echo "run_byacc is obsolete; try 'make regen_perly' instead"
826
827# this outputs perly.h, perly.act and perly.tab
828regen_perly:
829 perl regen_perly.pl
830
831# We don't want to regenerate perly.c and perly.h, but they might
832# appear out-of-date after a patch is applied or a new distribution is
833# made.
834perly.c: perly.y
835 -@sh -c true
836
837perly.h: perly.y
838 -@sh -c true
839
d500e60d 840SYM = globvar.sym perlio.sym
8ed6d636
VK
841
842SYMH = perlvars.h intrpvar.h
843
844CHMOD_W = chmod +w
845
846# The following files are generated automatically
d500e60d 847# embed.pl: proto.h embed.h embedvar.h perlapi.h perlapi.c
897d3989 848# opcode.pl: opcode.h opnames.h pp_proto.h
8ed6d636
VK
849# regcomp.pl: regnodes.h
850# warnings.pl: warnings.h lib/warnings.pm
851# The correct versions should be already supplied with the perl kit,
852# in case you don't have perl available.
853# To force them to be regenerated, run
854# perl regen.pl
855# with your existing copy of perl
856# (make regen_headers is kept for backwards compatibility)
857
d500e60d
NC
858AUTOGEN_FILES = opcode.h opnames.h pp_proto.h proto.h embed.h embedvar.h \
859 perlapi.h perlapi.c regnodes.h warnings.h lib/warnings.pm
8ed6d636 860
1e2f36ef 861.PHONY: regen_headers regen_all
8ed6d636
VK
862
863regen regen_headers: FORCE
864 -perl regen.pl
865
1e2f36ef 866regen_all: regen
8ed6d636
VK
867
868.PHONY: manisort manicheck
869
870manisort: FORCE
871 LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
872 LC_ALL=C sort -fdo MANIFEST MANIFEST)
873
874manicheck: FORCE
875 perl Porting/manicheck
876
877# Extensions:
878# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
879# automatically get built. There should ordinarily be no need to change
880# any of this part of makefile.
881#
882# The dummy dependency is a place holder in case $(dynamic_ext) or
883# $(static_ext) is empty.
884#
885# DynaLoader may be needed for extensions that use Makefile.PL.
886
887###$(DYNALOADER).c: $(EXTDIR)/DynaLoader/dl_dld.xs $(CONFIGPM)
888### if not exist $(AUTODIR) mkdir $(AUTODIR)
889### cd $(EXTDIR)\$(*B)
890### $(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) $(*B)_pm.PL
891### $(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) XSLoader_pm.PL
892### cd ..\..\win32
893### $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
894### $(XCOPY) $(EXTDIR)\$(*B)\XSLoader.pm $(LIBDIR)\$(NULL)
895### cd $(EXTDIR)\$(*B)
896### $(XSUBPP) dl_win32.xs > $(*B).c
897### cd ..\..\win32
898###
899###$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
900### $(COPY) dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
901
902
903
5e4c4c91 904$(DYNALOADER): lib/buildcustomize.pl preplibrary FORCE
3b333d01 905 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
8ed6d636 906
5e4c4c91 907d_dummy $(dynamic_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
3b333d01 908 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
8ed6d636 909
5e4c4c91 910s_dummy $(static_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
3b333d01 911 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
8ed6d636 912
5e4c4c91 913n_dummy $(nonxs_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary $(DYNALOADER) FORCE
3b333d01 914 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
8ed6d636
VK
915!NO!SUBS!
916
917$spitshell >>$Makefile <<EOF
918$extra_dep
919EOF
920
921$spitshell >>$Makefile <<'!NO!SUBS!'
922
923.PHONY: printconfig
924printconfig:
925 @eval `$(LDLIBPTH) ./perl -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
926
927.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
928 realclean _realcleaner clobber _clobber \
6e2cec71 929 distclean veryclean _verycleaner
8ed6d636 930
6e2cec71 931clean: _tidy _mopup
8ed6d636 932
6e2cec71 933realclean: _realcleaner _mopup
8ed6d636
VK
934 @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
935
936_clobber:
937 -@rm -f Cross/run-* Cross/to-* Cross/from-*
938 rm -f config.sh cppstdin Policy.sh extras.lst
939
6e2cec71 940clobber: _realcleaner _mopup _clobber
8ed6d636
VK
941
942distclean: clobber
943
944# Like distclean but also removes emacs backups and *.orig.
945veryclean: _verycleaner _mopup _clobber
946 -@rm -f Obsolete Wanted
947
948# Do not 'make _mopup' directly.
949_mopup:
950 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c uudmap.h generate_uudmap$(EXE_EXT)
951 -rmdir .depending
952 -@test -f extra.pods && rm -f `cat extra.pods`
953 -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
954 -rm -f perl.exp ext.libs extra.pods uni.data opmini.o
955 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
956 -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap
957 -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
958 -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
959 -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
ce0286c6 960 -rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
cc69b689 961 -rm -f perl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
8ed6d636
VK
962 -rm -f config.over
963
964# Do not 'make _tidy' directly.
965_tidy:
966 -cd pod; $(LDLIBPTH) $(MAKE) clean
967 -cd utils; $(LDLIBPTH) $(MAKE) clean
968 -cd x2p; $(LDLIBPTH) $(MAKE) clean
969 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
3b333d01 970 $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
8ed6d636
VK
971 done
972
973_cleaner1:
974 -cd os2; rm -f Makefile
975 -cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
976 -cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
977 -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
3b333d01
NC
978 -@if test -f miniperl$(EXE_EXT) ; then \
979 for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
980 $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
981 done ; \
982 else \
983 sh $(CLEAN).sh ; \
984 fi
985 rm -f realclean.sh veryclean.sh
8ed6d636
VK
986 -@test ! -f ./miniperl$(EXE_EXT) || $(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib mkppport --clean
987
988# Some systems do not support "?", so keep these files separate.
989_cleaner2:
990 -rm -f core.*perl.*.? t/core.perl.*.? .?*.c
991 rm -f core *perl.core t/core t/*perl.core core.* t/core.*
f18bc4a8
NC
992 rm -f t/perl$(EXE_EXT) t/rantests
993 rm -rf t/tmp*
8ed6d636
VK
994 rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
995 rm -rf $(addedbyconf)
996 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
997 rm -f $(private)
998 rm -rf $(unidatafiles) $(unidatadirs)
999 rm -rf lib/auto
1000 rm -f lib/.exists lib/*/.exists lib/*/*/.exists
1001 rm -f h2ph.man pstruct
1002 rm -rf .config
1003 rm -f preload
1004 rm -rf lib/Encode lib/Compress lib/Hash lib/re
1005 rm -rf lib/IO/Compress lib/IO/Uncompress
1006 rm -f lib/ExtUtils/ParseXS/t/XSTest.c
1007 rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT)
1008 rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX)
1009 -rmdir lib/B lib/Data
1010 -rmdir lib/Filter/Util lib/IO/Socket
1011 -rmdir lib/List lib/MIME lib/Scalar lib/Sys
1012 -rmdir lib/threads lib/XS
1013
1014_realcleaner:
1015 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1016 @$(LDLIBPTH) $(MAKE) _cleaner2
1017
1018_verycleaner:
1019 @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1020 @$(LDLIBPTH) $(MAKE) _cleaner2
1021 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
1022
1023.PHONY: lint
1024lint: $(c)
1025 rm -f *.ln
1026 lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
1027
1028.PHONY: splint
1029splint: $(c)
1030 splint $(splintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(splintfiles)
1031
1032# Need to unset during recursion to go out of loop.
1033# The README below ensures that the dependency list is never empty and
1034# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
1035
1036MAKEDEPEND = Makefile makedepend
1037
1038$(FIRSTMAKEFILE): README $(MAKEDEPEND)
1039 $(MAKE) depend MAKEDEPEND=
1040
1041config.h: config_h.SH config.sh
1042 $(SHELL) config_h.SH
1043 # TODO - improve following line
1044 cp config.h $(CROSS_LIB)/
1045
1046xconfig.h: config_h.SH Cross/config-$(CROSS_NAME).sh
1047 CONFIG_SH=Cross/config-$(CROSS_NAME).sh CONFIG_H=xconfig.h $(SHELL) config_h.SH
608969de 1048 #TODO $(LDLIBPTH) ./miniperl -Ilib -MCross=$(CROSS_NAME) config_h.PL "INST_VER=$(INST_VER)" "CORE_DIR=$(CROSS_LIB)" "CONFIG_H=xconfig.h"
8ed6d636 1049 cp xconfig.h $(CROSS_LIB)/
608969de 1050 cp xconfig.h $(CROSS_LIB)/config.h
8ed6d636
VK
1051
1052# When done, touch perlmain.c so that it doesn't get remade each time.
1053.PHONY: depend
1054depend: makedepend
1055 sh ./makedepend MAKE=$(MAKE)
1056 - test -s perlmain.c && touch perlmain.c
1057 cd x2p; $(MAKE) depend
1058
1059# Cannot postpone this until $firstmakefile is ready ;-)
1060makedepend: makedepend.SH config.sh
1061 sh ./makedepend.SH
1062
1063.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
1064 test_tty test-tty _test_tty test_notty test-notty _test_notty \
1065 utest ucheck test.utf8 check.utf8 test.torture torturetest \
1066 test.utf16 check.utf16 utest.utf16 ucheck.utf16 \
1067 test.third check.third utest.third ucheck.third test_notty.third \
1068 test.deparse test_notty.deparse test_harness test_harness_notty \
1069 minitest coretest test.taintwarn
1070
1071# Cannot delegate rebuilding of t/perl to make
1072# to allow interlaced test and minitest
1073
1074TESTFILE=TEST
1075
6e2cec71 1076_test_prep:
8ed6d636
VK
1077 cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
1078
1079# Architecture-neutral stuff:
1080
1081test_prep_pre: preplibrary utilities $(nonxs_ext)
1082
9f417383
NC
1083test_prep: test_prep_pre miniperl$(EXE_EXT) $(unidatafiles) perl$(EXE_EXT) \
1084 $(dynamic_ext) $(TEST_PERL_DLL) x2p/s2p x2p/find2perl
8ed6d636
VK
1085 PERL=./perl $(MAKE) _test_prep
1086
1087_test_tty:
1088 cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
1089
1090_test_notty:
1091 cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS)
1092
8ed6d636
VK
1093# The second branch is for testing without a tty or controlling terminal,
1094# see t/op/stat.t
1095_test:
1096 if (true </dev/tty) >/dev/null 2>&1; then \
1097 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty ; \
1098 else \
1099 $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
1100 fi
1101 @echo "Ran tests" > t/rantests
1102
1103test check: test_prep
1104 PERL=./perl $(MAKE) _test
1105
1106test_tty: test_prep
1107 PERL=./perl $(MAKE) _test_tty
1108
1109test_notty: test_prep
1110 PERL=./perl $(MAKE) _test_notty
1111
1112utest ucheck test.utf8 check.utf8: test_prep
1113 PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
1114
1115coretest: test_prep
1116 PERL=./perl TEST_ARGS=-core $(MAKE) _test
1117
1118test-prep: test_prep
1119
1120test-tty: test_tty
1121
1122test-notty: test_notty
1123
1124# Torture testing
1125
1126test.torture torturetest: test_prep
1127 PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1128
1129# Targets for UTF16 testing:
1130
1131minitest.utf16: minitest.prep
1132 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
115e9681 1133 && $(LDLIBPTH) ./perl TEST -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
8ed6d636
VK
1134
1135test.utf16 check.utf16: test_prep
1136 PERL=./perl $(MAKE) TEST_ARGS=-utf16 _test
1137
1138utest.utf16 ucheck.utf16: test_prep
1139 PERL=./perl $(MAKE) TEST_ARGS="-utf8 -utf16" _test
1140
1141# Targets for valgrind testing:
1142
1143test_prep.valgrind: test_prep perl.valgrind
1144 PERL=./perl $(MAKE) _test_prep
1145
1146test.valgrind check.valgrind: test_prep perl.valgrind.config
1147 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(MAKE) _test
1148
1149utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config
1150 PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1151
1152test_notty.valgrind: test_prep.valgrind perl.valgrind.config
1153 PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1154
1155# Targets for Third Degree testing.
1156
1157test_prep.third: test_prep perl.third
1158 PERL=./perl.third $(MAKE) _test_prep
1159
1160test.third check.third: test_prep.third perl.third
1161 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1162
1163utest.third ucheck.third: test_prep.third perl.third
1164 PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
1165
1166test_notty.third: test_prep.third perl.third
1167 PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
1168
1169# Targets for Deparse testing.
1170
1171test.deparse: test_prep
1172 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1173
1174test_notty.deparse: test_prep
1175 PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1176
1177# Targets to run the test suite with -t
1178
1179test.taintwarn: test_prep
1180 PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1181
1182minitest.prep:
1183 -@test -f lib/lib.pm && test -f lib/Config.pm || \
1184 $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
1185 @echo " "
1186 @echo "You may see some irrelevant test failures if you have been unable"
1187 @echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
1188 @echo " "
1189
1190# Can't depend on lib/Config.pm because that might be where miniperl
1191# is crashing.
7353f64c 1192minitest: miniperl$(EXE_EXT) minitest.prep
8ed6d636 1193 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
115e9681 1194 && $(LDLIBPTH) ./perl TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
8ed6d636
VK
1195
1196# Test via harness
1197
1198test_harness: test_prep
1199 PERL=./perl $(MAKE) TESTFILE=harness _test
1200
1201test_harness_notty: test_prep
1202 PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1203
1204# Handy way to run perlbug -ok without having to install and run the
1205# installed perlbug. We don't re-run the tests here - we trust the user.
1206# Please *don't* use this unless all tests pass.
1207# If you want to report test failures, use "make nok" instead.
1208
1209.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1210
1211ok: utilities
1212 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
1213
1214okfile: utilities
1215 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
1216
1217oknack: utilities
1218 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1219
1220okfilenack: utilities
1221 $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1222
1223nok: utilities
1224 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1225
1226nokfile: utilities
1227 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1228
1229noknack: utilities
1230 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1231
1232nokfilenack: utilities
1233 $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1234
467132b9 1235.PHONY: clist hlist shlist
8ed6d636
VK
1236
1237clist: $(c)
1238 echo $(c) | tr ' ' $(TRNL) >.clist
1239
1240hlist: $(h)
1241 echo $(h) | tr ' ' $(TRNL) >.hlist
1242
1243shlist: $(sh)
1244 echo $(sh) | tr ' ' $(TRNL) >.shlist
1245
8ed6d636
VK
1246Makefile: Makefile.SH ./config.sh
1247 $(SHELL) Makefile.SH
1248
1249.PHONY: distcheck
1250distcheck: FORCE
1251 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1252
1253.PHONY: elc
1254elc: emacs/cperl-mode.elc
1255
1256emacs/cperl-mode.elc: emacs/cperl-mode.el
1257 -cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1258
1259.PHONY: etags ctags tags
1260
1261etags: TAGS
1262
1263TAGS: emacs/cperl-mode.elc
1264 sh emacs/ptags
1265
8534470b 1266# Let's hope make will not go into an infinite loop on case-insensitive systems
8ed6d636
VK
1267# This may also fail if . is in the head of the path, since perl will
1268# require -Ilib
1269tags: TAGS
1270 perl emacs/e2ctags.pl TAGS > tags
1271
1272ctags:
1273 ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c *.c *.h
1274
1275# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1276# If this runs make out of memory, delete /usr/include lines.
1277!NO!SUBS!
1278
1279$eunicefix $Makefile
1280case `pwd` in
1281*SH)
1282 $rm -f ../$Makefile
1283 $ln $Makefile ../$Makefile
1284 ;;
1285esac
1286$rm -f $firstmakefile
1287
1288# Now do any special processing required before building.
1289
1290case "$ebcdic" in
1291define)
1292 xxx=''
1293 echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
1294case "$osname" in
1295os390|posix-bc)
1296 if cd x2p
1297 then
1298 rm -f y.tab.c y.tab.h
1299 case "$osname" in
1300 posix-bc)
1301 # we are using two different yaccs in BS2000 Posix!
1302 byacc a2p.y >/dev/null 2>&1
1303 ;;
1304 *) # e.g. os390
1305 yacc a2p.y >/dev/null 2>&1
1306 ;;
1307 esac
1308 if cmp -s y.tab.c a2p.c
1309 then
1310 rm -f y.tab.c
1311 else
1312 echo "a2p.y -> a2p.c" >&2
1313 mv -f y.tab.c a2p.c
1314 chmod u+w a2p.c
1315 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
1316 -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
1317 -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
1318 xxx="$xxx a2p.c"
1319 fi
1320 # In case somebody yacc -d:ed the a2p.y.
1321 if test -f y.tab.h
1322 then
1323 if cmp -s y.tab.h a2p.h
1324 then
1325 rm -f y.tab.h
1326 else
1327 echo "a2p.h -> a2p.h" >&2
1328 mv -f y.tab.h a2p.h
1329 xxx="$xxx a2p.h"
1330 fi
1331 fi
1332 cd ..
1333 fi
1334 ;;
1335vmesa)
1336 # Do nothing in VM/ESA.
1337 ;;
1338*)
1339 echo "'$osname' is an EBCDIC system I don't know that well." >&4
1340 ;;
1341esac
1342 case "$xxx" in
1343 '') echo "No parser files were regenerated. That's okay." >&2 ;;
1344 esac
1345 ;;
1346esac
1347
1348# ex: set ts=8 sts=4 sw=4 noet: