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