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# Microperl.  This is just a convenience thing if one happens to
699# build also the full Perl and therefore the real big Makefile:
700# usually one should manually explicitly issue the below command.
701
702.PHONY: microperl
703microperl:
704	$(MAKE) -f Makefile.micro
705
706!NO!SUBS!
707
708fi
709
710$spitshell >>$Makefile <<'!NO!SUBS!'
711
712.PHONY: preplibrary
713preplibrary: miniperl $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
714
715.PHONY: makeppport
716makeppport: miniperl$(EXE_EXT) $(CONFIGPM)
717	$(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib mkppport
718
719$(CROSS_LIB)/Config.pod: config.sh miniperl configpm Porting/Glossary
720	$(LDLIBPTH) ./miniperl -Ilib configpm --cross=$(CROSS_NAME)
721	cp *.h $(CROSS_LIB)/
722	cp ext/re/re.pm $(LIBDIR)/
723
724$(CONFIGPM): $(CROSS_LIB)/Config.pod xconfig.h
725
726lib/re.pm: ext/re/re.pm
727	@-rm -f $@
728	cp ext/re/re.pm lib/re.pm
729
730lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl
731	$(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl
732
733unidatafiles $(unidatafiles): uni.data
734
735uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
736	cd lib/unicore && $(LDLIBPTH) ../../miniperl -I../../lib mktables -P ../../pod -maketest -makelist -p
737#	Commented out so always runs, mktables looks at far more files than we
738#	can in this makefile to decide if needs to run or not
739#	touch uni.data
740
741extra.pods: miniperl
742	-@test ! -f extra.pods || rm -f `cat extra.pods`
743	-@rm -f extra.pods
744	-@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
745	    nx=`echo $$x | sed -e "s/README\.//"`; \
746	    cd pod ; $(LNS) ../$$x "perl"$$nx".pod" ; cd .. ; \
747	    echo "pod/perl"$$nx".pod" >> extra.pods ; \
748	done
749	-@rm -f pod/perlvms.pod
750	-@test -f vms/perlvms.pod && cd pod && $(LNS) ../vms/perlvms.pod perlvms.pod && cd .. && echo "pod/perlvms.pod" >> extra.pods
751	-@rm -f pod/perldelta.pod
752	-@test -f pod/perl5100delta.pod && cd pod && $(LNS) perl5100delta.pod perldelta.pod && cd .. && echo "pod/perldelta.pod" >> extra.pods # See buildtoc
753
754extras.make: perl$(EXE_EXT)
755	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst`
756
757extras.test: perl$(EXE_EXT)
758	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst`
759
760extras.install: perl$(EXE_EXT)
761	-@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(LDLIBPTH) ./perl -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`
762
763.PHONY: install install-strip install-all install-verbose install-silent \
764	no-install install.perl install.man install.html
765
766META.yml:	Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
767	$(LDLIBPTH) ./miniperl -Ilib Porting/makemeta -y
768
769META.json:	Porting/makemeta Porting/Maintainers.pl Porting/Maintainers.pm
770	$(LDLIBPTH) ./miniperl -Ilib Porting/makemeta -j
771
772install-strip:
773	$(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)"
774
775install install-all:
776	$(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)"
777
778install-verbose:
779	$(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)"
780
781install-silent:
782	$(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)"
783
784no-install:
785	$(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)"
786
787# Set this to an empty string to avoid an attempt of rebuild before install
788INSTALL_DEPENDENCE = all
789
790install.perl:	$(INSTALL_DEPENDENCE) installperl
791	$(LDLIBPTH) ./perl installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS)
792	-@test ! -s extras.lst || $(MAKE) extras.install
793
794install.man:	all installman
795	$(LDLIBPTH) ./perl installman --destdir=$(DESTDIR) $(INSTALLFLAGS)
796
797# XXX Experimental. Hardwired values, but useful for testing.
798# Eventually Configure could ask for some of these values.
799install.html: all installhtml
800	-@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd ..
801	$(LDLIBPTH) ./perl installhtml   \
802      --podroot=. --podpath=. --recurse  \
803      --htmldir=$(privlib)/html   \
804      --htmlroot=$(privlib)/html  \
805      --splithead=pod/perlipc     \
806      --splititem=pod/perlfunc    \
807      --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \
808      --verbose
809
810
811# I now supply perly.c with the kits, so the following section is
812# used only if you force bison to run by saying
813# 	make regen_perly
814# You normally shouldn't remake perly.[ch].
815
816.PHONY: regen_perly
817
818run_byacc:
819	@echo "run_byacc is obsolete; try 'make regen_perly' instead"
820
821# this outputs perly.h, perly.act and perly.tab
822regen_perly:
823	perl regen_perly.pl
824
825# We don't want to regenerate perly.c and perly.h, but they might
826# appear out-of-date after a patch is applied or a new distribution is
827# made.
828perly.c: perly.y
829	-@sh -c true
830
831perly.h: perly.y
832	-@sh -c true
833
834SYM  = globvar.sym perlio.sym
835
836SYMH = perlvars.h intrpvar.h
837
838CHMOD_W = chmod +w
839
840# The following files are generated automatically
841#	embed.pl:	proto.h embed.h embedvar.h
842#	opcode.pl:	opcode.h opnames.h pp_proto.h
843#	regcomp.pl:	regnodes.h
844#	warnings.pl:	warnings.h lib/warnings.pm
845#	feature.pl:	feature.h lib/feature.pl
846# The correct versions should be already supplied with the perl kit,
847# in case you don't have perl available.
848# To force them to be regenerated, run
849#       perl regen.pl
850# with your existing copy of perl
851# (make regen_headers is kept for backwards compatibility)
852
853.PHONY: regen_headers regen_all
854
855regen regen_headers:	FORCE
856	-perl regen.pl
857
858regen_all: regen
859
860.PHONY:	manisort manicheck
861
862manisort:	FORCE
863	LC_ALL=C sort -fdc MANIFEST || (echo "WARNING: re-sorting MANIFEST"; \
864		LC_ALL=C sort -fdo MANIFEST MANIFEST)
865
866manicheck:	FORCE
867	perl Porting/manicheck
868
869# Extensions:
870# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
871# automatically get built.  There should ordinarily be no need to change
872# any of this part of makefile.
873#
874# The dummy dependency is a place holder in case $(dynamic_ext) or
875# $(static_ext) is empty.
876#
877# DynaLoader may be needed for extensions that use Makefile.PL.
878
879###$(DYNALOADER).c: $(EXTDIR)/DynaLoader/dl_dld.xs $(CONFIGPM)
880###	if not exist $(AUTODIR) mkdir $(AUTODIR)
881###	cd $(EXTDIR)\$(*B)
882###	$(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) $(*B)_pm.PL
883###	$(HPERL) -I..\..\lib -MCross=$(CROSS_NAME) XSLoader_pm.PL
884###	cd ..\..\win32
885###	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
886###	$(XCOPY) $(EXTDIR)\$(*B)\XSLoader.pm $(LIBDIR)\$(NULL)
887###	cd $(EXTDIR)\$(*B)
888###	$(XSUBPP) dl_win32.xs > $(*B).c
889###	cd ..\..\win32
890###
891###$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
892###	$(COPY) dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
893
894
895
896$(DYNALOADER): lib/buildcustomize.pl preplibrary FORCE
897	@$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
898
899d_dummy $(dynamic_ext):	miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
900	@$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
901
902s_dummy $(static_ext):	miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
903	@$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
904
905n_dummy $(nonxs_ext):	miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary $(DYNALOADER) FORCE
906	@$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
907!NO!SUBS!
908
909$spitshell >>$Makefile <<EOF
910$extra_dep
911EOF
912
913$spitshell >>$Makefile <<'!NO!SUBS!'
914
915.PHONY: printconfig
916printconfig:
917	@eval `$(LDLIBPTH) ./perl -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
918
919.PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
920	realclean _realcleaner clobber _clobber \
921	distclean veryclean _verycleaner
922
923clean:		_tidy _mopup
924
925realclean:	_realcleaner _mopup
926	@echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
927
928_clobber:
929	-@rm -f Cross/run-* Cross/to-* Cross/from-*
930	rm -f config.sh cppstdin Policy.sh extras.lst
931
932clobber:	_realcleaner _mopup _clobber
933
934distclean:	clobber
935
936# Like distclean but also removes emacs backups and *.orig.
937veryclean:	_verycleaner _mopup _clobber
938	-@rm -f Obsolete Wanted
939
940# Do not 'make _mopup' directly.
941_mopup:
942	rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c opmini.c uudmap.h generate_uudmap$(EXE_EXT)
943	-rmdir .depending
944	-@test -f extra.pods && rm -f `cat extra.pods`
945	-@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
946	-rm -f perl.exp ext.libs extra.pods uni.data opmini.o
947	-rm -f perl.export perl.dll perl.libexp perl.map perl.def
948	-rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log
949	-rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs
950	-rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok
951	-rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
952	-rm -f perl$(EXE_EXT) miniperl$(EXE_EXT) $(LIBPERL) libperl.* microperl
953	-rm -f config.over
954
955# Do not 'make _tidy' directly.
956_tidy:
957	-cd pod; $(LDLIBPTH) $(MAKE) clean
958	-cd utils; $(LDLIBPTH) $(MAKE) clean
959	-@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
960	$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
961	done
962
963_cleaner1:
964	-cd os2; rm -f Makefile
965	-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
966	-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
967	-@if test -f miniperl$(EXE_EXT) ; then \
968	for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
969	$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
970	done ; \
971	else \
972	sh $(CLEAN).sh ; \
973	fi
974	rm -f realclean.sh veryclean.sh
975	-@test ! -f ./miniperl$(EXE_EXT) || $(LDLIBPTH) ./miniperl$(EXE_EXT) -Ilib mkppport --clean
976
977# Some systems do not support "?", so keep these files separate.
978_cleaner2:
979	-rm -f core.*perl.*.? t/core.perl.*.? .?*.c
980	rm -f core *perl.core t/core t/*perl.core core.* t/core.*
981	rm -f t/perl$(EXE_EXT) t/rantests
982	rm -rf t/tmp*
983	rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR)
984	rm -rf $(addedbyconf)
985	rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
986	rm -f $(private)
987	rm -rf $(unidatafiles) $(unidatadirs)
988	rm -rf lib/auto
989	rm -f lib/.exists lib/*/.exists lib/*/*/.exists
990	rm -f h2ph.man
991	rm -rf .config
992	rm -f preload
993	rm -rf lib/Encode lib/Compress lib/Hash lib/re
994	rm -rf lib/IO/Compress lib/IO/Uncompress
995	rm -f lib/ExtUtils/ParseXS/t/XSTest.c
996	rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT)
997	rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX)
998	-rmdir lib/B lib/Data
999	-rmdir lib/Filter/Util lib/IO/Socket
1000	-rmdir lib/List lib/MIME lib/Scalar lib/Sys
1001	-rmdir lib/threads lib/XS
1002
1003_realcleaner:
1004	@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean
1005	@$(LDLIBPTH) $(MAKE) _cleaner2
1006
1007_verycleaner:
1008	@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
1009	@$(LDLIBPTH) $(MAKE) _cleaner2
1010	-rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig
1011
1012.PHONY: lint
1013lint: $(c)
1014	rm -f *.ln
1015	lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
1016
1017.PHONY: splint
1018splint: $(c)
1019	splint $(splintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(splintfiles)
1020
1021# Need to unset during recursion to go out of loop.
1022# The README below ensures that the dependency list is never empty and
1023# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.
1024
1025MAKEDEPEND = Makefile makedepend
1026
1027$(FIRSTMAKEFILE):	README $(MAKEDEPEND)
1028	$(MAKE) depend MAKEDEPEND=
1029
1030config.h: config_h.SH config.sh
1031	$(SHELL) config_h.SH
1032	# TODO - improve following line
1033	cp config.h $(CROSS_LIB)/
1034
1035xconfig.h: config_h.SH Cross/config-$(CROSS_NAME).sh
1036	CONFIG_SH=Cross/config-$(CROSS_NAME).sh CONFIG_H=xconfig.h $(SHELL) config_h.SH
1037	#TODO $(LDLIBPTH) ./miniperl -Ilib -MCross=$(CROSS_NAME) config_h.PL "INST_VER=$(INST_VER)" "CORE_DIR=$(CROSS_LIB)" "CONFIG_H=xconfig.h"
1038	cp xconfig.h $(CROSS_LIB)/
1039	cp xconfig.h $(CROSS_LIB)/config.h
1040
1041# When done, touch perlmain.c so that it doesn't get remade each time.
1042.PHONY: depend
1043depend: makedepend
1044	sh ./makedepend MAKE=$(MAKE)
1045	- test -s perlmain.c && touch perlmain.c
1046
1047# Cannot postpone this until $firstmakefile is ready ;-)
1048makedepend: makedepend.SH config.sh
1049	sh ./makedepend.SH
1050
1051.PHONY: test check test_prep test_prep_nodll test_prep_pre _test_prep \
1052	test_tty test-tty _test_tty test_notty test-notty _test_notty \
1053	utest ucheck test.utf8 check.utf8 test.torture torturetest \
1054	test.utf16 check.utf16 utest.utf16 ucheck.utf16 \
1055	test.third check.third utest.third ucheck.third test_notty.third \
1056	test.deparse test_notty.deparse test_harness test_harness_notty \
1057	minitest coretest test.taintwarn
1058
1059# Cannot delegate rebuilding of t/perl to make
1060# to allow interlaced test and minitest
1061
1062TESTFILE=TEST
1063
1064_test_prep:
1065	cd t && (rm -f $(PERL)$(EXE_EXT); $(LNS) ../$(PERL)$(EXE_EXT) $(PERL)$(EXE_EXT))
1066
1067# Architecture-neutral stuff:
1068
1069test_prep_pre: preplibrary utilities $(nonxs_ext)
1070
1071test_prep: test_prep_pre miniperl$(EXE_EXT) $(unidatafiles) perl$(EXE_EXT) \
1072	$(dynamic_ext) $(TEST_PERL_DLL)
1073	PERL=./perl $(MAKE) _test_prep
1074
1075_test_tty:
1076	cd t && $(PERL_DEBUG) $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS) </dev/tty
1077
1078_test_notty:
1079	cd t && $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(LDLIBPTH) $(PERL) $(TESTFILE) $(TEST_ARGS)
1080
1081# The second branch is for testing without a tty or controlling terminal,
1082# see t/op/stat.t
1083_test:
1084	if (true </dev/tty) >/dev/null 2>&1; then \
1085	  $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_tty   ; \
1086	else \
1087	  $(MAKE) TEST_ARGS=$(TEST_ARGS) TESTFILE=$(TESTFILE) _test_notty ; \
1088	fi
1089	@echo "Ran tests" > t/rantests
1090
1091test check: test_prep
1092	PERL=./perl $(MAKE) _test
1093
1094test_tty: test_prep
1095	PERL=./perl $(MAKE) _test_tty
1096
1097test_notty: test_prep
1098	PERL=./perl $(MAKE) _test_notty
1099
1100utest ucheck test.utf8 check.utf8: test_prep
1101	PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test
1102
1103coretest: test_prep
1104	PERL=./perl TEST_ARGS=-core $(MAKE) _test
1105
1106test-prep:	test_prep
1107
1108test-tty:	test_tty
1109
1110test-notty:	test_notty
1111
1112# Torture testing
1113
1114test.torture torturetest:	test_prep
1115	PERL=./perl TEST_ARGS=-torture $(MAKE) _test
1116
1117# Targets for UTF16 testing:
1118
1119minitest.utf16: minitest.prep
1120	- cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
1121		&& $(LDLIBPTH) ./perl TEST -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
1122
1123test.utf16 check.utf16: test_prep
1124	PERL=./perl $(MAKE) TEST_ARGS=-utf16 _test
1125
1126utest.utf16 ucheck.utf16: test_prep
1127	PERL=./perl $(MAKE) TEST_ARGS="-utf8 -utf16" _test
1128
1129# Targets for valgrind testing:
1130
1131test_prep.valgrind: test_prep perl.valgrind
1132	PERL=./perl $(MAKE) _test_prep
1133
1134test.valgrind check.valgrind:	test_prep perl.valgrind.config
1135	PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(MAKE) _test
1136
1137utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config
1138	PERL=./perl PERL_DEBUG=PERL_VALGRIND=1 TEST_ARGS=-utf8 $(MAKE) _test
1139
1140test_notty.valgrind: test_prep.valgrind perl.valgrind.config
1141	PERL=./perl $(MAKE) PERL_DEBUG=PERL_VALGRIND=1 _test_notty
1142
1143# Targets for Third Degree testing.
1144
1145test_prep.third: test_prep perl.third
1146	PERL=./perl.third $(MAKE) _test_prep
1147
1148test.third check.third:	test_prep.third perl.third
1149	PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test
1150
1151utest.third ucheck.third: test_prep.third perl.third
1152	PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test
1153
1154test_notty.third: test_prep.third perl.third
1155	PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty
1156
1157# Targets for Deparse testing.
1158
1159test.deparse:	test_prep
1160	PERL=./perl TEST_ARGS=-deparse $(MAKE) _test
1161
1162test_notty.deparse:	test_prep
1163	PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty
1164
1165# Targets to run the test suite with -t
1166
1167test.taintwarn:	test_prep
1168	PERL=./perl TEST_ARGS=-taintwarn $(MAKE) _test
1169
1170minitest.prep:
1171	-@test -f lib/lib.pm && test -f lib/Config.pm || \
1172	  $(MAKE) lib/Config.pm lib/lib.pm $(unidatafiles)
1173	@echo " "
1174	@echo "You may see some irrelevant test failures if you have been unable"
1175	@echo "to build lib/Config.pm, lib/lib.pm or the Unicode data files."
1176	@echo " "
1177
1178# Can't depend on lib/Config.pm because that might be where miniperl
1179# is crashing.
1180minitest: miniperl$(EXE_EXT) minitest.prep
1181	- cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
1182		&& $(LDLIBPTH) ./perl TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
1183
1184# Test via harness
1185
1186test_harness: test_prep
1187	PERL=./perl $(MAKE) TESTFILE=harness _test
1188
1189test_harness_notty: test_prep
1190	PERL=./perl HARNESS_NOTTY=1 $(MAKE) TESTFILE=harness _test
1191
1192# Handy way to run perlbug -ok without having to install and run the
1193# installed perlbug. We don't re-run the tests here - we trust the user.
1194# Please *don't* use this unless all tests pass.
1195# If you want to report test failures, use "make nok" instead.
1196
1197.PHONY: ok okfile oknack okfilenack nok nokfile noknack nokfilenack
1198
1199ok:	utilities
1200	$(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
1201
1202okfile:	utilities
1203	$(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
1204
1205oknack:	utilities
1206	$(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -A
1207
1208okfilenack:	utilities
1209	$(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok -A
1210
1211nok:	utilities
1212	$(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
1213
1214nokfile:	utilities
1215	$(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok
1216
1217noknack:	utilities
1218	$(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -A
1219
1220nokfilenack:	utilities
1221	$(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' -F perl.nok -A
1222
1223.PHONY: clist hlist shlist
1224
1225clist:	$(c)
1226	echo $(c) | tr ' ' $(TRNL) >.clist
1227
1228hlist:  $(h)
1229	echo $(h) | tr ' ' $(TRNL) >.hlist
1230
1231shlist: $(sh)
1232	echo $(sh) | tr ' ' $(TRNL) >.shlist
1233
1234Makefile: Makefile.SH ./config.sh
1235	$(SHELL) Makefile.SH
1236
1237.PHONY: distcheck
1238distcheck: FORCE
1239	perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
1240
1241.PHONY: elc
1242elc:	emacs/cperl-mode.elc
1243
1244emacs/cperl-mode.elc: emacs/cperl-mode.el
1245	-cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el
1246
1247.PHONY: etags ctags tags
1248
1249etags:	TAGS
1250
1251TAGS: emacs/cperl-mode.elc
1252	sh emacs/ptags
1253
1254# Let's hope make will not go into an infinite loop on case-insensitive systems
1255# This may also fail if . is in the head of the path, since perl will
1256# require -Ilib
1257tags:	TAGS
1258	perl emacs/e2ctags.pl TAGS > tags
1259
1260ctags:
1261	ctags -f Tags -N --totals --languages=c --langmap=c:+.h --exclude=opmini.c *.c *.h
1262
1263# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
1264# If this runs make out of memory, delete /usr/include lines.
1265!NO!SUBS!
1266
1267$eunicefix $Makefile
1268$rm -f $firstmakefile
1269
1270# Now do any special processing required before building.
1271
1272case "$ebcdic" in
1273define)
1274    xxx=''
1275    echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
1276case "$osname" in
1277os390|posix-bc)
1278    ;;
1279*)
1280    echo "'$osname' is an EBCDIC system I don't know that well." >&4
1281    ;;
1282esac
1283    case "$xxx" in
1284    '') echo "No parser files were regenerated.  That's okay." >&2 ;;
1285    esac
1286    ;;
1287esac
1288
1289# ex: set ts=8 sts=4 sw=4 noet:
1290