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
51 : Prepare dependency lists for Makefile.
53 for f in $dynamic_ext; do
54 : the dependency named here will never exist
55 base=`echo "$f" | sed 's/.*\///'`
56 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
60 for f in $static_ext; do
61 base=`echo "$f" | sed 's/.*\///'`
62 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
67 echo "Extracting Makefile (with variable substitutions)"
69 $spitshell >Makefile <<!GROK!THIS!
71 # This file is derived from Makefile.SH. Any changes made here will
72 # be lost the next time you run Configure.
73 # Makefile is used to generate $firstmakefile. The only difference
74 # is that $firstmakefile has the dependencies filled in at the end.
77 # I now supply perly.c with the kits, so don't remake perly.c without byacc
88 mallocsrc = $mallocsrc
89 mallocobj = $mallocobj
94 # The following are mentioned only to make metaconfig include the
95 # appropriate questions in Configure. If you want to change these,
96 # edit config.sh instead, or specify --man1dir=/wherever on
97 # installman commandline.
99 scriptdir = $scriptdir
101 privlib = $installprivlib
107 # The following are used to build and install shared libraries for
109 LDDLFLAGS = $lddlflags
110 CCDLFLAGS = $ccdlflags
112 PLDLFLAGS = $pldlflags
116 dynamic_ext = $dynamic_list
117 static_ext = $static_list
118 ext = \$(dynamic_ext) \$(static_ext)
119 DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
121 libs = $libs $cryptlib
123 public = perl $suidperl utilities translators
125 shellflags = $shellflags
127 ## To use an alternate make, set \$altmake in config.sh.
128 MAKE = ${altmake-make}
130 # These variables will be used in a future version to make
131 # the make file more portable to non-unix systems.
138 FIRSTMAKEFILE = $firstmakefile
140 # Any special object files needed by this architecture, e.g. os2/os2.obj
143 .SUFFIXES: .c \$(OBJ_EXT)
149 ## In the following dollars and backticks do not need the extra backslash.
150 $spitshell >>Makefile <<'!NO!SUBS!'
152 CCCMD = `sh $(shellflags) cflags $(perllib) $@`
154 private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
156 # Files to be built with variable substitution before miniperl
158 sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
159 makedir.SH perl_exp.SH writemain.SH
161 shextract = Makefile cflags config.h makeaperl makedepend \
162 makedir perl.exp writemain
164 # Files to be built with variable substitution after miniperl is
165 # available. Dependencies handled manually below (for now).
167 pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL
169 plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text
171 addedbyconf = UU $(shextract) $(plextract) pstruct
173 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
174 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
175 h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
176 h4 = regexp.h scope.h sv.h unixish.h util.h
177 h = $(h1) $(h2) $(h3) $(h4)
179 c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
180 c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
181 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c globals.c
183 c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
185 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)
186 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)
187 obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT)
189 obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
191 # Once perl has been Configure'd and built ok you build different
192 # perl variants (Debugging, Embedded, Multiplicity etc) by saying:
193 # make clean; make perllib=libperl<type>.a
194 # where <type> is some combination of 'd' and(or) 'e' or 'm'.
195 # See cflags to understand how this works.
197 # Eventually some form of 'make-a-perl' script will automate this
198 # together with linking a perl executable with any desired
200 perllib = libperl$(PLIBSUF)
205 $(CCCMD) $(MAB) $(PLDLFLAGS) $*.c
207 all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext)
208 @echo " "; echo " Everything is up to date."
210 translators: miniperl lib/Config.pm FORCE
211 @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
213 utilities: miniperl lib/Config.pm FORCE
214 @echo " "; echo " Making utilities"; cd utils; $(MAKE) all
217 # This is now done by installman only if you actually want the man pages.
218 # @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
220 # Phony target to force checking subdirectories.
221 # Apparently some makes require an action for the FORCE target.
225 # The $& notation tells Sequent machines that it can do a parallel make,
226 # and is harmless otherwise.
227 # The miniperl -w -MExporter line is a basic cheap test to catch errors
228 # before make goes on to run preplibrary and then MakeMaker on extensions.
229 # This is very handy because later errors are often caused by miniperl
230 # build problems but that's not obvious to the novice.
231 # The Module used here must not depend on Config or any extensions.
233 miniperl: $& miniperlmain$(OBJ_EXT) $(perllib)
234 $(CC) $(LARGE) $(MAB) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(perllib) $(libs)
235 @./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
237 miniperlmain$(OBJ_EXT): miniperlmain.c
238 $(CCCMD) $(MAB) $(PLDLFLAGS) $*.c
240 perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
241 sh writemain $(DYNALOADER) $(static_ext) > tmp
242 sh mv-if-diff tmp perlmain.c
244 perlmain$(OBJ_EXT): perlmain.c
245 $(CCCMD) $(MAB) $(PLDLFLAGS) $*.c
247 # The file ext.libs is a list of libraries that must be linked in
248 # for static extensions, e.g. -lm -lgdbm, etc. The individual
249 # static extension Makefile's add to it.
250 ext.libs: $(static_ext)
251 -@test -f ext.libs || touch ext.libs
253 perl: $& perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
254 $(SHRPENV) $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
256 pureperl: $& perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
257 purify $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
259 quantperl: $& perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
260 quantify $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
262 $(perllib): $& perl$(OBJ_EXT) $(obj)
267 if test -z "$isnext_4"
269 $spitshell >>Makefile <<'!NO!SUBS!'
270 $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj)
273 $spitshell >>Makefile <<!GROK!THIS!
274 version=$patchlevel; \\
276 $spitshell >>Makefile <<'!NO!SUBS!'
277 libtool -dynamic -undefined warning -framework System \
278 -compatibility_version 1 -current_version $$version \
279 -prebind -seg1addr 0x27000000 -install_name $(shrpdir)/$@ \
285 if test -r $osname/Makefile.SHs ; then
286 . $osname/Makefile.SHs
287 $spitshell >>Makefile <<!GROK!THIS!
289 Makefile: $osname/Makefile.SHs
293 echo "Could not find $osname/Makefile.SH! Skipping target \$(perllib) in Makefile!"
297 if test -z "$isnext_4"
299 $spitshell >>Makefile <<'!NO!SUBS!'
301 $(AR) rcu $(perllib) perl$(OBJ_EXT) $(obj)
302 @$(ranlib) $(perllib)
305 $spitshell >>Makefile <<'!NO!SUBS!'
306 libtool -static -o $(perllib) perl.o $(obj)
312 $spitshell >>Makefile <<'!NO!SUBS!'
314 # This version, if specified in Configure, does ONLY those scripts which need
315 # set-id emulation. Suidperl must be setuid root. It contains the "taint"
316 # checks as well as the special code to validate that the script in question
317 # has been invoked correctly.
319 suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) ext.libs
320 $(CC) $(LARGE) $(MAB) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
322 sperl$(OBJ_EXT): perl.c perly.h patchlevel.h $(h)
324 $(LNS) perl.c sperl.c
325 $(CCCMD) $(MAB) -DIAMSUID sperl.c
328 # We have to call our ./makedir because Ultrix 4.3 make can't handle the line
329 # test -d lib/auto || mkdir lib/auto
331 preplibrary: miniperl lib/Config.pm $(plextract)
332 @sh ./makedir lib/auto
333 @echo " AutoSplitting perl library"
334 @./miniperl -Ilib -e 'use AutoSplit; \
335 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
337 # Take care to avoid modifying lib/Config.pm without reason
338 lib/Config.pm: config.sh miniperl configpm
339 ./miniperl configpm tmp
340 sh mv-if-diff tmp lib/Config.pm
342 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
343 ./miniperl minimod.pl > tmp && mv tmp $@
345 $(plextract): miniperl lib/Config.pm
346 ./miniperl -Ilib $@.PL
348 install: all install.perl install.man
350 install.perl: all installperl
353 install.man: all installman
356 # Not implemented yet.
357 #install.html: all installhtml
360 # I now supply perly.c with the kits, so the following section is
361 # used only if you force byacc to run by saying
363 # Since we patch up the byacc output, the perly.fixer script needs
364 # to run with precisely the same version of byacc as I use. You
365 # normally shouldn't remake perly.[ch].
368 @ echo 'Expect' 130 shift/reduce and 1 reduce/reduce conflict
370 sh $(shellflags) ./perly.fixer y.tab.c perly.c
371 sed -e s/stderr/Perl_debug_log/g perly.c >perly.tmp && mv perly.tmp perly.c
373 echo 'extern YYSTYPE yylval;' >>perly.h
374 - perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
376 # We don't want to regenerate perly.c and perly.h, but they might
377 # appear out-of-date after a patch is applied or a new distribution is
385 # The following three header files are generated automatically
386 # keywords.h: keywords.pl
387 # opcode.h: opcode.pl
388 # embed.h: embed.pl global.sym interp.sym
389 # The correct versions should be already supplied with the perl kit,
390 # in case you don't have perl available.
391 # To force them to run, type
399 # Names added to $(dynamic_ext) or $(static_ext) will automatically
400 # get built. There should ordinarily be no need to change any of
401 # this part of makefile.
403 # The dummy dependency is a place holder in case $(dynamic_ext) or
404 # $(static_ext) is empty.
406 # DynaLoader may be needed for extensions that use Makefile.PL.
408 $(DYNALOADER): miniperl preplibrary FORCE
409 @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
411 d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
412 @sh ext/util/make_ext dynamic $@ LIBPERL_A=$(perllib)
414 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
415 @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
418 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
419 rm -f perl.exp ext.libs
420 -rm perl.export perl.dll perl.libexp perl.map perl.def
421 -cd pod; $(MAKE) clean
422 -cd utils; $(MAKE) clean
423 -cd x2p; $(MAKE) clean
424 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
425 sh ext/util/make_ext clean $$x ; \
427 rm -f perl suidperl miniperl $(perllib)
430 -cd os2; rm -f Makefile
431 -cd pod; $(MAKE) realclean
432 -cd utils; $(MAKE) realclean
433 -cd x2p; $(MAKE) realclean
434 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
435 sh ext/util/make_ext realclean $$x ; \
437 rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
438 rm -rf $(addedbyconf)
439 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
443 rm -f h2ph.man pstruct
445 @echo "Note that make realclean does not delete config.sh"
448 rm -f config.sh cppstdin
452 # The following lint has practically everything turned on. Unfortunately,
453 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
454 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
458 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
460 # Need to unset during recursion to go out of loop
462 MAKEDEPEND = makedepend
464 $(FIRSTMAKEFILE): Makefile $(MAKEDEPEND)
465 $(MAKE) depend MAKEDEPEND=
470 perl.exp: perl_exp.SH config.sh
473 # When done, touch perlmain.c so that it doesn't get remade each time.
476 - test -s perlmain.c && touch perlmain.c
477 cd x2p; $(MAKE) depend
479 # Cannot postpone this until $firstmakefile is ready ;-)
480 makedepend: makedepend.SH config.sh
483 test: miniperl perl preplibrary $(dynamic_ext)
484 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
487 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
488 && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty
491 echo $(c) | tr ' ' '\012' >.clist
494 echo $(h) | tr ' ' '\012' >.hlist
497 echo $(sh) | tr ' ' '\012' >.shlist
500 echo $(pl) | tr ' ' '\012' >.pllist
502 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
503 # If this runs make out of memory, delete /usr/include lines.
510 $ln Makefile ../Makefile
513 $rm -f $firstmakefile