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