This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 9
[perl5.git] / Makefile.SH
CommitLineData
2304df62
AD
1case $CONFIG in
2'')
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=../../../..;
8 else
9 echo "Can't find config.sh."; exit 1
10 fi
11 . $TOP/config.sh
12 ;;
13esac
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.
16case "$0" in
17*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
18esac
19
2304df62
AD
20case "$d_dosuid" in
21*define*) suidperl='suidperl' ;;
22*) suidperl='';;
23esac
24
85e6fe83
LW
25: Certain parts of Makefile need to be commented out if dynamic
26: loading is not used.
27case "$usedl" in
28define) comment='' ;;
29*) comment='#' ;;
30esac
31
2304df62
AD
32echo "Extracting Makefile (with variable substitutions)"
33: This section of the file will have variable substitutions done on it.
34: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
35: Protect any dollar signs and backticks that you do not want interpreted
36: by putting a backslash in front. You may delete these comments.
37$spitshell >Makefile <<!GROK!THIS!
85e6fe83
LW
38# $Makefile.SH,v $Revision: 4.1 $Date: 92/08/07 17:18:08 $
39# This file is derived from Makefile.SH. Any changes made here will
40# be lost the next time you run Configure.
41# Makefile is used to generate makefile. The only difference
42# is that makefile has the dependencies filled in at the end.
2304df62 43#
85e6fe83 44# \$Log: Makefile.SH,v \$
2304df62
AD
45# Revision 4.1 92/08/07 17:18:08 lwall
46# Stage 6 Snapshot
47#
48# Revision 4.0.1.4 92/06/08 11:40:43 lwall
49# patch20: cray didn't give enough memory to /bin/sh
50# patch20: various and sundry fixes
51#
52# Revision 4.0.1.3 91/11/05 15:48:11 lwall
53# patch11: saberized perl
54# patch11: added support for dbz
55#
56# Revision 4.0.1.2 91/06/07 10:14:43 lwall
57# patch4: cflags now emits entire cc command except for the filename
58# patch4: alternate make programs are now semi-supported
59# patch4: uperl.o no longer tries to link in libraries prematurely
60# patch4: installperl now installs x2p stuff too
61#
62# Revision 4.0.1.1 91/04/11 17:30:39 lwall
63# patch1: C flags are now settable on a per-file basis
64#
65# Revision 4.0 91/03/20 00:58:54 lwall
66# 4.0 baseline.
67#
68#
69
70# I now supply perly.c with the kits, so don't remake perly.c without byacc
71BYACC = $byacc
72CC = $cc
73bin = $installbin
74scriptdir = $scriptdir
75privlib = $installprivlib
76mansrc = $mansrc
77manext = $manext
78LDFLAGS = $ldflags
79CLDFLAGS = $ldflags
85e6fe83 80
2304df62
AD
81SMALL = $small
82LARGE = $large $split
83mallocsrc = $mallocsrc
84mallocobj = $mallocobj
85dlsrc = $dlsrc
86dlobj = $dlobj
85e6fe83
LW
87dldir = $dldir
88LNS = $lns
2304df62 89RMS = rm -f
85e6fe83
LW
90ranlib = $ranlib
91
92# The following are used to build and install shared libraries for
93# dynamic loading.
94LDDLFLAGS = $lddlflags
95CCDLFLAGS = $ccdlflags
96CCCDLFLAGS = $cccdlflags
97SHLIBSUFFIX = $shlibsuffix
2304df62
AD
98
99libs = $libs $cryptlib
100
101public = perl $suidperl
102
103shellflags = $shellflags
104
85e6fe83 105## To use an alternate make, set $altmake in config.sh.
2304df62
AD
106MAKE = ${altmake-make}
107!GROK!THIS!
108
85e6fe83 109## In the following dollars and backticks do not need the extra backslash.
2304df62
AD
110$spitshell >>Makefile <<'!NO!SUBS!'
111
112CCCMD = `sh $(shellflags) cflags $@`
113
114private =
115
116scripts = h2ph
117
118manpages = perl.man h2ph.man
119
120util =
121
85e6fe83 122sh = Makefile.SH cflags.SH embed_h.SH makedepend.SH makedir.SH writemain.SH
2304df62
AD
123
124h1 = EXTERN.h INTERN.h av.h cop.h config.h embed.h form.h handy.h
125h2 = hv.h op.h opcode.h perl.h regcomp.h regexp.h gv.h sv.h util.h
126
127h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h
128h2 = embed.h form.h gv.h handy.h hv.h hvdbm.h keywords.h mg.h op.h
129h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h
130h4 = regexp.h scope.h sv.h unixish.h util.h
131h = $(h1) $(h2) $(h3) $(h4)
132
133c1 = av.c scope.c op.c doop.c doio.c dump.c hv.c
134c2 = $(mallocsrc) mg.c perly.c pp.c regcomp.c regexec.c
135c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c
136
85e6fe83 137c = $(c1) $(c2) $(c3) $(dlsrc) miniperlmain.c perlmain.c
2304df62
AD
138
139s1 = av.c scope.c op.c doop.c doio.c dump.c hv.c
85e6fe83 140s2 = $(mallocsrc) mg.c perly.c pp.c regcomp.c regexec.c
2304df62
AD
141s3 = gv.c sv.c taint.c toke.c util.c deb.c run.c perly.c
142
85e6fe83 143saber = $(s1) $(s2) $(s3) $(dlsrc)
2304df62
AD
144
145obj1 = av.o scope.o op.o doop.o doio.o dump.o hv.o
146obj2 = $(mallocobj) mg.o perly.o pp.o regcomp.o regexec.o
147obj3 = gv.o sv.o taint.o toke.o util.o deb.o run.o
148
85e6fe83 149obj = $(obj1) $(obj2) $(obj3)
2304df62
AD
150
151lintflags = -hbvxac
152
153addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
154
155# grrr
156SHELL = /bin/sh
157
2304df62
AD
158.c.o:
159 $(CCCMD) $*.c
160
2304df62
AD
161all: miniperl perl lib/Config.pm
162
163#all: $(public) $(private) $(util) $(scripts)
164# cd x2p; $(MAKE) all
165# touch all
85e6fe83
LW
166
167# Phony target to force checking subdirectories.
168FORCE:
169
2304df62 170!NO!SUBS!
85e6fe83
LW
171
172### Some makes have problems with the following dependency
173### if $(dlsrc) or $(dlobj) is empty.
174### Therefore, comment it out if dlsrc is null.
175###
176$spitshell >>Makefile <<!GROK!THIS!
177${comment}
178${comment}\$(dlsrc): \$(dldir)/\$(dlsrc)
179${comment} cp \$(dldir)/\$(dlsrc) \$(dlsrc)
180
181${comment}\$(dlobj): \$(dlsrc)
182${comment} \$(CCCMD) \$(dlsrc)
183
184!GROK!THIS!
185
2304df62
AD
186###
187### Boilerplate for all the .xs files in the ext directory.
188### XXX FIXME: At some point we also need to copy .pm files out of
189### XXX the ext directory into lib.
85e6fe83
LW
190### XXX FIXME: At some point we need to run autosplit on the .pm
191### XXX files.
192### Configure sets extensions to a string like
193### "ext/dbm/NDBM_File.xs ext/dbm/ODBM_File.xs ext/dbm/GDBM_File.xs \
194### ext/dbm/SDBM_File.xs ext/posix/POSIX.xs"
195ext=" "
196extdep=" "
197extobj=" "
198extsrc=" "
199# extradep gives any extra dependencies of this extension.
200# extraobj gives any extra thinks to link with this extension.
2304df62
AD
201for f in $extensions
202do
85e6fe83
LW
203 base=`echo $f | $sed -e 's@.*/\(.*\).xs@\1@'`
204 ext="$ext $base"
205 extsrc="$extsrc $base.c"
206 case $base in
207 SDBM_File) extradep="ext/dbm/sdbm/libsdbm.a"
208 extraobj="ext/dbm/sdbm/libsdbm.a" ;;
209 POSIX) extradep=""
210 extraobj="-lm" ;;
211 *) extradep=""
212 extraobj="" ;;
213 esac
214 case "$usedl" in
215 define) extdep="$extdep lib/auto/$base/${base}\$(SHLIBSUFFIX)"
216 ;;
217 *) extdep="$extdep $base.o $extradep"
218 extobj="$extobj $base.o $extraobj" ;;
219 esac
220
2304df62
AD
221 $spitshell >>Makefile <<!GROK!THIS!
222
223# $base extension
85e6fe83
LW
224$base.o: $base.c
225 \$(CCCMD) \$(CCCDLFLAGS) \$*.c
226
2304df62
AD
227$base.c: $f ext/xsubpp ext/typemap
228 test -f miniperl || make miniperl
85e6fe83 229 ./miniperl ext/xsubpp $f >tmp
2304df62
AD
230 mv tmp $base.c
231
85e6fe83
LW
232${comment}lib/auto/$base/$base\$(SHLIBSUFFIX): $base.o $extradep
233${comment} test -d lib/auto/$base || mkdir lib/auto/$base
234${comment} ld \$(LDDLFLAGS) -o \$@ $base.o $extraobj
2304df62
AD
235!GROK!THIS!
236
85e6fe83 237done
2304df62 238
85e6fe83 239$spitshell >>Makefile <<!GROK!THIS!
2304df62 240
85e6fe83
LW
241# List of extensions (used by writemain) to generate perlmain.c
242ext=$ext
243extsrc=$extsrc
244# Extension dependencies.
245extdep=$extdep
246# How to include extensions in linking command
247extobj=$extobj
2304df62 248
85e6fe83
LW
249ext/dbm/sdbm/libsdbm.a: ext/dbm/sdbm/sdbm.h ext/dbm/sdbm/sdbm.c
250 cd ext/dbm/sdbm; \$(MAKE) -f Makefile libsdbm.a
2304df62 251
85e6fe83
LW
252!GROK!THIS!
253
254### Now on to the rest of the Makefile.
2304df62
AD
255$spitshell >>Makefile <<'!NO!SUBS!'
256# The $& notation tells Sequent machines that it can do a parallel make,
257# and is harmless otherwise.
258
2304df62
AD
259miniperl: $& miniperlmain.o perl.o $(obj)
260 $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o perl.o $(obj) $(libs)
261
85e6fe83
LW
262perlmain.c: miniperlmain.c
263 sh writemain $(ext) > perlmain.c
264
2304df62 265perlmain.o: perlmain.c
85e6fe83
LW
266
267perl: $& perlmain.o perl.o $(obj) $(dlobj) $(extdep)
268 $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o perl.o $(obj) $(dlobj) $(extobj) $(libs)
269
270pureperl: $& perlmain.o perl.o $(obj) $(dlobj) $(extdep)
271 purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o perl.o $(obj) $(dlobj) $(extobj) $(libs)
272
273quantperl: $& perlmain.o perl.o $(obj) $(dlobj) $(extdep)
274 quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o perl.o $(obj) $(dlobj) $(extobj) $(libs)
2304df62
AD
275
276libperl.rlb: libperl.a
85e6fe83 277 $(ranlib) libperl.a
2304df62
AD
278 touch libperl.rlb
279
280libperl.a: $& perl.o $(obj)
281 ar rcuv libperl.a $(obj)
282
283# This version, if specified in Configure, does ONLY those scripts which need
284# set-id emulation. Suidperl must be setuid root. It contains the "taint"
285# checks as well as the special code to validate that the script in question
286# has been invoked correctly.
287
85e6fe83
LW
288suidperl: $& sperl.o perlmain.o libperl.rlb
289 $(CC) $(LARGE) $(CLDFLAGS) sperl.o perlmain.o libperl.a $(libs) -o suidperl
2304df62 290
85e6fe83
LW
291lib/Config.pm: config.sh miniperl
292 ./miniperl configpm
2304df62
AD
293
294saber: $(saber)
295 # load $(saber)
296 # load /lib/libm.a
297
298sperl.o: perl.c perly.h patchlevel.h $(h)
299 $(RMS) sperl.c
85e6fe83 300 $(LNS) perl.c sperl.c
2304df62
AD
301 $(CCCMD) -DIAMSUID sperl.c
302 $(RMS) sperl.c
303
2304df62
AD
304perly.h: perly.c
305 @ echo Dummy dependency for dumb parallel make
306 touch perly.h
307
308opcode.h: opcode.pl
85e6fe83 309 - perl opcode.pl
2304df62
AD
310
311embed.h: embed_h.SH global.sym interp.sym
312 sh embed_h.SH
313
314perly.c:
315 @ echo 'Expect' 80 shift/reduce and 62 reduce/reduce conflicts
316 $(BYACC) -d perly.y
317 sh $(shellflags) ./perly.fixer y.tab.c perly.c
318 mv y.tab.h perly.h
319 echo 'extern YYSTYPE yylval;' >>perly.h
320
321perly.o: perly.c perly.h $(h)
322 $(CCCMD) perly.c
323
324install: all
325 ./perl installperl
326
327clean:
85e6fe83
LW
328 rm -f *.o all perl miniperl
329 rm -f POSIX.c ?DBM_File.c perlmain.c
330 rm -f ext/dbm/sdbm/libsdbm.a
331 cd ext/dbm/sdbm; $(MAKE) -f Makefile clean
2304df62
AD
332 cd x2p; $(MAKE) clean
333
334realclean: clean
335 cd x2p; $(MAKE) realclean
85e6fe83 336 cd ext/dbm/sdbm; $(MAKE) -f Makefile realclean
2304df62 337 rm -f *.orig */*.orig *~ */*~ core $(addedbyconf) h2ph h2ph.man
85e6fe83
LW
338 rm -f Makefile cflags embed_h makedepend makedir writemain
339 rm -f config.h t/perl makefile makefile.old cflags
340 rm -rf lib/auto/?DBM_File lib/auto/POSIX
341 rm -f x2p/Makefile x2p/makefile x2p/makefile.old x2p/cflags
342 rm -f lib/Config.pm
2304df62
AD
343 rm -f c2ph pstruct
344
345# The following lint has practically everything turned on. Unfortunately,
346# you have to wade through a lot of mumbo jumbo that can't be suppressed.
347# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
348# for that spot.
349
350lint: perly.c $(c)
351 lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
352
353depend: makedepend
354 - test -f perly.h || cp /dev/null perly.h
355 ./makedepend
356 - test -s perly.h || /bin/rm -f perly.h
357 cd x2p; $(MAKE) depend
358
85e6fe83 359test: perl lib/Config.pm
2304df62 360 - cd t && chmod +x TEST */*.t
85e6fe83 361 - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty
2304df62 362
85e6fe83 363clist: $(c)
2304df62
AD
364 echo $(c) | tr ' ' '\012' >.clist
365
85e6fe83 366hlist: $(h)
2304df62
AD
367 echo $(h) | tr ' ' '\012' >.hlist
368
85e6fe83 369shlist: $(sh)
2304df62
AD
370 echo $(sh) | tr ' ' '\012' >.shlist
371
372# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
373# If this runs make out of memory, delete /usr/include lines.
374!NO!SUBS!
375
85e6fe83 376$eunicefix Makefile
2304df62
AD
377case `pwd` in
378*SH)
85e6fe83
LW
379 $rm -f ../Makefile
380 ln Makefile ../Makefile
2304df62
AD
381 ;;
382esac
383rm -f makefile