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