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' ;;
27 pldlflags="$cccdlflags"
28 # NeXT-4 specific stuff. Can't we do this in the hint file?
29 case "${osname}${osvers}" in
31 ld='libtool -dynamic -undefined warning -framework System \
32 -compatibility_version 1 -current_version $(PATCHLEVEL) \
33 -prebind -seg1addr 0x27000000 -install_name $(SHRPDIR)/$@'
41 : Prepare dependency lists for Makefile.
43 for f in $dynamic_ext; do
44 : the dependency named here will never exist
45 base=`echo "$f" | sed 's/.*\///'`
46 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
50 for f in $static_ext; do
51 base=`echo "$f" | sed 's/.*\///'`
52 static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
55 echo "Extracting Makefile (with variable substitutions)"
56 $spitshell >Makefile <<!GROK!THIS!
58 # This file is derived from Makefile.SH. Any changes made here will
59 # be lost the next time you run Configure.
60 # Makefile is used to generate $firstmakefile. The only difference
61 # is that $firstmakefile has the dependencies filled in at the end.
64 # I now supply perly.c with the kits, so don't remake perly.c without byacc
74 mallocsrc = $mallocsrc
75 mallocobj = $mallocobj
80 # The following are mentioned only to make metaconfig include the
81 # appropriate questions in Configure. If you want to change these,
82 # edit config.sh instead, or specify --man1dir=/wherever on
83 # installman commandline.
85 scriptdir = $scriptdir
86 shrpdir = $archlibexp/CORE
87 privlib = $installprivlib
93 # The following are used to build and install shared libraries for
95 LDDLFLAGS = $lddlflags
96 CCDLFLAGS = $ccdlflags
98 PLDLFLAGS = $pldlflags
102 dynamic_ext = $dynamic_list
103 static_ext = $static_list
104 ext = \$(dynamic_ext) \$(static_ext)
105 DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
107 libs = $libs $cryptlib
109 public = perl $suidperl utilities translators
111 shellflags = $shellflags
113 # This is set to MAKE=$make if your $make command doesn't
117 # These variables will be used in a future version to make
118 # the make file more portable to non-unix systems.
125 FIRSTMAKEFILE = $firstmakefile
127 # Any special object files needed by this architecture, e.g. os2/os2.obj
130 .SUFFIXES: .c \$(OBJ_EXT)
137 ## In the following dollars and backticks do not need the extra backslash.
138 $spitshell >>Makefile <<'!NO!SUBS!'
140 CCCMD = `sh $(shellflags) cflags $(LIBPERL) $@`
142 private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
144 # Files to be built with variable substitution before miniperl
146 sh = Makefile.SH cflags.SH config_h.SH makeaperl.SH makedepend.SH \
147 makedir.SH perl_exp.SH writemain.SH
149 shextract = Makefile cflags config.h makeaperl makedepend \
150 makedir perl.exp writemain
152 # Files to be built with variable substitution after miniperl is
153 # available. Dependencies handled manually below (for now).
155 pl = pod/pod2html.PL pod/pod2latex.PL pod/pod2man.PL pod/pod2text.PL
157 plextract = pod/pod2html pod/pod2latex pod/pod2man pod/pod2text
159 addedbyconf = UU $(shextract) $(plextract) pstruct
161 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
162 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
163 h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
164 h4 = regexp.h scope.h sv.h unixish.h util.h perlio.h
165 h = $(h1) $(h2) $(h3) $(h4)
167 c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
168 c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
169 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c universal.c globals.c perlio.c
171 c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
173 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)
174 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)
175 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)
177 obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
179 # Once perl has been Configure'd and built ok you build different
180 # perl variants (Debugging, Embedded, Multiplicity etc) by saying:
181 # make clean; make LIBPERL=libperl<type>.a
182 # where <type> is some combination of 'd' and(or) 'e' or 'm'.
183 # See cflags to understand how this works.
185 # This mechanism is getting clunky and might not even work any more.
186 # EMBEDDING is on by default, and MULTIPLICITY doesn't work.
192 $(CCCMD) $(PLDLFLAGS) $*.c
194 all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext)
195 @echo " "; echo " Everything is up to date."
197 translators: miniperl lib/Config.pm FORCE
198 @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
200 utilities: miniperl lib/Config.pm FORCE
201 @echo " "; echo " Making utilities"; cd utils; $(MAKE) all
204 # This is now done by installman only if you actually want the man pages.
205 # @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
207 # Phony target to force checking subdirectories.
208 # Apparently some makes require an action for the FORCE target.
212 # The $& notation tells Sequent machines that it can do a parallel make,
213 # and is harmless otherwise.
214 # The miniperl -w -MExporter line is a basic cheap test to catch errors
215 # before make goes on to run preplibrary and then MakeMaker on extensions.
216 # This is very handy because later errors are often caused by miniperl
217 # build problems but that's not obvious to the novice.
218 # The Module used here must not depend on Config or any extensions.
220 miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)
221 $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LIBPERL) $(libs)
222 @./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
224 miniperlmain$(OBJ_EXT): miniperlmain.c
225 $(CCCMD) $(PLDLFLAGS) $*.c
227 perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
228 sh writemain $(DYNALOADER) $(static_ext) > tmp
229 sh mv-if-diff tmp perlmain.c
231 perlmain$(OBJ_EXT): perlmain.c
232 $(CCCMD) $(PLDLFLAGS) $*.c
234 # The file ext.libs is a list of libraries that must be linked in
235 # for static extensions, e.g. -lm -lgdbm, etc. The individual
236 # static extension Makefile's add to it.
237 ext.libs: $(static_ext)
238 -@test -f ext.libs || touch ext.libs
240 perl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
241 $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
243 pureperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
244 purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
246 quantperl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
247 quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
250 # How to build libperl. This is still rather convoluted.
251 # Load up custom Makefile.SH fragments?
252 if test -r $osname/Makefile.SHs ; then
253 . $osname/Makefile.SHs
254 $spitshell >>Makefile <<!GROK!THIS!
256 Makefile: $osname/Makefile.SHs
259 $spitshell >>Makefile <<'!NO!SUBS!'
260 $(LIBPERL): $& perl$(OBJ_EXT) $(obj)
262 case "$useshrplib" in
264 $spitshell >>Makefile <<'!NO!SUBS!'
265 $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj)
269 $spitshell >>Makefile <<'!NO!SUBS!'
271 $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
272 @$(ranlib) $(LIBPERL)
278 $spitshell >>Makefile <<'!NO!SUBS!'
280 # This version, if specified in Configure, does ONLY those scripts which need
281 # set-id emulation. Suidperl must be setuid root. It contains the "taint"
282 # checks as well as the special code to validate that the script in question
283 # has been invoked correctly.
285 suidperl: $& sperl$(OBJ_EXT) perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
286 $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(OBJ_EXT) sperl$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
288 sperl$(OBJ_EXT): perl.c perly.h patchlevel.h $(h)
290 $(LNS) perl.c sperl.c
291 $(CCCMD) -DIAMSUID sperl.c
294 # We have to call our ./makedir because Ultrix 4.3 make can't handle the line
295 # test -d lib/auto || mkdir lib/auto
297 preplibrary: miniperl lib/Config.pm $(plextract)
298 @sh ./makedir lib/auto
299 @echo " AutoSplitting perl library"
300 @./miniperl -Ilib -e 'use AutoSplit; \
301 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
303 # Take care to avoid modifying lib/Config.pm without reason
304 lib/Config.pm: config.sh miniperl configpm
305 ./miniperl configpm tmp
306 sh mv-if-diff tmp lib/Config.pm
308 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
309 ./miniperl minimod.pl > tmp && mv tmp $@
311 $(plextract): miniperl lib/Config.pm
312 ./miniperl -Ilib $@.PL
314 install: all install.perl install.man
316 install.perl: all installperl
319 install.man: all installman
322 # Not implemented yet.
323 #install.html: all installhtml
326 # I now supply perly.c with the kits, so the following section is
327 # used only if you force byacc to run by saying
329 # Since we patch up the byacc output, the perly.fixer script needs
330 # to run with precisely the same version of byacc as I use. You
331 # normally shouldn't remake perly.[ch].
334 @ echo 'Expect' 130 shift/reduce and 1 reduce/reduce conflict
336 sh $(shellflags) ./perly.fixer y.tab.c perly.c
337 sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' perly.c >perly.tmp && mv perly.tmp perly.c
339 echo 'extern YYSTYPE yylval;' >>perly.h
340 - perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
342 # We don't want to regenerate perly.c and perly.h, but they might
343 # appear out-of-date after a patch is applied or a new distribution is
351 # The following three header files are generated automatically
352 # keywords.h: keywords.pl
353 # opcode.h: opcode.pl
354 # embed.h: embed.pl global.sym interp.sym
355 # The correct versions should be already supplied with the perl kit,
356 # in case you don't have perl available.
357 # To force them to run, type
365 # Names added to $(dynamic_ext) or $(static_ext) will automatically
366 # get built. There should ordinarily be no need to change any of
367 # this part of makefile.
369 # The dummy dependency is a place holder in case $(dynamic_ext) or
370 # $(static_ext) is empty.
372 # DynaLoader may be needed for extensions that use Makefile.PL.
374 $(DYNALOADER): miniperl preplibrary FORCE
375 @sh ext/util/make_ext static $@ LIBPERL_A=$(LIBPERL)
377 d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
378 @sh ext/util/make_ext dynamic $@ LIBPERL_A=$(LIBPERL)
380 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
381 @sh ext/util/make_ext static $@ LIBPERL_A=$(LIBPERL)
384 rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
385 rm -f perl.exp ext.libs
386 -rm -f perl.export perl.dll perl.libexp perl.map perl.def
387 -cd pod; $(MAKE) clean
388 -cd utils; $(MAKE) clean
389 -cd x2p; $(MAKE) clean
390 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
391 sh ext/util/make_ext clean $$x ; \
393 rm -f perl suidperl miniperl $(LIBPERL)
396 -cd os2; rm -f Makefile
397 -cd pod; $(MAKE) realclean
398 -cd utils; $(MAKE) realclean
399 -cd x2p; $(MAKE) realclean
400 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
401 sh ext/util/make_ext realclean $$x ; \
403 rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
404 rm -rf $(addedbyconf)
405 rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old
409 rm -f h2ph.man pstruct
411 @echo "Note that make realclean does not delete config.sh"
414 rm -f config.sh cppstdin
418 # The following lint has practically everything turned on. Unfortunately,
419 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
420 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
424 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
426 # Need to unset during recursion to go out of loop
428 MAKEDEPEND = makedepend
430 $(FIRSTMAKEFILE): Makefile $(MAKEDEPEND)
431 $(MAKE) depend MAKEDEPEND=
436 perl.exp: perl_exp.SH config.sh
439 # When done, touch perlmain.c so that it doesn't get remade each time.
442 - test -s perlmain.c && touch perlmain.c
443 cd x2p; $(MAKE) depend
445 # Cannot postpone this until $firstmakefile is ready ;-)
446 makedepend: makedepend.SH config.sh
449 check test: miniperl perl preplibrary $(dynamic_ext)
450 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
452 # Can't depend on lib/Config.pm because that might be where miniperl
455 @echo "You may see some irrelevant test failures if you have been unable"
456 @echo "to build lib/Config.pm."
457 - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
458 && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty
461 echo $(c) | tr ' ' '\012' >.clist
464 echo $(h) | tr ' ' '\012' >.hlist
467 echo $(sh) | tr ' ' '\012' >.shlist
470 echo $(pl) | tr ' ' '\012' >.pllist
472 Makefile: Makefile.SH ./config.sh
476 perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()'
479 perl '-MExtUtils::Manifest=&mkmanifest' -e 'mkmanifest()'
481 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
482 # If this runs make out of memory, delete /usr/include lines.
489 $ln Makefile ../Makefile
492 $rm -f $firstmakefile