xref: /openbsd/gnu/usr.bin/perl/Makefile.SH (revision 274d7c50)
1#!/bin/sh
2
3# quote() - Creates a shell literal
4# Usage:  echo "...` quote "..." `..."
5quote() {
6	case "$1" in
7	'') echo "''" ;;
8	*)  echo "$1" | sed 's/\([^a-zA-Z0-9.:_/-]\)/\\\1/g' ;;
9	esac
10}
11
12case $PERL_CONFIG_SH in
13'')
14	if test -f config.sh
15		then TOP=.
16	else
17		echo "Can't find config.sh."; exit 1
18	fi
19	. $TOP/config.sh
20	;;
21esac
22
23case "$osname" in
24amigaos)
25	devtty=CONSOLE:
26	;;
27*)
28	devtty=/dev/tty
29	;;
30esac
31
32Makefile=Makefile
33
34: This forces SH files to create target in same directory as SH file.
35: This is so that make depend always knows where to find SH derivatives.
36case "$0" in
37*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
38esac
39
40pwd="`pwd`"
41linklibperl='$(LIBPERL)'
42linklibperl_nonshr=''
43shrpldflags='$(LDDLFLAGS)'
44ldlibpth=''
45DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB'
46DPERL_IS_MINIPERL='-DPERL_IS_MINIPERL'
47case "$useshrplib" in
48true)
49	# Prefix all runs of 'miniperl' and 'perl' with
50	# $ldlibpth so that ./perl finds *this* shared libperl.
51	case "$LD_LIBRARY_PATH" in
52	'')  ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `" ;;
53	*)   ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `:` quote "$LD_LIBRARY_PATH" `" ;;
54	esac
55
56	pldlflags="$cccdlflags"
57	static_ldflags=''
58	case "${osname}${osvers}" in
59	next4*)
60		ld=libtool
61		lddlflags="-dynamic -undefined warning -framework System \
62		-compatibility_version 1 -current_version $patchlevel \
63		-prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@"
64		;;
65	darwin*)
66		shrpldflags="${ldflags} -dynamiclib \
67                            -compatibility_version \
68				${api_revision}.${api_version}.${api_subversion} \
69			     -current_version \
70				${revision}.${patchlevel}.${subversion}"
71		case "$osvers" in
72	        1[5-9]*|[2-9]*)
73			shrpldflags="$shrpldflags -install_name `pwd`/\$@ -Xlinker -headerpad_max_install_names"
74			exeldflags="-Xlinker -headerpad_max_install_names"
75			;;
76		*)
77			shrpldflags="$shrpldflags -install_name \$(shrpdir)/\$@"
78			;;
79		esac
80		;;
81	cygwin*)
82		shrpldflags="$shrpldflags -Wl,--out-implib=libperl.dll.a -Wl,--image-base,0x52000000"
83		linklibperl="-L. -lperl"
84		;;
85	sunos*)
86		linklibperl="-lperl"
87		;;
88	netbsd*|freebsd[234]*|openbsd*|dragonfly*|bitrig*)
89		linklibperl="-L. -lperl"
90		;;
91	interix*)
92		linklibperl="-L. -lperl"
93		shrpldflags="$shrpldflags -Wl,--image-base,0x57000000"
94		;;
95	aix*)
96		case "$cc" in
97		gcc*)
98			shrpldflags="-shared -Wl,-H512 -Wl,-T512 -Wl,-bhalt:4 -Wl,-bM:SRE -Wl,-bE:perl.exp"
99			case "$osvers" in
100			3*)	shrpldflags="$shrpldflags -e _nostart"
101				;;
102			*)	shrpldflags="$shrpldflags -Wl,-bnoentry"
103				;;
104			esac
105			shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
106			linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
107			linklibperl_nonshr='-lperl_nonshr'
108			;;
109		*)
110			shrpldflags="-H512 -T512 -bhalt:4 -bM:SRE -bE:perl.exp"
111			case "$osvers" in
112			3*)	shrpldflags="$shrpldflags -e _nostart"
113				;;
114			*)	shrpldflags="$shrpldflags -b noentry"
115				;;
116			esac
117			shrpldflags="$shrpldflags $ldflags $perllibs $cryptlib"
118			linklibperl="-L $archlibexp/CORE -L `pwd | sed 's/\/UU$//'` -lperl"
119			linklibperl_nonshr='-lperl_nonshr'
120			;;
121		esac
122		;;
123	hpux*)
124		linklibperl="-L `pwd | sed 's/\/UU$//'` -Wl,+s -Wl,+b$archlibexp/CORE -lperl"
125		;;
126	os390*)
127            shrpldflags='-W l,XPLINK,dll'
128	    linklibperl='libperl.x'
129	    DPERL_EXTERNAL_GLOB=''
130	    ;;
131	esac
132	case "$ldlibpthname" in
133	'') ;;
134	*)
135	    case "$osname" in
136	    os2)
137	        ldlibpth=''
138	        ;;
139	    *)
140		eval "ldlibpthval=\"\$$ldlibpthname\""
141
142		case "$ldlibpthval" in
143		'')  ldlibpth="$ldlibpthname=` quote "$pwd" `" ;;
144		*)   ldlibpth="$ldlibpthname=` quote "$pwd" `:` quote "$ldlibpthval" `" ;;
145		esac
146
147		;;
148	    esac
149
150	    ;;
151        esac
152
153	case "$osname" in
154	linux)
155	    # If there is a pre-existing $libperl from a previous
156	    # installation, Linux needs to use LD_PRELOAD to
157	    # override the LD_LIBRARY_PATH setting.  See the
158	    # INSTALL file, under "Building a shared perl library".
159	    # If there is no pre-existing $libperl, we don't need
160	    # to do anything further.
161	    if test -f $archlib/CORE/$libperl; then
162		rm -f preload
163		cat <<'EOT' > preload
164#! /bin/sh
165lib=$1
166shift
167test -r $lib && export LD_PRELOAD="$lib $LD_PRELOAD"
168exec "$@"
169EOT
170		chmod 755 preload
171		ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl"
172	    fi
173	    ;;
174	os390)	test -f /bin/env && ldlibpth="/bin/env $ldlibpth"
175		;;
176	esac
177
178	;;
179
180*)	pldlflags=''
181	static_ldflags='CCCDLFLAGS='
182	;;
183esac
184
185: is Cwd static or dynamic
186static_cwd='define'
187storable_limit_dep=''
188storable_type=''
189list_util_dep='$(PERL_EXE)'
190for f in $dynamic_ext; do
191   case $f in
192       Cwd) static_cwd='undef' ;;
193       List/Util) list_util_dep=lib/auto/List/Util/Util.$dlext ;;
194       Storable) storable_limit_dep=lib/auto/Storable/Storable.$dlext
195                 storable_type='dynamic' ;;
196   esac
197done
198
199: Prepare dependency lists for Makefile.
200dynamic_list=' '
201dynamic_ext_re="lib/auto/re/re.$dlext"
202extra_dep='
203ext/Pod-Functions/pm_to_blib: cpan/Pod-Simple/pm_to_blib cpan/Pod-Escapes/pm_to_blib pod/perlfunc.pod
204cpan/IO-Compress/pm_to_blib: dist/lib/pm_to_blib
205'
206for f in $dynamic_ext; do
207    : the dependency named here will never exist
208      base=`echo "$f" | sed 's/.*\///'`
209    this_target="lib/auto/$f/$base.$dlext"
210    dynamic_list="$dynamic_list $this_target"
211
212    : Parallel makes reveal that we have some interdependencies
213    case $f in
214	Math/BigInt/FastCalc|Devel/NYTProf) extra_dep="$extra_dep
215$this_target: $list_util_dep" ;;
216	Unicode/Normalize) extra_dep="$extra_dep
217$this_target: uni.data" ;;
218    esac
219done
220
221static_list=' '
222for f in $static_ext; do
223	base=`echo "$f" | sed 's/.*\///'`
224	static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
225    : Parallel makes reveal that we have some interdependencies
226    this_target="lib/auto/$f/$base\$(LIB_EXT)"
227    case $f in
228	Math/BigInt/FastCalc|Devel/NYTProf) extra_dep="$extra_dep
229$this_target: lib/auto/List/Util/Util\$(LIB_EXT)" ;;
230	Unicode/Normalize) extra_dep="$extra_dep
231$this_target: uni.data" ;;
232        Storable) storable_type='static' ;;
233    esac
234done
235
236nonxs_list=' '
237for f in $nonxs_ext; do
238    p=`echo "$f" | tr / -`
239    for d in ext dist cpan; do
240	if test -d $d/$p; then
241	    nonxs_list="$nonxs_list $d/$p/pm_to_blib"
242	fi
243    done
244done
245
246dtrace_h=''
247
248# three object files generated by 'dtrace -G' when dtrace is enabled
249dtrace_perllib_o=''
250dtrace_mini_o=''
251dtrace_main_o=''
252
253case "$usedtrace" in
254define|true)
255	dtrace_h='perldtrace.h'
256	case "$dtraceobject" in
257	define)
258		dtrace_perllib_o='dtrace_perllib$(OBJ_EXT)'
259		dtrace_mini_o='dtrace_mini$(OBJ_EXT)'
260		dtrace_main_o='dtrace_main$(OBJ_EXT)'
261		;;
262	esac
263	;;
264esac
265
266echo "Extracting $Makefile (with variable substitutions)"
267$spitshell >$Makefile <<!GROK!THIS!
268# $Makefile
269# This file is derived from Makefile.SH.  Any changes made here will
270# be lost the next time you run Configure.
271#  Makefile is used to generate $firstmakefile.  The only difference
272#  is that $firstmakefile has the dependencies filled in at the end.
273
274CC = $cc
275LD = $ld
276
277LDFLAGS = $ldflags
278CLDFLAGS = $ldflags
279
280mallocsrc = $mallocsrc
281mallocobj = $mallocobj
282LNS = $lns
283# NOTE: some systems don't grok "cp -f". XXX Configure test needed?
284CPS = $cp
285RMS = rm -f
286ranlib = $ranlib
287
288# The following are mentioned only to make metaconfig include the
289# appropriate questions in Configure.  If you want to change these,
290# edit config.sh instead, or specify --man1dir=/wherever on
291# installman commandline.
292bin = $installbin
293scriptdir = $scriptdir
294shrpdir = $archlibexp/CORE
295privlib = $installprivlib
296man1dir = $man1dir
297man1ext = $man1ext
298man3dir = $man3dir
299man3ext = $man3ext
300
301# The following are used to build and install shared libraries for
302# dynamic loading.
303LDDLFLAGS = $lddlflags
304SHRPLDFLAGS = $shrpldflags
305CCDLFLAGS = $ccdlflags
306DLSUFFIX = .$dlext
307PLDLFLAGS = $pldlflags
308LIBPERL = $libperl
309LLIBPERL= $linklibperl
310LLIBPERL_NONSHR= $linklibperl_nonshr
311SHRPENV = $shrpenv
312
313# Static targets are ordinarily built without CCCDLFLAGS.  However,
314# if building a shared libperl.so that might later be linked into
315# another application, then it might be appropriate to also build static
316# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
317# for GNU cc).
318STATIC_LDFLAGS = $static_ldflags
319
320# The following is used to include the current directory in
321# the dynamic loader path you are building a shared libperl.
322LDLIBPTH = $ldlibpth
323
324# Sometimes running an executable is an adventure.
325RUN =
326
327# When cross-compiling we want to use a (mini)perl built for the host, not the target
328HOST_PERL = $hostperl
329HOST_GENERATE = $hostgenerate
330SYSTEM_PERL = $perl
331
332# These variables may need to be manually set for non-Unix systems.
333AR = $full_ar
334HOST_EXE_EXT = $_exe
335EXE_EXT = $_exe
336LIB_EXT = $_a
337OBJ_EXT = $_o
338PATH_SEP = $p_
339
340# Macros to invoke a copy of miniperl during the build.  Targets which
341# are built using these macros should depend on \$(MINIPERL_EXE)
342MINIPERL_EXE = miniperl\$(EXE_EXT)
343MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib
344
345# Macros to invoke sort the MANIFEST during build
346MANIFEST_SRT = MANIFEST.srt
347
348!GROK!THIS!
349
350case "$useshrplib$osname" in
351truedarwin)
352	$spitshell >>$Makefile <<!GROK!THIS!
353PERL_EXE_LDFLAGS=$exeldflags
354!GROK!THIS!
355	;;
356esac
357
358case "$usecrosscompile$perl" in
359define?*)
360	$spitshell >>$Makefile <<!GROK!THIS!
361# Macros to invoke a copy of our fully operational perl during the build.
362PERL_EXE = perl\$(EXE_EXT)
363RUN_PERL = \$(LDLIBPTH) \$(RUN) $perl\$(EXE_EXT)
364!GROK!THIS!
365	;;
366*)
367	$spitshell >>$Makefile <<!GROK!THIS!
368# Macros to invoke a copy of our fully operational perl during the build.
369PERL_EXE = perl\$(EXE_EXT)
370RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) -Ilib -I.
371!GROK!THIS!
372	;;
373esac
374
375$spitshell >>$Makefile <<!GROK!THIS!
376# Macros to run our tests
377RUN_TESTS = \$(LDLIBPTH) ./runtests
378
379dynamic_ext = $dynamic_list
380dynamic_ext_re = $dynamic_ext_re
381static_ext = $static_list
382nonxs_ext = $nonxs_list
383ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
384DYNALOADER = DynaLoader\$(OBJ_EXT)
385
386libs = $perllibs $cryptlib
387
388public = \$(PERL_EXE) utilities
389
390shellflags = $shellflags
391
392# The /dev/tty or the moral equivalent.
393devtty = $devtty
394
395# This is set to  MAKE=$make if your $make command doesn't
396# do it for you.
397$make_set_make
398
399# Mention $gmake here so it gets probed for by Configure.
400
401!GROK!THIS!
402
403case "${osname}" in
404linux*|darwin)
405$spitshell >>$Makefile <<!GROK!THIS!
406# If you're going to use valgrind and it can't be invoked as plain valgrind
407# then you'll need to change this, or override it on the make command line.
408VALGRIND ?= valgrind
409VG_TEST  ?= ./perl -e 1 2>/dev/null
410
411!GROK!THIS!
412	;;
413esac
414
415case "$dtracexnolibs" in
416define) xnolibs=-xnolibs ;;
417*) xnolibs= ;;
418esac
419
420$spitshell >>$Makefile <<!GROK!THIS!
421DTRACE = $dtrace $xnolibs
422DTRACE_H = $dtrace_h
423
424DTRACE_PERLLIB_O = $dtrace_perllib_o # "dtrace -G" output for perllib_objs
425DTRACE_MINI_O    = $dtrace_mini_o    # "dtrace -G" output for common and mini
426DTRACE_MAIN_O    = $dtrace_main_o    # "dtrace -G" output for perlmain.o
427
428FIRSTMAKEFILE = $firstmakefile
429
430# Any special object files needed by this architecture, e.g. os2/os2.obj
431ARCHOBJS = $archobjs
432
433.SUFFIXES: .c \$(OBJ_EXT) .i .s
434
435# grrr
436SHELL = $sh
437
438# how to tr(anslate) newlines
439TRNL = '$trnl'
440
441OPTIMIZE = $optimize
442
443EXTRAS = $extras
444
445INSTALLPREFIXEXP = $prefix
446
447!GROK!THIS!
448# not used by Makefile but by installperl;
449# mentioned here so that metaconfig picks these up
450# $installusrbinperl
451# $versiononly
452
453case "${osname}:${osvers}" in
454darwin:*)
455$spitshell >>$Makefile <<EOF
456
457# Your locales are broken (osname $osname, osvers $osvers)
458# and to avoid the numerous
459# perl: warning: Setting locale failed.
460# warnings during the build process we reset the locale variables.
461
462LC_ALL=C
463LANG=C
464LANGUAGE=C
465EOF
466	;;
467esac
468
469## In the following dollars and backticks do not need the extra backslash.
470$spitshell >>$Makefile <<'!NO!SUBS!'
471
472CCCMD    = sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@
473
474CCCMDSRC = sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<
475
476CONFIGPM_FROM_CONFIG_SH = lib/Config.pm lib/Config_heavy.pl
477CONFIGPM = $(CONFIGPM_FROM_CONFIG_SH) lib/Config_git.pl
478
479CONFIGPOD = lib/Config.pod
480
481CONFIGH = config.h
482!NO!SUBS!
483
484SH_to_target() {
485    echo $@ | sed -e s/\\\.SH//g -e s/_/./g
486}
487
488SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
489shextract=`SH_to_target $SH`
490
491## In the following dollars and backticks do not need the extra backslash.
492$spitshell >>$Makefile <<!GROK!THIS!
493
494private = preplibrary \$(CONFIGPM) \$(CONFIGPOD) lib/buildcustomize.pl
495
496# Files to be built with variable substitution before miniperl
497# is available.
498sh = $SH
499
500shextract = $shextract
501!GROK!THIS!
502
503## In the following dollars and backticks do not need the extra backslash.
504$spitshell >>$Makefile <<'!NO!SUBS!'
505
506addedbyconf = UU $(shextract)
507
508# Unicode data files generated by mktables
509unidatafiles = lib/unicore/Decomposition.pl lib/unicore/TestProp.pl \
510	lib/unicore/CombiningClass.pl lib/unicore/Name.pl \
511	lib/unicore/UCD.pl lib/unicore/Name.pm \
512	lib/unicore/Heavy.pl lib/unicore/mktables.lst
513
514# Directories of Unicode data files generated by mktables
515unidatadirs = lib/unicore/To lib/unicore/lib
516
517h1 = EXTERN.h INTERN.h XSUB.h av.h $(CONFIGH) cop.h cv.h dosish.h
518h2 = embed.h form.h gv.h handy.h hv.h hv_func.h keywords.h mg.h op.h opcode.h
519h3 = pad.h patchlevel.h perl.h perlapi.h perly.h pp.h proto.h regcomp.h
520h4 = regexp.h scope.h sv.h unixish.h util.h iperlsys.h thread.h
521h5 = utf8.h warnings.h mydtrace.h op_reg_common.h l1_char_class_tab.h
522h6 = charclass_invlists.h
523h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6)
524
525c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro_core.c perl.c
526c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c
527c3 = taint.c toke.c util.c deb.c run.c universal.c pad.c globals.c keywords.c
528c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c dquote.c time64.c
529c5 = $(mallocsrc)
530
531c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c opmini.c perlmini.c
532
533obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro_core$(OBJ_EXT) keywords$(OBJ_EXT)
534obj2 = 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)
535obj3 = 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) caretx$(OBJ_EXT) dquote$(OBJ_EXT) time64$(OBJ_EXT)
536
537# split the objects into 3 exclusive sets: those used by both miniperl and
538# perl, and those used by just one or the other. Doesn't include the
539# actual perl(mini)main.o, nor any dtrace objects.
540
541common_objs    = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
542mini_only_objs = opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
543main_only_objs = op$(OBJ_EXT)     perl$(OBJ_EXT)
544
545miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
546perllib_objs_nodt  = $(main_only_objs) $(common_objs)
547
548!NO!SUBS!
549
550# dtrace with -G modifies the source object files, which can cause
551# dependency issues, and can cause the dtrace -G to fail on FreeBSD
552# so separate the objects generated by $(CC) from those used to link
553# the executable when dtrace -G is involved.
554#
555# $(FOO:op%os=np%ns) isn't generally portable but is portable to
556# the makes on darwin, Solaris, FreeBSD and Linux, which is where we
557# use dtrace
558
559case "$usedtrace:$dtraceobject" in
560define:define)
561    $spitshell >>$Makefile <<'!NO!SUBS!'
562
563miniperl_dtrace_objs = $(miniperl_objs_nodt:%=mpdtrace/%)
564perllib_dtrace_objs = $(perllib_objs_nodt:%=libpdtrace/%)
565perlmain_dtrace_objs = maindtrace/perlmain$(OBJ_EXT)
566
567miniperl_objs = $(miniperl_dtrace_objs) $(DTRACE_MINI_O)
568perllib_objs  = $(perllib_dtrace_objs) $(DTRACE_PERLLIB_O)
569perlmain_objs = $(perlmain_dtrace_objs) $(DTRACE_MAIN_O)
570
571miniperl_dep = $(DTRACE_MINI_O)
572perllib_dep = $(DTRACE_PERLLIB_O)
573perlmain_dep = $(DTRACE_MAIN_O)
574
575!NO!SUBS!
576    ;;
577*)
578    $spitshell >>$Makefile <<'!NO!SUBS!'
579
580miniperl_objs = $(miniperl_objs_nodt) $(DTRACE_MINI_O)
581perllib_objs  = $(perllib_objs_nodt) $(DTRACE_PERLLIB_O)
582perlmain_objs = perlmain$(OBJ_EXT) $(DTRACE_MAIN_O)
583
584miniperl_dep = $(miniperl_objs)
585perllib_dep = $(perllib_objs)
586perlmain_dep = $(perlmain_objs)
587
588!NO!SUBS!
589    ;;
590esac
591
592$spitshell >>$Makefile <<'!NO!SUBS!'
593
594perltoc_pod_prereqs = extra.pods pod/perl5282delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod
595generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs)
596generated_headers = uudmap.h bitcount.h mg_data.h
597
598lintflags = \
599    -b \
600    -n \
601    -p \
602    -Ncheck=%all \
603    -Nlevel=4 \
604    -errchk=parentheses \
605    -errhdr=%all \
606    -errfmt=src \
607    -errtags \
608    -erroff=E_ASSIGN_NARROW_CONV \
609    -erroff=E_BAD_PTR_CAST \
610    -erroff=E_BAD_PTR_CAST_ALIGN \
611    -erroff=E_BAD_PTR_INT_COMBINATION \
612    -erroff=E_BAD_SIGN_EXTEND \
613    -erroff=E_BLOCK_DECL_UNUSED \
614    -erroff=E_CASE_FALLTHRU \
615    -erroff=E_CONST_EXPR \
616    -erroff=E_CONSTANT_CONDITION \
617    -erroff=E_END_OF_LOOP_CODE_NOT_REACHED \
618    -erroff=E_EQUALITY_NOT_ASSIGNMENT \
619    -erroff=E_EXPR_NULL_EFFECT \
620    -erroff=E_FALSE_LOGICAL_EXPR \
621    -erroff=E_INCL_NUSD \
622    -erroff=E_LOOP_EMPTY \
623    -erroff=E_MAIN_PARAM \
624    -erroff=E_POINTER_TO_OBJECT \
625    -erroff=E_PTRDIFF_OVERFLOW \
626    -erroff=E_SHIFT_CNT_NEG_TOO_BIG_L \
627    -erroff=E_STATIC_UNUSED \
628    -erroff=E_TRUE_LOGICAL_EXPR
629
630.c$(OBJ_EXT):
631	@echo `$(CCCMD)` $(PLDLFLAGS) $*.c
632	@`$(CCCMD)` $(PLDLFLAGS) $*.c
633
634.c.i:	perl.h config.h
635	@echo `$(CCCMDSRC)` -E $*.c \> $*.i
636	@`$(CCCMDSRC)` -E $*.c > $*.i
637
638.c.s:	perl.h config.h
639	@echo `$(CCCMDSRC)` -S $*.c
640	@`$(CCCMDSRC)` -S $*.c
641
642all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make $(MANIFEST_SRT) common_build
643	@echo " ";
644	@echo "	Everything is up to date. Type '$(MAKE) test' to run test suite."
645
646$(MANIFEST_SRT):	MANIFEST $(PERL_EXE)
647	@$(RUN_PERL) Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \
648	    $(RUN_PERL) Porting/manisort -q -o MANIFEST; sh -c true)
649	@touch $(MANIFEST_SRT)
650
651.PHONY: all utilities
652
653# OpenBSD uses pre-generated lib/Config_git.pl and git_version.h files
654# Both git_version.h and lib/Config_git.pl are built
655# by make_patchnum.pl.
656#git_version.h: lib/Config_git.pl
657#
658#lib/Config_git.pl: $(MINIPERL_EXE) make_patchnum.pl
659#	$(MINIPERL) make_patchnum.pl
660#
661## make sure that we recompile perl.c if the git version changes
662#perl$(OBJ_EXT): git_version.h
663
664!NO!SUBS!
665
666# Making utilities requires Cwd.  If we have dynamic
667# loading, we only need miniperl and Cwd.$dlext.  If we have static
668# loading, we need to build perl first.
669case "$usedl$static_cwd" in
670defineundef)
671    util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE'
672    ;;
673definedefine)
674    util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
675    ;;
676*)  util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
677    ;;
678esac
679
680$spitshell >>$Makefile <<!GROK!THIS!
681utils/Makefile: \$(MINIPERL_EXE) \$(CONFIGPM) utils/Makefile.PL
682	\$(MINIPERL) utils/Makefile.PL
683
684utilities:	utils/Makefile $util_deps
685	@echo " "; echo "	Making utilities"; cd utils; \$(LDLIBPTH) \$(MAKE) all
686
687!GROK!THIS!
688
689$spitshell >>$Makefile <<'!NO!SUBS!'
690
691# This is now done by installman only if you actually want the man pages.
692#	@echo " "; echo "	Making docs"; cd pod; $(MAKE) all;
693
694# Phony target to force checking subdirectories.
695# Apparently some makes require an action for the FORCE target.
696.PHONY: FORCE
697FORCE:
698	@sh -c true
699!NO!SUBS!
700
701for file in op perl; do
702    if $issymlink $file.c; then
703        $spitshell >>$Makefile <<!GROK!THIS!
704
705# We do a copy of the $file.c instead of a symlink because gcc gets huffy
706# if we have a symlink forest to another disk (it complains about too many
707# levels of symbolic links, even if we have only two)
708
709${file}mini.c: $file.c
710	\$(RMS) ${file}mini.c
711	\$(CPS) ${file}.c ${file}mini.c
712!GROK!THIS!
713    else
714        $spitshell >>$Makefile <<!GROK!THIS!
715
716${file}mini.c: $file.c
717	\$(RMS) ${file}mini.c
718	\$(LNS) ${file}.c ${file}mini.c
719!GROK!THIS!
720    fi
721
722    $spitshell >>$Makefile <<!GROK!THIS!
723
724${file}mini\$(OBJ_EXT): ${file}mini.c
725	echo @\`\$(CCCMD)\` \$(PLDLFLAGS) $DPERL_IS_MINIPERL $DPERL_EXTERNAL_GLOB ${file}mini.c
726	@\`\$(CCCMD)\` \$(PLDLFLAGS) $DPERL_IS_MINIPERL $DPERL_EXTERNAL_GLOB ${file}mini.c
727!GROK!THIS!
728done
729
730$spitshell >>$Makefile <<'!NO!SUBS!'
731
732globals$(OBJ_EXT): $(generated_headers)
733
734uudmap.h mg_data.h: bitcount.h
735
736generate_uudmap$(OBJ_EXT): mg_raw.h
737
738!NO!SUBS!
739
740# If hostgerenate isn't defined, then we have to build
741# generate_uudmap and run it. This can potentially mean running
742# it on the target system if we're cross-compiling.
743# If it is defined, then we just run it locally.
744case "$hostgenerate" in
745''|'undef')
746$spitshell >>$Makefile <<!GROK!THIS!
747bitcount.h: generate_uudmap\$(HOST_EXE_EXT)
748	$run ./generate_uudmap\$(HOST_EXE_EXT) \$(generated_headers)
749	-@for f in \$(generated_headers); do \\
750	    $from \$\$f; \\
751	done
752
753!GROK!THIS!
754
755$spitshell >>$Makefile <<'!NO!SUBS!'
756generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
757	$(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs)
758
759!NO!SUBS!
760;;
761*)
762$spitshell >>$Makefile <<'!NO!SUBS!'
763bitcount.h: generate_uudmap$(HOST_EXE_EXT)
764	./generate_uudmap$(HOST_EXE_EXT) $(generated_headers)
765
766generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
767	-@rm generate_uudmap$(HOST_EXE_EXT)
768	$(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT)
769
770!NO!SUBS!
771;;
772esac
773
774case "$osname" in
775amigaos*)
776$spitshell >>$Makefile <<'!NO!SUBS!'
777perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib
778	$(MINIPERL) -MExtUtils::Miniperl -e 'writemain(\\"perlmain.c", @ARGV)' DynaLoader $(static_ext)
779
780# The file ext.libs is a list of libraries that must be linked in
781# for static extensions, e.g. -lm -lgdbm, etc.  The individual
782# static extension Makefile's add to it.
783ext.libs: $(static_ext)
784	-@test -f ext.libs || touch ext.libs
785
786!NO!SUBS!
787;;
788*)
789$spitshell >>$Makefile <<'!NO!SUBS!'
790perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib
791	$(MINIPERL) -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext)
792
793# The file ext.libs is a list of libraries that must be linked in
794# for static extensions, e.g. -lm -lgdbm, etc.  The individual
795# static extension Makefile's add to it.
796ext.libs: $(static_ext)
797	-@test -f ext.libs || touch ext.libs
798
799!NO!SUBS!
800;;
801esac
802
803# How to build libperl.  This is still rather convoluted.
804# Load up custom Makefile.SH fragment for shared loading and executables:
805case "$osname" in
806*)
807	Makefile_s="$osname/Makefile.SHs"
808	;;
809esac
810
811case "$osname" in
812aix)
813	$spitshell >>$Makefile <<!GROK!THIS!
814LIBS			= $perllibs
815# In AIX we need to change this for building Perl itself from
816# its earlier definition (which is for building external
817# extensions *after* Perl has been built and installed)
818CCDLFLAGS		= `echo $ccdlflags|sed -e 's@-bE:.*/perl\.exp@-bE:perl.exp@'`
819
820!GROK!THIS!
821	case "$useshrplib" in
822	define|true|[yY]*)
823		$spitshell >>$Makefile <<'!NO!SUBS!'
824
825LIBPERL_NONSHR		= libperl_nonshr$(LIB_EXT)
826MINIPERL_NONSHR		= miniperl_nonshr$(EXE_EXT)
827
828#$(LIBPERL_NONSHR): $(perllib_objs)
829#	$(RMS) $(LIBPERL_NONSHR)
830#	$(AR) rc $(LIBPERL_NONSHR) $(perllib_objs)
831
832$(MINIPERL_NONSHR): miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT)  perlmini$(OBJ_EXT)
833	$(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \
834	    opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS)
835
836MINIPERLEXP		= $(MINIPERL_NONSHR)
837
838LIBPERLEXPORT		= perl.exp
839
840!NO!SUBS!
841
842		;;
843	*)
844		$spitshell >>$Makefile <<'!NO!SUBS!'
845MINIPERLEXP		= $(MINIPERL_EXE)
846
847PERLEXPORT		= perl.exp
848
849!NO!SUBS!
850	;;
851	esac
852	$spitshell >>$Makefile <<'!NO!SUBS!'
853perl.exp: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH)
854	$(MINIPERL) makedef.pl --sort-fold PLATFORM=aix CC_FLAGS="$(OPTIMIZE)" > perl.exp
855
856!NO!SUBS!
857	;;
858os2)
859	$spitshell >>$Makefile <<'!NO!SUBS!'
860MINIPERLEXP		= miniperl
861
862perl5.def: $(MINIPERLEXP) makedef.pl $(CONFIGPM) $(SYM) $(SYMH) miniperl.map
863	$(MINIPERL) makedef.pl PLATFORM=os2 -DPERL_DLL=$(PERL_DLL) CC_FLAGS="$(OPTIMIZE)" > perl5.def
864
865!NO!SUBS!
866	;;
867cygwin)
868	$spitshell >>$Makefile <<'!NO!SUBS!'
869cygwin.c: cygwin/cygwin.c
870	$(LNS) cygwin/cygwin.c
871
872LIBPERL_NONSHR		= libperl$(LIB_EXT)
873
874$(LIBPERL_NONSHR): $(perllib_objs)
875	$(RMS) $(LIBPERL_NONSHR)
876	$(AR) rc $(LIBPERL_NONSHR) $(perllib_objs)
877
878!NO!SUBS!
879	;;
880esac
881
882if test -s $Makefile_s ; then
883	. $Makefile_s
884	$spitshell >>$Makefile <<!GROK!THIS!
885
886Makefile: $Makefile_s
887!GROK!THIS!
888else
889	case "$dtrace_h" in
890	?*)
891		$spitshell >>$Makefile <<'!NO!SUBS!'
892# dtrace dicards const qualifiers from arguments, put them back
893$(DTRACE_H): perldtrace.d
894	$(DTRACE) -h -s perldtrace.d -o $(DTRACE_H).in
895	sed -e '/const/!s/char \*/const char */g' $(DTRACE_H).in >$(DTRACE_H)
896	$(RMS) $(DTRACE_H).in
897
898mydtrace.h: $(DTRACE_H)
899
900!NO!SUBS!
901		;;
902	esac
903	case "$dtraceobject" in
904	define)
905		$spitshell >>$Makefile <<'!NO!SUBS!'
906$(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt)
907	-rm -rf mpdtrace
908	mkdir mpdtrace
909	cp $(miniperl_objs_nodt) mpdtrace/
910	$(DTRACE) -G -s perldtrace.d -o $(DTRACE_MINI_O) $(miniperl_dtrace_objs)
911
912$(DTRACE_PERLLIB_O): perldtrace.d $(perllib_objs_nodt)
913	-rm -rf libpdtrace
914	mkdir libpdtrace
915	cp $(perllib_objs_nodt) libpdtrace/
916	$(DTRACE) -G -s perldtrace.d -o $(DTRACE_PERLLIB_O) $(perllib_dtrace_objs)
917
918$(DTRACE_MAIN_O): perldtrace.d perlmain$(OBJ_EXT)
919	-rm -rf maindtrace
920	mkdir maindtrace
921	cp perlmain$(OBJ_EXT) maindtrace/
922	$(DTRACE) -G -s perldtrace.d -o $(DTRACE_MAIN_O) $(perlmain_dtrace_objs) ||	      \
923	  ( $(ECHO) "No probes in perlmain$(OBJ_EXT), generating a dummy $(DTRACE_MAIN_O)" && \
924	    $(ECHO) >dtrace_main.c &&							      \
925	    `$(CCCMD)` $(PLDLFLAGS) dtrace_main.c &&					      \
926	     rm -f dtrace_main.c )
927
928!NO!SUBS!
929		;;
930    esac
931#	$spitshell >>$Makefile <<'!NO!SUBS!'
932#$(LIBPERL): $& $(perllib_dep) $(DYNALOADER) $(LIBPERLEXPORT)
933#!NO!SUBS!
934#	case "$useshrplib" in
935#	true)
936#		$spitshell >>$Makefile <<'!NO!SUBS!'
937#	rm -f $@
938#	$(LD) -o $@ $(SHRPLDFLAGS) $(perllib_objs) $(DYNALOADER) $(libs)
939#!NO!SUBS!
940#		case "$osname" in
941#		aix)
942#			$spitshell >>$Makefile <<'!NO!SUBS!'
943#	rm -f libperl$(OBJ_EXT)
944#	mv $@ libperl$(OBJ_EXT)
945#	$(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
946#!NO!SUBS!
947#			;;
948#		esac
949#		;;
950#	*)
951#		$spitshell >>$Makefile <<'!NO!SUBS!'
952#	rm -f $(LIBPERL)
953#	$(AR) rc $(LIBPERL) $(perllib_objs) $(DYNALOADER)
954#	@$(ranlib) $(LIBPERL)
955#!NO!SUBS!
956#		;;
957#	esac
958	$spitshell >>$Makefile <<'!NO!SUBS!'
959
960# How to build executables.
961
962# The $& notation tells Sequent machines that it can do a parallel make,
963# and is harmless otherwise.
964# The miniperl -w -MExporter line is a basic cheap test to catch errors
965# before make goes on to run preplibrary and then MakeMaker on extensions.
966# This is very handy because later errors are often caused by miniperl
967# build problems but that's not obvious to the novice.
968# The Module used here must not depend on Config or any extensions.
969
970# The seemingly cranky ordering of having $(MINIPERL_EXE) depend on
971# lib/buildcustomize.pl despite the reality that lib/buildcustomize.pl needs
972# miniperl to exist first permits us to
973# a) have one rule generate both miniperl and lib/buildcustomize.pl
974#    (so that lib/buildcustomize.pl is always available. This simplifies things)
975# b) have the rest of the Makefile depend on the more obvious $(MINIPERL_EXE)
976
977$(MINIPERL_EXE): lib/buildcustomize.pl
978
979!NO!SUBS!
980
981	case "${osname}${osvers}" in
982	amigaos*)
983		$spitshell >>$Makefile <<'!NO!SUBS!'
984lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
985	-@rm -f miniperl.xok
986	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
987	    $(miniperl_objs) $(libs)
988#	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
989	$(MINIPERL) -f write_buildcustomize.pl
990!NO!SUBS!
991		;;
992	aix*)
993		$spitshell >>$Makefile <<'!NO!SUBS!'
994lib/buildcustomize.pl: $& $(miniperl_objs)
995	$(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(miniperl_objs) $(libs)
996	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
997	$(MINIPERL) -f write_buildcustomize.pl
998!NO!SUBS!
999		;;
1000	next4*)
1001		$spitshell >>$Makefile <<'!NO!SUBS!'
1002lib/buildcustomize.pl: $& $(miniperl_objs) write    ldcustomize.pl
1003	$(CC) -o $(MINIPERL_EXE) $(miniperl_objs    libs)
1004	$(LDLIBPTH) ./miniperl$(HOST    _EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
1005	$(MINIPERL) -f write_buildcustomize.pl
1006!NO!SUBS!
1007		;;
1008	darwin*)
1009		case "$osvers" in
1010		[1-6].*) ;;
1011		*) case "$ldflags" in
1012		    *"-flat_namespace"*) ;;
1013		    *) # to allow opmini.o to override stuff in libperl.dylib
1014		$spitshell >>$Makefile <<!NO!SUBS!
1015NAMESPACEFLAGS = -force_flat_namespace
1016!NO!SUBS!
1017		       ;;
1018		    esac
1019		    ;;
1020		esac
1021		$spitshell >>$Makefile <<'!NO!SUBS!'
1022lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
1023	$(MINIPERL) -f write_buildcustomize.pl
1024!NO!SUBS!
1025		;;
1026	*)
1027		if test "X$hostperl" != X; then
1028			$spitshell >>$Makefile <<!GROK!THIS!
1029lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl
1030	-@rm -f miniperl.xok
1031	-@rm \$(MINIPERL_EXE)
1032	\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
1033	\$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
1034	\$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
1035!GROK!THIS!
1036		else
1037			$spitshell >>$Makefile <<'!NO!SUBS!'
1038lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
1039	-@rm -f miniperl.xok
1040	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
1041	    $(miniperl_objs) $(libs)
1042	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
1043	$(MINIPERL) -f write_buildcustomize.pl
1044!NO!SUBS!
1045		fi
1046		;;
1047	esac
1048
1049	$spitshell >>$Makefile <<'!NO!SUBS!'
1050
1051$(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
1052	-@rm -f miniperl.xok
1053!NO!SUBS!
1054
1055        case $osname in
1056	# In AmigaOS the Perl executable needs to be linked with -ldl,
1057	# but none of the other executables should be.
1058        amigaos) $spitshell >>$Makefile <<'!NO!SUBS!'
1059	$(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs) -ldl
1060!NO!SUBS!
1061        ;;
1062        os390) $spitshell >>$Makefile <<'!NO!SUBS!'
1063	$(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
1064!NO!SUBS!
1065        ;;
1066
1067	darwin)
1068	    case "$useshrplib$osvers" in
1069	    true1[5-9]*|true[2-9]*) $spitshell >>$Makefile <<'!NO!SUBS!'
1070	$(SHRPENV) $(CC) -o perl $(PERL_EXE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
1071!NO!SUBS!
1072	       ;;
1073	    *) $spitshell >>$Makefile <<'!NO!SUBS!'
1074	$(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
1075!NO!SUBS!
1076	       ;;
1077	    esac
1078        ;;
1079
1080        *) $spitshell >>$Makefile <<'!NO!SUBS!'
1081	$(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
1082!NO!SUBS!
1083        ;;
1084        esac
1085
1086	$spitshell >>$Makefile <<'!NO!SUBS!'
1087
1088# Microperl.  This is just a convenience thing if one happens to
1089# build also the full Perl and therefore the real big Makefile:
1090# usually one should manually explicitly issue the below command.
1091
1092.PHONY: microperl
1093microperl:
1094	$(MAKE) -f Makefile.micro
1095
1096!NO!SUBS!
1097
1098fi
1099
1100# Some environment have no system(), which mkpport uses.
1101# Let's try running the commands with shell.
1102case "${osname}" in
1103catamount)
1104$spitshell >>$Makefile <<!GROK!THIS!
1105.PHONY: makeppport
1106makeppport: \$(MINIPERL_EXE) \$(CONFIGPM)
1107	-@for f in Makefile.PL PPPort_pm.PL PPPort_xs.PL ppport_h.PL; do \
1108	(cd ext/Devel-PPPort && `pwd`/run.sh ../../$(MINIPERL_EXE) -I../../lib \$\$f); \
1109	done
1110
1111!GROK!THIS!
1112;;
1113*)
1114$spitshell >>$Makefile <<'!NO!SUBS!'
1115.PHONY: makeppport
1116makeppport: $(MINIPERL_EXE) $(CONFIGPM) $(nonxs_ext)
1117	$(MINIPERL) mkppport
1118
1119!NO!SUBS!
1120;;
1121esac
1122
1123$spitshell >>$Makefile <<'!NO!SUBS!'
1124
1125.PHONY: preplibrary common_build
1126preplibrary: $(MINIPERL_EXE) $(CONFIGPM) $(PREPLIBRARY_LIBPERL)
1127
1128$(CONFIGPM_FROM_CONFIG_SH): $(CONFIGPOD)
1129
1130$(CONFIGPOD): config.sh $(MINIPERL_EXE) configpm Porting/Glossary lib/Config_git.pl
1131	$(MINIPERL) configpm
1132
1133unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data
1134
1135uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
1136	touch uni.data
1137
1138# $(PERL_EXE) and ext because pod_lib.pl needs Digest::MD5
1139# But also this ensures that all extensions are built before we try to scan
1140# them, which picks up Devel::PPPort's documentation.
1141pod/perltoc.pod: $(perltoc_pod_prereqs) $(PERL_EXE) $(ext) pod/buildtoc
1142	$(RUN_PERL) -f pod/buildtoc -q
1143
1144pod/perlapi.pod: pod/perlintern.pod
1145
1146pod/perlintern.pod: $(MINIPERL_EXE) autodoc.pl embed.fnc
1147	$(MINIPERL) autodoc.pl
1148
1149pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST
1150	$(MINIPERL) pod/perlmodlib.PL -q
1151
1152pod/perl5282delta.pod: pod/perldelta.pod
1153	$(RMS) pod/perl5282delta.pod
1154	$(LNS) perldelta.pod pod/perl5282delta.pod
1155
1156extra.pods: $(MINIPERL_EXE)
1157	-@test ! -f extra.pods || rm -f `cat extra.pods`
1158	-@rm -f extra.pods
1159	-@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
1160	    nx=`echo $$x | sed -e "s/README\.//"`; \
1161	    $(LNS) ../$$x "pod/perl"$$nx".pod" ; \
1162	    echo "pod/perl"$$nx".pod" >> extra.pods ; \
1163	done
1164
1165extras.make: $(PERL_EXE)
1166	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
1167
1168extras.test: $(PERL_EXE)
1169	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
1170
1171extras.install: $(PERL_EXE)
1172	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
1173
1174.PHONY: install install-strip install-all install-verbose install-silent \
1175	no-install install.perl install.man install.html
1176
1177# Set this to an empty string to avoid an attempt of rebuild before install
1178INSTALL_DEPENDENCE = all
1179
1180no_install no-install: install-notify
1181
1182install: install-all
1183!NO!SUBS!
1184
1185if test "$storable_type" != "" ; then
1186
1187case "$static_cwd" in
1188undef) storable_limit_dep="$storable_limit_dep lib/auto/Cwd/Cwd.$dlext" ;;
1189esac
1190
1191$spitshell >>$Makefile <<EOT
1192
1193dist/Storable/lib/Storable/Limit.pm : \$(PERL_EXE) dist/Storable/stacksize $storable_limit_dep
1194	cd dist/Storable ; \$(LDLIBPTH) \$(MAKE) lib/Storable/Limit.pm
1195
1196lib/Storable/Limit.pm : dist/Storable/lib/Storable/Limit.pm
1197	test -d lib/Storable || mkdir lib/Storable
1198	cp dist/Storable/lib/Storable/Limit.pm lib/Storable/Limit.pm
1199EOT
1200
1201common_build_deps="$common_build_deps lib/Storable/Limit.pm"
1202
1203fi
1204
1205for name in all notify silent strip verbose; do
1206    flags="--$name";
1207    flags=`echo $flags | sed -e 's/--all//'`
1208    if test "X$hostperl" != X; then
1209        $spitshell >>$Makefile <<EOT
1210
1211install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman
1212	\$(HOST_PERL) installperl --destdir=\$(DESTDIR) $flags \$(INSTALLFLAGS) \$(STRIPFLAGS)
1213	\$(HOST_PERL) installman --destdir=\$(DESTDIR) $flags
1214EOT
1215    else
1216        $spitshell >>$Makefile <<EOT
1217
1218install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman
1219	\$(RUN_PERL) installperl --destdir=\$(DESTDIR) $flags \$(INSTALLFLAGS) \$(STRIPFLAGS)
1220	\$(RUN_PERL) installman --destdir=\$(DESTDIR) $flags
1221EOT
1222    fi
1223
1224    test $name = notify || echo '	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '\''@ARGV&&install(@ARGV)'\'' `cat extras.lst`' >>$Makefile
1225done
1226
1227if test "X$hostperl" != X; then
1228	LOCAL_PERL='$(HOST_PERL)'
1229	$spitshell >>$Makefile <<'!NO!SUBS!'
1230install.perl:	$(INSTALL_DEPENDENCE) installperl
1231	$(HOST_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
1232	-@test ! -s extras.lst || $(MAKE) extras.install
1233!NO!SUBS!
1234else
1235	LOCAL_PERL='$(RUN_PERL)'
1236	$spitshell >>$Makefile <<'!NO!SUBS!'
1237install.perl:	$(INSTALL_DEPENDENCE) installperl
1238	$(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
1239	-@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
1240
1241!NO!SUBS!
1242fi
1243
1244$spitshell >>$Makefile <<!GROK!THIS!
1245install.man:	all installman
1246	${LOCAL_PERL} installman --destdir=\$(DESTDIR) \$(INSTALLFLAGS)
1247
1248# XXX Experimental. Hardwired values, but useful for testing.
1249# Eventually Configure could ask for some of these values.
1250install.html: all installhtml
1251	-@test -f README.vms && cd vms && \$(LNS) ../README.vms README_vms.pod && cd ..
1252	${LOCAL_PERL} installhtml   \\
1253      --podroot=. --podpath=. --recurse  \\
1254      --htmldir=\$(privlib)/html   \\
1255      --splithead=pod/perlipc     \\
1256      --splititem=pod/perlfunc    \\
1257      --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \\
1258      --verbose
1259!GROK!THIS!
1260
1261$spitshell >>$Makefile <<'!NO!SUBS!'
1262
1263# I now supply perly.c with the kits, so the following section is
1264# used only if you force bison to run by saying
1265# 	make regen_perly
1266# You normally shouldn't remake perly.[ch].
1267
1268.PHONY: regen_perly
1269
1270run_byacc run-byacc:
1271	@echo "run_byacc is obsolete; try 'make regen_perly' instead"
1272
1273# this outputs perly.h, perly.act and perly.tab
1274regen_perly regen-perly:
1275	perl regen_perly.pl
1276
1277# We don't want to regenerate perly.c and perly.h, but they might
1278# appear out-of-date after a patch is applied or a new distribution is
1279# made.
1280perly.c: perly.y
1281	-@sh -c true
1282
1283perly.h: perly.y
1284	-@sh -c true
1285
1286SYM  = globvar.sym perlio.sym
1287
1288SYMH = perlvars.h intrpvar.h
1289
1290CHMOD_W = chmod +w
1291
1292# The following files are generated automatically
1293#	embed.pl:	proto.h embed.h embedvar.h perlapi.h perlapi.c
1294#	opcode.pl:	opcode.h opnames.h pp_proto.h
1295#	regcomp.pl:	regnodes.h
1296#	warnings.pl:	warnings.h lib/warnings.pm
1297#	feature.pl:	feature.h lib/feature.pm
1298# The correct versions should be already supplied with the perl kit,
1299# in case you don't have perl available.
1300# To force them to be regenerated, run
1301#       perl regen.pl
1302# with your existing copy of perl
1303# (make regen_headers is kept for backwards compatibility)
1304
1305.PHONY: regen_headers regen_all
1306
1307regen:	FORCE
1308	-perl regen.pl
1309	-perl regen/uconfig_h.pl
1310
1311regen_headers regen-headers:	FORCE
1312	-perl regen.pl -v
1313	-perl regen/uconfig_h.pl -v
1314
1315regen_meta regen-meta:  META.yml META.json
1316
1317META.yml:   FORCE
1318	PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -y
1319
1320META.json:   FORCE
1321	PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -j
1322
1323
1324regen_all regen-all: regen regen_meta
1325
1326.PHONY:	manisort manicheck
1327
1328manisort:	FORCE
1329	@perl Porting/manisort -q || (echo "WARNING: re-sorting MANIFEST"; \
1330		perl Porting/manisort -q -o MANIFEST; sh -c true)
1331
1332manicheck:	FORCE
1333	perl Porting/manicheck
1334
1335# Extensions:
1336# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
1337# automatically get built.  There should ordinarily be no need to change
1338# any of this part of makefile.
1339#
1340# The dummy dependency is a place holder in case $(dynamic_ext) or
1341# $(static_ext) is empty.
1342#
1343# DynaLoader may be needed for extensions that use Makefile.PL.
1344
1345$(DYNALOADER):	$(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE $(nonxs_ext)
1346	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
1347
1348d_dummy $(dynamic_ext):	$(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) $(LIBPERL)
1349	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
1350
1351s_dummy $(static_ext):	$(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
1352	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
1353
1354n_dummy $(nonxs_ext):	$(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE
1355	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL)
1356!NO!SUBS!
1357
1358$spitshell >>$Makefile <<EOF
1359$extra_dep
1360EOF
1361
1362$spitshell >>$Makefile <<'!NO!SUBS!'
1363
1364.PHONY: printconfig
1365printconfig:
1366	@eval `$(RUN_PERL) -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
1367
1368.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
1369	realclean _realcleaner clobber _clobber \
1370	distclean veryclean _verycleaner
1371
1372clean:		realclean
1373
1374realclean:	_realcleaner _mopup
1375	@echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
1376
1377_clobber:
1378	-@rm -f Cross/run-* Cross/to-* Cross/from-* Cross/mkdir
1379	-rm -rf host
1380	rm -f t/test_state
1381	rm -f config.sh cppstdin Policy.sh extras.lst
1382	rm -f $(MANIFEST_SRT)
1383
1384clobber:	_realcleaner _mopup _clobber
1385
1386distclean:	clobber
1387
1388# Like distclean but also removes emacs backups and *.orig.
1389veryclean:	_verycleaner _mopup _clobber
1390	-@rm -f Obsolete Wanted
1391
1392# Do not 'make _mopup' directly.
1393_mopup:
1394	rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c perlmini.c generate_uudmap$(EXE_EXT) $(generated_headers)
1395	-rmdir .depending
1396	-@test -f extra.pods && rm -f `cat extra.pods`
1397	-@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
1398	-rm -f perl.exp ext.libs $(generated_pods) uni.data opmini.o perlmini.o pod/roffitall
1399	-rm -f perl.export perl.dll perl.libexp perl.map perl.def
1400	-rm -f *perl.xok
1401	-rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
1402	-rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
1403	-rm -f $(DTRACE_H)
1404
1405_cleaner1:
1406	-cd os2; rm -f Makefile
1407	-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
1408	-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
1409	-@if test -f $(MINIPERL_EXE) ; then \
1410	for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
1411	$(MINIPERL) make_ext.pl --target=$(CLEAN) $$x MAKE="$(MAKE)" ; \
1412	done ; \
1413	else \
1414	sh $(CLEAN).sh ; \
1415	fi
1416	rm -f realclean.sh veryclean.sh
1417	-rm -f `grep -v ^# mkppport.lst | grep . | sed -e 's/$$/\/ppport.h/'`
1418
1419# Dear POSIX, thanks for making the default to xargs to be
1420# run once if nothhing is passed in. It is such a great help.
1421
1422# Some systems do not support "?", so keep these files separate.
1423_cleaner2:
1424	-rm -f core.*perl.*.? t/core.perl.*.? .?*.c
1425	rm -f core *perl.core t/core t/*perl.core core.* t/core.*
1426	rm -f t/$(PERL_EXE) t/rantests
1427	rm -rf t/tmp*
1428	rm -rf $(addedbyconf)
1429	rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old utils/Makefile
1430	rm -f $(private)
1431	rm -rf $(unidatafiles) $(unidatadirs)
1432	rm -rf lib/auto
1433	rm -f lib/.exists lib/*/.exists lib/*/*/.exists
1434	rm -f h2ph.man
1435	rm -rf .config
1436	rm -f preload
1437	rm -f pod2htmd.tmp
1438	rm -rf pod/perlfunc pod/perlipc
1439	-rmdir ext/B/lib
1440	rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
1441	-rmdir lib/version lib/threads lib/inc/ExtUtils lib/inc lib/encoding
1442	-rmdir lib/autodie/exception lib/autodie/Scope lib/autodie lib/XS
1443	-rmdir lib/Win32API lib/VMS lib/Unicode/Collate/Locale
1444	-rmdir lib/Unicode/Collate/CJK lib/Unicode/Collate lib/Tie/Hash
1445	-rmdir lib/Thread lib/Text lib/Test2/Util lib/Test2/Tools
1446	-rmdir lib/Test2/IPC/Driver lib/Test2/IPC lib/Test2/Hub/Interceptor
1447	-rmdir lib/Test2/Hub lib/Test2/Formatter lib/Test2/EventFacet
1448	-rmdir lib/Test2/Event/TAP lib/Test2/Event lib/Test2/API lib/Test2
1449	-rmdir lib/Test/use lib/Test/Tester lib/Test/Builder/Tester
1450	-rmdir lib/Test/Builder/IO lib/Test/Builder lib/Test lib/Term
1451	-rmdir lib/TAP/Parser/YAMLish lib/TAP/Parser/SourceHandler
1452	-rmdir lib/TAP/Parser/Scheduler lib/TAP/Parser/Result
1453	-rmdir lib/TAP/Parser/Iterator lib/TAP/Parser lib/TAP/Harness
1454	-rmdir lib/TAP/Formatter/File lib/TAP/Formatter/Console
1455	-rmdir lib/TAP/Formatter lib/TAP lib/Sys/Syslog lib/Sys lib/Sub
1456	-rmdir lib/Search lib/Scalar lib/Pod/Text lib/Pod/Simple
1457	-rmdir lib/Pod/Perldoc lib/PerlIO/via lib/PerlIO lib/Perl
1458	-rmdir lib/Parse/CPAN lib/Parse lib/Params lib/OpenBSD lib/Net/FTP
1459	-rmdir lib/Module/Load lib/Module/CoreList lib/Module lib/Memoize
1460	-rmdir lib/Math/BigInt lib/Math/BigFloat lib/Math lib/MIME
1461	-rmdir lib/Locale/Maketext lib/Locale/Codes lib/Locale lib/List/Util
1462	-rmdir lib/List lib/JSON/PP lib/JSON lib/IPC lib/IO/Uncompress/Adapter
1463	-rmdir lib/IO/Uncompress lib/IO/Socket lib/IO/Compress/Zlib
1464	-rmdir lib/IO/Compress/Zip lib/IO/Compress/Gzip lib/IO/Compress/Base
1465	-rmdir lib/IO/Compress/Adapter lib/IO/Compress lib/IO
1466	-rmdir lib/I18N/LangTags lib/I18N lib/Hash/Util lib/Hash lib/HTTP
1467	-rmdir lib/Filter/Util lib/Filter lib/File/Spec lib/ExtUtils/Typemaps
1468	-rmdir lib/ExtUtils/ParseXS lib/ExtUtils/MakeMaker/version
1469	-rmdir lib/ExtUtils/MakeMaker lib/ExtUtils/Liblist
1470	-rmdir lib/ExtUtils/Constant lib/ExtUtils/Command
1471	-rmdir lib/ExtUtils/CBuilder/Platform/Windows
1472	-rmdir lib/ExtUtils/CBuilder/Platform lib/ExtUtils/CBuilder
1473	-rmdir lib/Exporter lib/Encode/Unicode lib/Encode/MIME/Header
1474	-rmdir lib/Encode/MIME lib/Encode/KR lib/Encode/JP lib/Encode/CN
1475	-rmdir lib/Encode lib/Digest lib/Devel lib/Data lib/Config/Perl
1476	-rmdir lib/Compress/Raw lib/Compress lib/Carp lib/CPAN/Plugin
1477	-rmdir lib/CPAN/Meta/History lib/CPAN/Meta lib/CPAN/LWP
1478	-rmdir lib/CPAN/Kwalify lib/CPAN/HTTP lib/CPAN/FTP lib/CPAN/Exception
1479	-rmdir lib/CPAN/API lib/CPAN lib/Attribute lib/Archive/Tar lib/Archive
1480	-rmdir lib/App/Prove/State/Result lib/App/Prove/State lib/App/Prove
1481	-rmdir lib/App lib/Amiga
1482
1483_realcleaner:
1484	@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=distclean
1485	@$(LDLIBPTH) $(MAKE) _cleaner2
1486
1487_verycleaner:
1488	@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1489	@$(LDLIBPTH) $(MAKE) _cleaner2
1490	-rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
1491
1492.PHONY: lint
1493lint: $(c)
1494	rm -f *.ln
1495	lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
1496
1497cscopeflags = -Rb  # Recursive, build-only.
1498
1499.PHONY:	cscope
1500# To query the cscope.out "cscope -dLnsymbol" where n = 0 means uses,
1501# 1 = definitions, 2 = callees, 3 = callers, for example
1502# "cscope -dL1Perl_mg_set" or run cscope interactively (no arguments).
1503cscope.out cscope: $(c) $(h)
1504	cscope $(cscopeflags)
1505
1506# Need to unset during recursion to go out of loop.
1507# The README below ensures that the dependency list is never empty and
1508# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
1509
1510MAKEDEPEND = Makefile makedepend
1511
1512$(FIRSTMAKEFILE):	README $(MAKEDEPEND)
1513	$(MAKE) depend MAKEDEPEND=
1514!NO!SUBS!
1515
1516for f in $SH; do
1517    file=`SH_to_target $f`
1518    $spitshell >>$Makefile <<!GROK!THIS!
1519
1520$file: $f config.sh
1521	\$(SHELL) $f
1522!GROK!THIS!
1523done
1524
1525$spitshell >>$Makefile <<'!NO!SUBS!'
1526
1527.PHONY: depend
1528depend: makedepend $(DTRACE_H) $(generated_headers)
1529	sh ./makedepend MAKE="$(MAKE)" cflags
1530
1531.PHONY: test check test_prep test_prep_nodll test_prep_pre \
1532	test_prep_reonly test_tty test-tty test_notty test-notty \
1533	test_harness test_harness_notty minitest test-reonly _test
1534
1535# The _test target is there just for Test::Smoke, which does a make test_prep
1536# always before invoking this target, thus preventing checking again
1537_test:
1538	$(RUN_TESTS) choose
1539
1540# Cannot delegate rebuilding of t/perl to make
1541# to allow interlaced test and minitest
1542
1543# Architecture-neutral stuff:
1544
1545test_prep_pre: preplibrary utilities $(nonxs_ext)
1546!NO!SUBS!
1547
1548case "$targethost" in
1549'') $spitshell >>$Makefile <<'!NO!SUBS!'
1550test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
1551	$(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) common_build
1552	cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
1553
1554!NO!SUBS!
1555;;
1556*) $spitshell >>$Makefile <<!GROK!THIS!
1557test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE) \
1558	\$(dynamic_ext) \$(TEST_PERL_DLL) runtests \
1559	\$(generated_pods) common_build
1560	$to libperl.*
1561	$to t/*
1562	$to lib/*
1563	$to TestInit.pm
1564	$to win32/FindExt.pm
1565	$to regen/*
1566	$to pod/*
1567	$to MANIFEST
1568	$to Porting/*
1569	$to cpan/*/t
1570	$to dist/*/t
1571	$to ext/*/t
1572	$to cpan/Archive-Tar/*
1573	$to cpan/Module-Metadata/*
1574	$to cpan/Term-Cap/test.pl
1575	$to cpan/Pod-Usage/*
1576	$to cpan/Pod-Parser/*
1577	$to cpan/IO-Compress/*
1578	$to cpan/HTTP-Tiny/lib/*
1579	$to cpan/Filter-Util-Call/filter-util.pl
1580	$to cpan/Digest-MD5/*
1581	$to cpan/Digest-SHA/*
1582	$to cpan/Test-Simple/*
1583	$to cpan/Pod-Parser/lib/*
1584	$to cpan/Test-Harness/*
1585	$to cpan/Scalar-List-Utils/*
1586	$to ext/IPC-Open3/*
1587	$to ext/Tie-Memoize/*
1588	$to ext/POSIX/*
1589	$to dist/IO/*
1590# --- These three are needed by ExtUtils::MM_Unix to verify PERL_CORE
1591	$to config_h.SH
1592	$to perl.h
1593	$to cflags
1594	$to *.h
1595# --- For t/porting/customized.t
1596	$to vutil.c
1597	$to vxs.inc
1598# --- For t/TEST
1599	$to config.sh
1600# --- For lib/diagnostics.t with -Duseshrplib
1601	$to \$(PERL_EXE)
1602	cd t && (rm -f \$(PERL_EXE); \$(LNS) ../\$(PERL_EXE) \$(PERL_EXE)) && cd ..
1603	$to t/\$(PERL_EXE)
1604
1605!GROK!THIS!
1606;;
1607esac
1608
1609$spitshell >>$Makefile <<'!NO!SUBS!'
1610test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL)
1611	$(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
1612	cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
1613!NO!SUBS!
1614
1615case "$targethost" in
1616'') $spitshell >>$Makefile <<'!NO!SUBS!'
1617
1618test check: test_prep
1619	$(RUN_TESTS) choose
1620
1621!NO!SUBS!
1622;;
1623*) $spitshell >>$Makefile <<!GROK!THIS!
1624
1625test check: test_prep
1626	$run -cwd $targetdir/t -env "$targetenv LD_LIBRARY_PATH=$targetdir:$targetdir/lib:$targetdir/lib/auto:\$\$LD_LIBRARY_PATH" ./TEST
1627
1628!GROK!THIS!
1629;;
1630esac
1631
1632$spitshell >>$Makefile <<'!NO!SUBS!'
1633test_tty test-tty: test_prep
1634	$(RUN_TESTS) tty
1635
1636test_notty test-notty: test_prep
1637	$(RUN_TESTS) no-tty
1638
1639!NO!SUBS!
1640
1641case "${osname}${osvers}" in
1642linux*|darwin*)
1643	$spitshell >>$Makefile <<'!NO!SUBS!'
1644# Targets for valgrind testing:
1645
1646test.valgrind check.valgrind:	test_prep
1647	@echo "Checking usemymalloc='n' in config.sh..."
1648	@grep "^usemymalloc="    config.sh
1649	@grep "^usemymalloc='n'" config.sh >/dev/null || exit 1
1650	@echo "And of course you have to have valgrind..."
1651	$(VALGRIND) $(VG_TEST) || exit 1
1652	PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' TESTFILE=harness $(RUN_TESTS) choose
1653!NO!SUBS!
1654	;;
1655esac
1656
1657$spitshell >>$Makefile <<'!NO!SUBS!'
1658
1659# minitest can't depend on lib/Config.pm because that might be where miniperl
1660# is crashing.
1661minitest_prep:
1662	-@test -f lib/Config.pm || $(MAKE) lib/Config.pm $(unidatafiles)
1663	@echo " "
1664	@echo "You may see some irrelevant test failures if you have been unable"
1665	@echo "to build lib/Config.pm, or the Unicode data files."
1666	@echo " "
1667	- cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE))
1668
1669MINITEST_TESTS = base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t
1670
1671minitest: $(MINIPERL_EXE) minitest_prep
1672	- cd t && $(RUN_PERL) TEST $(MINITEST_TESTS) <$(devtty)
1673
1674minitest-notty minitest_notty: $(MINIPERL_EXE) minitest_prep
1675	- cd t && PERL_SKIP_TTY_TEST=1 $(RUN_PERL) TEST $(MINITEST_TESTS)
1676
1677# Test via harness
1678
1679test_harness test-harness: test_prep
1680	TESTFILE=harness $(RUN_TESTS) choose
1681
1682test_harness_notty: test_prep
1683	HARNESS_NOTTY=1 TESTFILE=harness $(RUN_TESTS) choose
1684
1685test_reonly test-reonly: test_prep_reonly
1686	TEST_ARGS='-re \bre\/' TESTFILE=harness $(RUN_TESTS) choose
1687
1688
1689# Porting tests (well-formedness of pod, manifest, etc)
1690
1691test_porting test-porting: test_prep
1692	cd t && $(RUN_PERL) harness porting/*.t ../lib/diagnostics.t
1693
1694!NO!SUBS!
1695
1696$spitshell>>$Makefile <<!GROK!THIS!
1697
1698# intended as a common way to add dependencies to test-prep and all
1699common_build: $common_build_deps
1700
1701!GROK!THIS!
1702
1703$spitshell >>$Makefile <<'!NO!SUBS!'
1704
1705# Handy way to run perlbug -ok without having to install and run the
1706# installed perlbug. We don't re-run the tests here - we trust the user.
1707# Please *don't* use this unless all tests pass.
1708# If you want to report test failures, use "make nok" instead.
1709
1710.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1711
1712ok:	utilities
1713	$(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)'
1714
1715okfile:	utilities
1716	$(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
1717
1718oknack:	utilities
1719	$(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -A
1720
1721okfilenack:	utilities
1722	$(RUN_PERL) utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1723
1724nok:	utilities
1725	$(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)'
1726
1727nokfile:	utilities
1728	$(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1729
1730noknack:	utilities
1731	$(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -A
1732
1733nokfilenack:	utilities
1734	$(RUN_PERL) utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1735
1736.PHONY: clist hlist
1737
1738clist:	$(c)
1739	echo $(c) | tr ' ' $(TRNL) >.clist
1740
1741hlist:  $(h)
1742	echo $(h) | tr ' ' $(TRNL) >.hlist
1743
1744.PHONY: distcheck
1745distcheck: FORCE
1746	perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1747
1748.PHONY: ctags
1749
1750TAGS: $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
1751	etags $(c1) $(c2) $(c3) $(c4) $(c5) $(h)
1752
1753ctags:
1754	ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c --exclude=perlmini.c *.c *.h
1755
1756# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1757# If this runs make out of memory, delete /usr/include lines.
1758!NO!SUBS!
1759
1760$eunicefix Makefile
1761$rm -f $firstmakefile
1762
1763# Now do any special processing required before building.
1764
1765case "$ebcdic" in
1766define)
1767    xxx=''
1768    echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
1769case "$osname" in
1770os390|posix-bc)
1771    ;;
1772*)
1773    echo "'$osname' is an EBCDIC system I don't know that well." >&4
1774    ;;
1775esac
1776    case "$xxx" in
1777    '') echo "No parser files were regenerated.  That's okay." >&2 ;;
1778    esac
1779    ;;
1780esac
1781
1782# ex: set ts=8 sts=4 sw=4 noet:
1783