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