3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
9 echo "Can't find config.sh."; exit 1
14 : This forces SH files to create target in same directory as SH file.
15 : This is so that make depend always knows where to find SH derivatives.
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
21 *define*) suidperl='suidperl' ;;
28 pldlflags="$cccdlflags"
29 patchlevel=`egrep '^#define[ ]+PATCHLEVEL' patchlevel.h \
31 if test -z "$isnext_4"
34 *[0-9]) plibsuf=.$so.$patchlevel;;
40 *) shrpenv="env LD_RUN_PATH=$shrpdir";;
43 # NeXT uses $patchlevel to set the current version of the dynamic
44 # library produced later. And the Major release number in the name
47 if test "$osname" = "os2" ; then
57 : Prepare dependency lists for Makefile.
59 for f in $dynamic_ext; do
60 : the dependency named here will never exist
61 base=`echo "$f" | sed 's/.*\///'`
62 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
66 for f in $static_ext; do
67 base=`echo "$f" | sed 's/.*\///'`
68 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
73 echo "Extracting Makefile (with variable substitutions)"
75 $spitshell >Makefile <<!GROK!THIS!
77 # This file is derived from Makefile.SH. Any changes made here will
78 # be lost the next time you run Configure.
79 # Makefile is used to generate $firstmakefile. The only difference
80 # is that $firstmakefile has the dependencies filled in at the end.
83 # I now supply perly.c with the kits, so don't remake perly.c without byacc
94 mallocsrc = $mallocsrc
95 mallocobj = $mallocobj
100 # The following are mentioned only to make metaconfig include the
101 # appropriate questions in Configure. If you want to change these,
102 # edit config.sh instead, or specify --man1dir=/wherever on
103 # installman commandline.
105 scriptdir = $scriptdir
107 privlib = $installprivlib
113 # The following are used to build and install shared libraries for
115 LDDLFLAGS = $lddlflags
116 CCDLFLAGS = $ccdlflags
118 PLDLFLAGS = $pldlflags
122 dynamic_ext = $dynamic_list
123 static_ext = $static_list
124 ext = \$(dynamic_ext) \$(static_ext)
125 DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
127 libs = $libs $cryptlib
129 public = perl $suidperl utilities translators
131 shellflags = $shellflags
133 ## To use an alternate make, set \$altmake in config.sh.
134 MAKE = ${altmake-make}
136 # These variables will be used in a future version to make
137 # the make file more portable to non-unix systems.
144 FIRSTMAKEFILE = $firstmakefile
146 # Any special object files needed by this architecture, e.g. os2/os2.obj
149 .SUFFIXES: .c \$(OBJ_EXT)
155 ## In the following dollars and backticks do not need the extra backslash.
156 $spitshell >>Makefile <<'!NO!SUBS!'
158 CCCMD = `sh $(shellflags) cflags $(perllib) $@`
160 private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
162 # Files to be built with variable substitution before miniperl
164 sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
165 makedir.SH perl_exp.SH writemain.SH
167 shextract = Makefile cflags config.h makeaperl makedepend \
168 makedir perl.exp writemain
170 # Files to be built with variable substitution after miniperl is
171 # available. Dependencies handled manually below (for now).
173 pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL
175 plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text
177 addedbyconf = UU $(shextract) $(plextract) pstruct
179 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
180 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
181 h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
182 h4 = regexp.h scope.h sv.h unixish.h util.h perlio.h
183 h = $(h1) $(h2) $(h3) $(h4)
185 c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
186 c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
187 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c globals.c perlio.c
189 c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
191 obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) op$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT)
192 obj2 = hv$(OBJ_EXT) av$(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)
193 obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT)
195 obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
197 # Once perl has been Configure'd and built ok you build different
198 # perl variants (Debugging, Embedded, Multiplicity etc) by saying:
199 # make clean; make perllib=libperl<type>.a
200 # where <type> is some combination of 'd' and(or) 'e' or 'm'.
201 # See cflags to understand how this works.
203 # Eventually some form of 'make-a-perl' script will automate this
204 # together with linking a perl executable with any desired
206 perllib = libperl$(PLIBSUF)
211 $(CCCMD) $(MAB) $(PLDLFLAGS) $*.c
213 all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext)
214 @echo " "; echo " Everything is up to date."
216 translators: miniperl lib/Config.pm FORCE
217 @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
219 utilities: miniperl lib/Config.pm FORCE
220 @echo " "; echo " Making utilities"; cd utils; $(MAKE) all
223 # This is now done by installman only if you actually want the man pages.
224 # @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
226 # Phony target to force checking subdirectories.
227 # Apparently some makes require an action for the FORCE target.
231 # The $& notation tells Sequent machines that it can do a parallel make,
232 # and is harmless otherwise.
233 # The miniperl -w -MExporter line is a basic cheap test to catch errors
234 # before make goes on to run preplibrary and then MakeMaker on extensions.
235 # This is very handy because later errors are often caused by miniperl
236 # build problems but that's not obvious to the novice.
237 # The Module used here must not depend on Config or any extensions.
239 miniperl: $& miniperlmain$(OBJ_EXT) $(perllib)
240 $(CC) $(LARGE) $(MAB) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(perllib) $(libs)
241 @./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
243 miniperlmain$(OBJ_EXT): miniperlmain.c
244 $(CCCMD) $(MAB) $(PLDLFLAGS) $*.c
246 perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
247 sh writemain $(DYNALOADER) $(static_ext) > tmp
248 sh mv-if-diff tmp perlmain.c
250 perlmain$(OBJ_EXT): perlmain.c
251 $(CCCMD) $(MAB) $(PLDLFLAGS) $*.c
253 # The file ext.libs is a list of libraries that must be linked in
254 # for static extensions, e.g. -lm -lgdbm, etc. The individual
255 # static extension Makefile's add to it.
256 ext.libs: $(static_ext)
257 -@test -f ext.libs || touch ext.libs
259 perl: $& perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
260 $(SHRPENV) $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(perllib) `cat ext.libs` $(libs)
262 pureperl: $& perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
263 purify $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(perllib) `cat ext.libs` $(libs)
265 quantperl: $& perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
266 quantify $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(perllib) `cat ext.libs` $(libs)
268 $(perllib): $& perl$(OBJ_EXT) $(obj)
273 if test -z "$isnext_4"
275 $spitshell >>Makefile <<'!NO!SUBS!'
276 $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj)
279 $spitshell >>Makefile <<!GROK!THIS!
280 version=$patchlevel; \\
281 libtool -dynamic -undefined warning -framework System \\
282 -compatibility_version 1 -current_version \$\$version \\
283 -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@ \\
284 -o \$@ perl.o \$(obj)
289 if test -r $osname/Makefile.SHs ; then
290 . $osname/Makefile.SHs
291 $spitshell >>Makefile <<!GROK!THIS!
293 Makefile: $osname/Makefile.SHs
297 echo "Could not find $osname/Makefile.SH! Skipping target \$(perllib) in Makefile!"
301 if test -z "$isnext_4"
303 $spitshell >>Makefile <<'!NO!SUBS!'
305 $(AR) rcu $(perllib) perl$(OBJ_EXT) $(obj)
306 @$(ranlib) $(perllib)
309 $spitshell >>Makefile <<'!NO!SUBS!'
310 libtool -static -o $(perllib) perl.o $(obj)
316 $spitshell >>Makefile <<'!NO!SUBS!'
318 # This version, if specified in Configure, does ONLY those scripts which need
319 # set-id emulation. Suidperl must be setuid root. It contains the "taint"
320 # checks as well as the special code to validate that the script in question
321 # has been invoked correctly.
323 suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
324 $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
326 sperl$(OBJ_EXT): perl.c perly.h patchlevel.h $(h)
328 $(LNS) perl.c sperl.c
329 $(CCCMD) $(MAB) -DIAMSUID sperl.c
332 # We have to call our ./makedir because Ultrix 4.3 make can't handle the line
333 # test -d lib/auto || mkdir lib/auto
335 preplibrary: miniperl lib/Config.pm $(plextract)
336 @sh ./makedir lib/auto
337 @echo " AutoSplitting perl library"
338 @./miniperl -Ilib -e 'use AutoSplit; \
339 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
341 # Take care to avoid modifying lib/Config.pm without reason
342 lib/Config.pm: config.sh miniperl configpm
343 ./miniperl configpm tmp
344 sh mv-if-diff tmp lib/Config.pm
346 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
347 ./miniperl minimod.pl > tmp && mv tmp $@
349 $(plextract): miniperl lib/Config.pm
350 ./miniperl -Ilib $@.PL
352 install: all install.perl install.man
354 install.perl: all installperl
357 install.man: all installman
360 # Not implemented yet.
361 #install.html: all installhtml
364 # I now supply perly.c with the kits, so the following section is
365 # used only if you force byacc to run by saying
367 # Since we patch up the byacc output, the perly.fixer script needs
368 # to run with precisely the same version of byacc as I use. You
369 # normally shouldn't remake perly.[ch].
372 @ echo 'Expect' 130 shift/reduce and 1 reduce/reduce conflict
374 sh $(shellflags) ./perly.fixer y.tab.c perly.c
375 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' perly.c >perly.tmp && mv perly.tmp perly.c
377 echo 'extern YYSTYPE yylval;' >>perly.h
378 - perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
380 # We don't want to regenerate perly.c and perly.h, but they might
381 # appear out-of-date after a patch is applied or a new distribution is
389 # The following three header files are generated automatically
390 # keywords.h: keywords.pl
391 # opcode.h: opcode.pl
392 # embed.h: embed.pl global.sym interp.sym
393 # The correct versions should be already supplied with the perl kit,
394 # in case you don't have perl available.
395 # To force them to run, type
403 # Names added to $(dynamic_ext) or $(static_ext) will automatically
404 # get built. There should ordinarily be no need to change any of
405 # this part of makefile.
407 # The dummy dependency is a place holder in case $(dynamic_ext) or
408 # $(static_ext) is empty.
410 # DynaLoader may be needed for extensions that use Makefile.PL.
412 $(DYNALOADER): miniperl preplibrary FORCE
413 @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
415 d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
416 @sh ext/util/make_ext dynamic $@ LIBPERL_A=$(perllib)
418 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
419 @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
422 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
423 rm -f perl.exp ext.libs
424 -rm perl.export perl.dll perl.libexp perl.map perl.def
425 -cd pod; $(MAKE) clean
426 -cd utils; $(MAKE) clean
427 -cd x2p; $(MAKE) clean
428 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
429 sh ext/util/make_ext clean $$x ; \
431 rm -f perl suidperl miniperl $(perllib)
434 -cd os2; rm -f Makefile
435 -cd pod; $(MAKE) realclean
436 -cd utils; $(MAKE) realclean
437 -cd x2p; $(MAKE) realclean
438 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
439 sh ext/util/make_ext realclean $$x ; \
441 rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
442 rm -rf $(addedbyconf)
443 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
447 rm -f h2ph.man pstruct
449 @echo "Note that make realclean does not delete config.sh"
452 rm -f config.sh cppstdin
456 # The following lint has practically everything turned on. Unfortunately,
457 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
458 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
462 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
464 # Need to unset during recursion to go out of loop
466 MAKEDEPEND = makedepend
468 $(FIRSTMAKEFILE): Makefile $(MAKEDEPEND)
469 $(MAKE) depend MAKEDEPEND=
474 perl.exp: perl_exp.SH config.sh
477 # When done, touch perlmain.c so that it doesn't get remade each time.
480 - test -s perlmain.c && touch perlmain.c
481 cd x2p; $(MAKE) depend
483 # Cannot postpone this until $firstmakefile is ready ;-)
484 makedepend: makedepend.SH config.sh
487 test: miniperl perl preplibrary $(dynamic_ext)
488 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
490 minitest: miniperl lib/Config.pm
491 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
492 && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty
495 echo $(c) | tr ' ' '\012' >.clist
498 echo $(h) | tr ' ' '\012' >.hlist
501 echo $(sh) | tr ' ' '\012' >.shlist
504 echo $(pl) | tr ' ' '\012' >.pllist
506 Makefile: Makefile.SH ./config.sh
510 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
513 perl '-MExtUtils::Manifest=&mkmanifest' -e 'mkmanifest()'
515 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
516 # If this runs make out of memory, delete /usr/include lines.
523 $ln Makefile ../Makefile
526 $rm -f $firstmakefile