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 patchlevel=`egrep '^#define[ ]+PATCHLEVEL' patchlevel.h \
31 *[0-9]) plibsuf=.$so.$patchlevel;;
37 *) shrpenv="env LD_RUN_PATH=$shrpdir";;
39 pldlflags="$cccdlflags";;
44 : Prepare dependency lists for Makefile.
46 for f in $dynamic_ext; do
47 : the dependency named here will never exist
48 base=`echo "$f" | sed 's/.*\///'`
49 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
54 for f in $static_ext; do
55 base=`echo "$f" | sed 's/.*\///'`
56 static_list="$static_list lib/auto/$f/$base.a"
57 if test -f ext/$f/AutoInit.c; then
58 static_ai_list="$static_ai_list ext/$f/AutoInit.c"
60 if test -f ext/$f/AutoInit.pl; then
61 static_ai_list="$static_ai_list ext/$f/AutoInit.pl"
65 echo "Extracting Makefile (with variable substitutions)"
66 $spitshell >Makefile <<'!NO!SUBS!'
68 # This file is derived from Makefile.SH. Any changes made here will
69 # be lost the next time you run Configure.
70 # Makefile is used to generate makefile. The only difference
71 # is that makefile has the dependencies filled in at the end.
76 $spitshell >>Makefile <<!GROK!THIS!
77 # I now supply perly.c with the kits, so don't remake perly.c without byacc
81 scriptdir = $scriptdir
82 privlib = $installprivlib
90 mallocsrc = $mallocsrc
91 mallocobj = $mallocobj
96 # The following are used to build and install shared libraries for
98 LDDLFLAGS = $lddlflags
99 CCDLFLAGS = $ccdlflags
101 PLDLFLAGS = $pldlflags
105 dynamic_ext = $dynamic_list
106 static_ext = $static_list
107 ext = \$(dynamic_ext) \$(static_ext)
108 static_ext_autoinit = $static_ai_list
109 DYNALOADER = lib/auto/DynaLoader/DynaLoader.a
112 libs = $libs $cryptlib
114 public = perl $suidperl
116 shellflags = $shellflags
118 ## To use an alternate make, set \$altmake in config.sh.
119 MAKE = ${altmake-make}
122 ## In the following dollars and backticks do not need the extra backslash.
123 $spitshell >>Makefile <<'!NO!SUBS!'
125 CCCMD = `sh $(shellflags) cflags $(perllib) $@`
127 private = preplibrary lib/ExtUtils/Miniperl.pm lib/Config.pm
135 sh = Makefile.SH cflags.SH makedepend.SH makedir.SH writemain.SH
137 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
138 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
139 h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
140 h4 = regexp.h scope.h sv.h unixish.h util.h
141 h = $(h1) $(h2) $(h3) $(h4)
143 c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
144 c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
145 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c globals.c
147 c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
149 obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o
150 obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
151 obj3 = doop.o doio.o regexec.o taint.o deb.o globals.o
153 obj = $(obj1) $(obj2) $(obj3)
155 # Once perl has been Configure'd and built ok you build different
156 # perl variants (Debugging, Embedded, Multiplicity etc) by saying:
157 # make clean; make perllib=libperl<type>.a
158 # where <type> is some combination of 'd' and(or) 'e' or 'm'.
159 # See cflags to understand how this works.
161 # Eventually some form of 'make-a-perl' script will automate this
162 # together with linking a perl executable with any desired
164 perllib = libperl$(PLIBSUF)
174 $(CCCMD) $(PLDLFLAGS) $*.c
176 all: makefile miniperl $(private) $(public) $(dynamic_ext)
177 @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
178 @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
180 # Phony target to force checking subdirectories.
185 : Now on to the rest of the Makefile.
186 $spitshell >>Makefile <<'!NO!SUBS!'
187 # The $& notation tells Sequent machines that it can do a parallel make,
188 # and is harmless otherwise.
190 miniperl: $& miniperlmain.o $(perllib)
191 $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs)
193 miniperlmain.o: miniperlmain.c
194 $(CCCMD) $(PLDLFLAGS) $*.c
196 perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
197 sh writemain $(DYNALOADER) $(static_ext) > tmp
198 sh mv-if-diff tmp perlmain.c
200 perlmain.o: perlmain.c
201 $(CCCMD) $(PLDLFLAGS) $*.c
203 # The file ext.libs is a list of libraries that must be linked in
204 # for static extensions, e.g. -lm -lgdbm, etc. The individual
205 # static extension Makefile's add to it.
206 ext.libs: $(static_ext)
207 -@test -f ext.libs || touch ext.libs
209 perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
210 $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
212 pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
213 purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
215 quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
216 quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
218 $(perllib): $& perl.o $(obj)
223 $spitshell >>Makefile <<'!NO!SUBS!'
224 ld $(LDDLFLAGS) -o $@ perl.o $(obj)
228 $spitshell >>Makefile <<'!NO!SUBS!'
229 ar rcu $(perllib) perl.o $(obj)
230 @$(ranlib) $(perllib)
235 $spitshell >>Makefile <<'!NO!SUBS!'
237 # This version, if specified in Configure, does ONLY those scripts which need
238 # set-id emulation. Suidperl must be setuid root. It contains the "taint"
239 # checks as well as the special code to validate that the script in question
240 # has been invoked correctly.
242 suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
243 $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
245 sperl.o: perl.c perly.h patchlevel.h $(h)
247 $(LNS) perl.c sperl.c
248 $(CCCMD) -DIAMSUID sperl.c
254 embed.h: embed_h.sh global.sym interp.sym
257 # We have to call our ./makedir because Ultrix 4.3 make can't handle the line
258 # test -d lib/auto || mkdir lib/auto
260 preplibrary: miniperl lib/Config.pm
262 @echo " AutoSplitting perl library"
263 @./miniperl -Ilib -e 'use AutoSplit; \
264 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
266 # Take care to avoid modifying lib/Config.pm without reason
267 lib/Config.pm: config.sh miniperl
268 ./miniperl configpm tmp
269 sh mv-if-diff tmp lib/Config.pm
271 lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.PL lib/Config.pm
272 ./miniperl minimod.PL > tmp && mv tmp $@
277 # I now supply perly.c with the kits, so the following section is
278 # used only if you force byacc to run by saying
280 # Since we patch up the byacc output, the perly.fixer script needs
281 # to run with precisely the same version of byacc as I use. You
282 # normally shouldn't remake perly.[ch].
285 @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict
287 sh $(shellflags) ./perly.fixer y.tab.c perly.c
289 echo 'extern YYSTYPE yylval;' >>perly.h
291 # We don't want to regenerate perly.c and perly.h, but they might
292 # appear out-of-date after a patch is applied or a new distribution is
301 # Names added to $(dynamic_ext) or $(static_ext) will automatically
302 # get built. There should ordinarily be no need to change any of
303 # this part of makefile.
305 # The dummy dependency is a place holder in case $(dynamic_ext) or
306 # $(static_ext) is empty.
308 # DynaLoader may be needed for extensions that use Makefile.PL.
310 $(DYNALOADER): miniperl preplibrary FORCE
311 @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
313 d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
314 @sh ext/util/make_ext dynamic $@ LIBPERL_A=$(perllib)
316 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
317 @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
320 rm -f *.o *.a all perlmain.c
321 rm -f perl.exp ext.libs
322 -cd x2p; $(MAKE) clean
323 -cd pod; $(MAKE) clean
324 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
325 sh ext/util/make_ext clean $$x ; \
327 rm -f perl suidperl miniperl $(perllib)
330 -cd x2p; $(MAKE) realclean
331 @for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
332 sh ext/util/make_ext realclean $$x ; \
334 rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
335 rm -rf $(addedbyconf)
336 rm -f Makefile cflags makedepend makedir writemain
337 rm -f config.h makefile makefile.old
340 rm -f h2ph h2ph.man c2ph pstruct h2xs makeaperl
342 @echo "Note that make realclean does not delete config.sh"
345 rm -f config.sh cppstdin
349 # The following lint has practically everything turned on. Unfortunately,
350 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
351 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
355 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
363 # When done, touch perlmain.c so that it doesn't get remade each time.
366 - test -s perlmain.c && touch perlmain.c
367 cd x2p; $(MAKE) depend
369 test: miniperl perl preplibrary $(dynamic_ext)
370 - cd t && chmod +x TEST */*.t
371 - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty
374 echo $(c) | tr ' ' '\012' >.clist
377 echo $(h) | tr ' ' '\012' >.hlist
380 echo $(sh) | tr ' ' '\012' >.shlist
382 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
383 # If this runs make out of memory, delete /usr/include lines.
390 ln Makefile ../Makefile