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 : Configure sets byacc=byacc if byacc is not found. We reset it to ''
49 : Prepare dependency lists for Makefile.
51 for f in $dynamic_ext; do
52 : the dependency named here will never exist
53 base=`echo "$f" | sed 's/.*\///'`
54 dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext"
59 for f in $static_ext; do
60 base=`echo "$f" | sed 's/.*\///'`
61 static_list="$static_list lib/auto/$f/$base.a"
62 if test -f ext/$f/AutoInit.c; then
63 static_ai_list="$static_ai_list ext/$f/AutoInit.c"
65 if test -f ext/$f/AutoInit.pl; then
66 static_ai_list="$static_ai_list ext/$f/AutoInit.pl"
70 echo "Extracting Makefile (with variable substitutions)"
71 $spitshell >Makefile <<'!NO!SUBS!'
73 # This file is derived from Makefile.SH. Any changes made here will
74 # be lost the next time you run Configure.
75 # Makefile is used to generate makefile. The only difference
76 # is that makefile has the dependencies filled in at the end.
81 $spitshell >>Makefile <<!GROK!THIS!
82 # I now supply perly.c with the kits, so don't remake perly.c without byacc
86 scriptdir = $scriptdir
87 privlib = $installprivlib
95 mallocsrc = $mallocsrc
96 mallocobj = $mallocobj
101 # The following are used to build and install shared libraries for
103 LDDLFLAGS = $lddlflags
104 CCDLFLAGS = $ccdlflags
106 PLDLFLAGS = $pldlflags
110 dynamic_ext = $dynamic_list
111 static_ext = $static_list
112 ext = \$(dynamic_ext) \$(static_ext)
113 static_ext_autoinit = $static_ai_list
114 DYNALOADER = lib/auto/DynaLoader/DynaLoader.a
117 libs = $libs $cryptlib
119 public = perl $suidperl
121 shellflags = $shellflags
123 ## To use an alternate make, set \$altmake in config.sh.
124 MAKE = ${altmake-make}
127 ## In the following dollars and backticks do not need the extra backslash.
128 $spitshell >>Makefile <<'!NO!SUBS!'
130 CCCMD = `sh $(shellflags) cflags $(perllib) $@`
140 sh = Makefile.SH cflags.SH makedepend.SH makedir.SH writemain.SH
142 h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
143 h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h
144 h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
145 h4 = regexp.h scope.h sv.h unixish.h util.h
146 h = $(h1) $(h2) $(h3) $(h4)
148 c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c
149 c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c
150 c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c globals.c
152 c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
154 obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o
155 obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
156 obj3 = doop.o doio.o regexec.o taint.o deb.o globals.o
158 obj = $(obj1) $(obj2) $(obj3)
160 # Once perl has been Configure'd and built ok you build different
161 # perl variants (Debugging, Embedded, Multiplicity etc) by saying:
162 # make clean; make perllib=libperl<type>.a
163 # where <type> is some combination of 'd' and(or) 'e' or 'm'.
164 # See cflags to understand how this works.
166 # Eventually some form of 'make-a-perl' script will automate this
167 # together with linking a perl executable with any desired
169 perllib = libperl$(PLIBSUF)
179 $(CCCMD) $(PLDLFLAGS) $*.c
181 all: makefile miniperl preplibrary $(public) $(dynamic_ext)
182 @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all
183 @echo " "; echo " Making docs"; cd pod; $(MAKE) all;
185 # Phony target to force checking subdirectories.
190 : Now on to the rest of the Makefile.
191 $spitshell >>Makefile <<'!NO!SUBS!'
192 # The $& notation tells Sequent machines that it can do a parallel make,
193 # and is harmless otherwise.
195 miniperl: $& miniperlmain.o $(perllib)
196 $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs)
198 miniperlmain.o: miniperlmain.c
199 $(CCCMD) $(PLDLFLAGS) $*.c
201 perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
202 sh writemain $(DYNALOADER) $(static_ext) > tmp
203 sh mv-if-diff tmp perlmain.c
205 perlmain.o: perlmain.c
206 $(CCCMD) $(PLDLFLAGS) $*.c
208 # The file ext.libs is a list of libraries that must be linked in
209 # for static extensions, e.g. -lm -lgdbm, etc. The individual
210 # static extension Makefile's add to it.
211 ext.libs: $(static_ext)
212 -@test -f ext.libs || touch ext.libs
214 perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
215 $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
217 pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
218 purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
220 quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
221 quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
223 $(perllib): $& perl.o $(obj)
228 $spitshell >>Makefile <<'!NO!SUBS!'
229 ld $(LDDLFLAGS) -o $@ perl.o $(obj)
233 $spitshell >>Makefile <<'!NO!SUBS!'
234 ar rcu $(perllib) perl.o $(obj)
235 @$(ranlib) $(perllib)
240 $spitshell >>Makefile <<'!NO!SUBS!'
242 # This version, if specified in Configure, does ONLY those scripts which need
243 # set-id emulation. Suidperl must be setuid root. It contains the "taint"
244 # checks as well as the special code to validate that the script in question
245 # has been invoked correctly.
247 suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs
248 $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs)
250 sperl.o: perl.c perly.h patchlevel.h $(h)
252 $(LNS) perl.c sperl.c
253 $(CCCMD) -DIAMSUID sperl.c
259 embed.h: embed_h.sh global.sym interp.sym
262 preplibrary: miniperl lib/Config.pm
264 @echo " AutoSplitting perl library"
265 @./miniperl -Ilib -e 'use AutoSplit; \
266 autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
268 # Take care to avoid modifying lib/Config.pm without reason
269 lib/Config.pm: config.sh miniperl
270 ./miniperl configpm tmp
271 sh mv-if-diff tmp lib/Config.pm
277 : Only print out the rules for running byacc if the user _has_ byacc.
278 : Otherwise, comment them out. Users who really know what they are
279 : doing can uncomment them and run yacc or bison or whatever.
288 $spitshell >>Makefile <<!GROK!THIS!
291 @ echo Dummy dependency for dumb parallel make
294 # I now supply perly.c with the kits, so the following section is
295 # used only if you have byacc.
297 ${comment1}perly.c: perly.y perly.c.diff
298 ${comment1} @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict
299 ${comment1} \$(BYACC) -d perly.y
300 ${comment1} sh \$(shellflags) ./perly.fixer y.tab.c perly.c
301 ${comment1} mv y.tab.h perly.h
302 ${comment1} echo 'extern YYSTYPE yylval;' >>perly.h
304 # This version is used if you do not have byacc.
305 ${comment2}perly.c: perly.y
306 ${comment2} touch perly.c
310 $spitshell >>Makefile <<'!NO!SUBS!'
312 # Names added to $(dynamic_ext) or $(static_ext) will automatically
313 # get built. There should ordinarily be no need to change any of
314 # this part of makefile.
316 # The dummy dependency is a place holder in case $(dynamic_ext) or
317 # $(static_ext) is empty.
319 # DynaLoader may be needed for extensions that use Makefile.PL.
321 $(DYNALOADER): miniperl preplibrary FORCE
322 @sh ext/util/make_ext static $@
324 d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
325 @sh ext/util/make_ext dynamic $@
327 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
328 @sh ext/util/make_ext static $@
331 rm -f *.o *.a all perlmain.c
332 rm -f perl.exp ext.libs ext/util/extlibist
333 -cd x2p; $(MAKE) clean
334 -cd pod; $(MAKE) clean
335 -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
336 sh ext/util/make_ext clean $$x ; \
338 rm -f perl suidperl miniperl $(perllib)
341 -cd x2p; $(MAKE) realclean
342 @for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
343 sh ext/util/make_ext realclean $$x ; \
345 rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
346 rm -rf $(addedbyconf)
347 rm -f Makefile cflags makedepend makedir writemain
348 rm -f config.h makefile makefile.old
351 rm -f h2ph h2ph.man c2ph pstruct
353 @echo "Note that make realclean does not delete config.sh"
356 rm -f config.sh cppstdin
360 # The following lint has practically everything turned on. Unfortunately,
361 # you have to wade through a lot of mumbo jumbo that can't be suppressed.
362 # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
366 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
374 # When done, touch perlmain.c so that it doesn't get remade each time.
376 - test -f perly.h || cp /dev/null perly.h
378 - test -s perly.h || /bin/rm -f perly.h
379 - test -s perlmain.c && touch perlmain.c
380 cd x2p; $(MAKE) depend
382 test: miniperl perl preplibrary $(dynamic_ext)
383 - cd t && chmod +x TEST */*.t
384 - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty
387 echo $(c) | tr ' ' '\012' >.clist
390 echo $(h) | tr ' ' '\012' >.hlist
393 echo $(sh) | tr ' ' '\012' >.shlist
395 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
396 # If this runs make out of memory, delete /usr/include lines.
403 ln Makefile ../Makefile