Commit | Line | Data |
2304df62 |
1 | case $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 | ;; |
13 | esac |
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. |
16 | case "$0" in |
17 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; |
18 | esac |
19 | |
2304df62 |
20 | case "$d_dosuid" in |
21 | *define*) suidperl='suidperl' ;; |
22 | *) suidperl='';; |
23 | esac |
24 | |
ecfc5424 |
25 | shrpenv="" |
26 | case "$d_shrplib" in |
27 | *define*) |
28 | patchlevel=`egrep '^#define[ ]+PATCHLEVEL' patchlevel.h \ |
29 | | awk '{print $3}'` |
30 | case "$patchlevel" in |
31 | *[0-9]) plibsuf=.$so.$patchlevel;; |
32 | *) plibsuf=.$so;; |
33 | esac |
34 | case "$shrpdir" in |
35 | /usr/lib) ;; |
36 | "") ;; |
37 | *) shrpenv="env LD_RUN_PATH=$shrpdir";; |
38 | esac |
39 | pldlflags="$cccdlflags";; |
40 | *) plibsuf=.a |
41 | pldlflags="";; |
42 | esac |
43 | |
a0d0e21e |
44 | : Configure sets byacc=byacc if byacc is not found. We reset it to '' |
45 | case "$byacc" in |
ecfc5424 |
46 | 'byacc') byacc='';; |
85e6fe83 |
47 | esac |
48 | |
a0d0e21e |
49 | : Prepare dependency lists for Makefile. |
50 | dynamic_list=' ' |
51 | for f in $dynamic_ext; do |
52 | : the dependency named here will never exist |
ecfc5424 |
53 | base=`echo "$f" | sed 's/.*\///'` |
e1666bf5 |
54 | dynamic_list="$dynamic_list ext/$f/$base.$dlext" |
a0d0e21e |
55 | done |
56 | |
57 | static_list=' ' |
58 | static_ai_list=' ' |
59 | for f in $static_ext; do |
60 | base=`echo "$f" | sed 's/.*\///'` |
61 | static_list="$static_list ext/$f/$base.a" |
62 | if test -f ext/$f/AutoInit.c; then |
63 | static_ai_list="$static_ai_list ext/$f/AutoInit.c" |
64 | fi |
65 | if test -f ext/$f/AutoInit.pl; then |
66 | static_ai_list="$static_ai_list ext/$f/AutoInit.pl" |
67 | fi |
68 | done |
69 | |
2304df62 |
70 | echo "Extracting Makefile (with variable substitutions)" |
a0d0e21e |
71 | $spitshell >Makefile <<'!NO!SUBS!' |
72 | # Makefile.SH |
85e6fe83 |
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. |
2304df62 |
77 | # |
2304df62 |
78 | # |
a0d0e21e |
79 | !NO!SUBS! |
2304df62 |
80 | |
a0d0e21e |
81 | $spitshell >>Makefile <<!GROK!THIS! |
2304df62 |
82 | # I now supply perly.c with the kits, so don't remake perly.c without byacc |
83 | BYACC = $byacc |
84 | CC = $cc |
85 | bin = $installbin |
86 | scriptdir = $scriptdir |
87 | privlib = $installprivlib |
88 | mansrc = $mansrc |
89 | manext = $manext |
90 | LDFLAGS = $ldflags |
91 | CLDFLAGS = $ldflags |
85e6fe83 |
92 | |
2304df62 |
93 | SMALL = $small |
94 | LARGE = $large $split |
95 | mallocsrc = $mallocsrc |
96 | mallocobj = $mallocobj |
85e6fe83 |
97 | LNS = $lns |
2304df62 |
98 | RMS = rm -f |
85e6fe83 |
99 | ranlib = $ranlib |
100 | |
101 | # The following are used to build and install shared libraries for |
102 | # dynamic loading. |
103 | LDDLFLAGS = $lddlflags |
104 | CCDLFLAGS = $ccdlflags |
105 | CCCDLFLAGS = $cccdlflags |
a0d0e21e |
106 | DLSUFFIX = .$dlext |
ecfc5424 |
107 | PLDLFLAGS = $pldlflags |
108 | PLIBSUF = $plibsuf |
109 | SHRPENV = $shrpenv |
a0d0e21e |
110 | |
111 | dynamic_ext = $dynamic_list |
112 | static_ext = $static_list |
113 | ext = \$(dynamic_ext) \$(static_ext) |
114 | static_ext_autoinit = $static_ai_list |
115 | DYNALOADER = ext/DynaLoader/DynaLoader.a |
2304df62 |
116 | |
117 | libs = $libs $cryptlib |
118 | |
119 | public = perl $suidperl |
120 | |
121 | shellflags = $shellflags |
122 | |
a0d0e21e |
123 | ## To use an alternate make, set \$altmake in config.sh. |
2304df62 |
124 | MAKE = ${altmake-make} |
125 | !GROK!THIS! |
126 | |
85e6fe83 |
127 | ## In the following dollars and backticks do not need the extra backslash. |
2304df62 |
128 | $spitshell >>Makefile <<'!NO!SUBS!' |
129 | |
a0d0e21e |
130 | CCCMD = `sh $(shellflags) cflags $(perllib) $@` |
2304df62 |
131 | |
132 | private = |
133 | |
a0d0e21e |
134 | scripts = |
2304df62 |
135 | |
a0d0e21e |
136 | manpages = perl.man |
2304df62 |
137 | |
138 | util = |
139 | |
3edbfbe5 |
140 | sh = Makefile.SH cflags.SH makedepend.SH makedir.SH writemain.SH |
2304df62 |
141 | |
2304df62 |
142 | h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h |
a0d0e21e |
143 | h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h |
2304df62 |
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) |
147 | |
a0d0e21e |
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 |
ecfc5424 |
150 | c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c globals.c |
2304df62 |
151 | |
a0d0e21e |
152 | c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c |
2304df62 |
153 | |
a0d0e21e |
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 |
ecfc5424 |
156 | obj3 = doop.o doio.o regexec.o taint.o deb.o globals.o |
2304df62 |
157 | |
85e6fe83 |
158 | obj = $(obj1) $(obj2) $(obj3) |
2304df62 |
159 | |
a0d0e21e |
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. |
165 | # |
166 | # Eventually some form of 'make-a-perl' script will automate this |
167 | # together with linking a perl executable with any desired |
168 | # static modules. |
ecfc5424 |
169 | perllib = libperl$(PLIBSUF) |
a0d0e21e |
170 | |
2304df62 |
171 | lintflags = -hbvxac |
172 | |
a0d0e21e |
173 | addedbyconf = UU |
2304df62 |
174 | |
175 | # grrr |
176 | SHELL = /bin/sh |
177 | |
2304df62 |
178 | .c.o: |
ecfc5424 |
179 | $(CCCMD) $(PLDLFLAGS) $*.c |
2304df62 |
180 | |
a0d0e21e |
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; |
85e6fe83 |
184 | |
185 | # Phony target to force checking subdirectories. |
186 | FORCE: |
187 | |
2304df62 |
188 | !NO!SUBS! |
85e6fe83 |
189 | |
a0d0e21e |
190 | : Now on to the rest of the Makefile. |
2304df62 |
191 | $spitshell >>Makefile <<'!NO!SUBS!' |
192 | # The $& notation tells Sequent machines that it can do a parallel make, |
193 | # and is harmless otherwise. |
194 | |
a0d0e21e |
195 | miniperl: $& miniperlmain.o $(perllib) |
196 | $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs) |
2304df62 |
197 | |
ecfc5424 |
198 | miniperlmain.o: miniperlmain.c |
199 | $(CCCMD) $(PLDLFLAGS) $*.c |
200 | |
a0d0e21e |
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 |
85e6fe83 |
204 | |
2304df62 |
205 | perlmain.o: perlmain.c |
ecfc5424 |
206 | $(CCCMD) $(PLDLFLAGS) $*.c |
85e6fe83 |
207 | |
a0d0e21e |
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 |
85e6fe83 |
213 | |
a0d0e21e |
214 | perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
ecfc5424 |
215 | $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
85e6fe83 |
216 | |
a0d0e21e |
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) |
2304df62 |
219 | |
a0d0e21e |
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) |
2304df62 |
222 | |
a0d0e21e |
223 | $(perllib): $& perl.o $(obj) |
ecfc5424 |
224 | !NO!SUBS! |
225 | |
226 | case "$d_shrplib" in |
227 | *define*) |
228 | $spitshell >>Makefile <<'!NO!SUBS!' |
229 | ld $(LDDLFLAGS) -o $@ perl.o $(obj) |
230 | !NO!SUBS! |
231 | ;; |
232 | *) |
233 | $spitshell >>Makefile <<'!NO!SUBS!' |
a0d0e21e |
234 | ar rcu $(perllib) perl.o $(obj) |
235 | @$(ranlib) $(perllib) |
ecfc5424 |
236 | !NO!SUBS! |
237 | ;; |
238 | esac |
239 | |
240 | $spitshell >>Makefile <<'!NO!SUBS!' |
2304df62 |
241 | |
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. |
246 | |
a0d0e21e |
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) |
2304df62 |
249 | |
250 | sperl.o: perl.c perly.h patchlevel.h $(h) |
251 | $(RMS) sperl.c |
85e6fe83 |
252 | $(LNS) perl.c sperl.c |
2304df62 |
253 | $(CCCMD) -DIAMSUID sperl.c |
254 | $(RMS) sperl.c |
255 | |
2304df62 |
256 | opcode.h: opcode.pl |
85e6fe83 |
257 | - perl opcode.pl |
2304df62 |
258 | |
3edbfbe5 |
259 | embed.h: embed_h.sh global.sym interp.sym |
260 | sh embed_h.sh |
2304df62 |
261 | |
a0d0e21e |
262 | preplibrary: miniperl lib/Config.pm |
ecfc5424 |
263 | @./makedir lib/auto |
a0d0e21e |
264 | @echo " AutoSplitting perl library" |
265 | @./miniperl -Ilib -e 'use AutoSplit; \ |
266 | autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm |
2304df62 |
267 | |
a0d0e21e |
268 | lib/Config.pm: config.sh miniperl |
269 | ./miniperl configpm |
2304df62 |
270 | |
271 | install: all |
272 | ./perl installperl |
a0d0e21e |
273 | !NO!SUBS! |
274 | |
275 | : Only print out the rules for running byacc if the user _has_ byacc. |
276 | : Otherwise, comment them out. Users who really know what they are |
277 | : doing can uncomment them and run yacc or bison or whatever. |
a0d0e21e |
278 | case "$byacc" in |
ecfc5424 |
279 | '') |
a0d0e21e |
280 | comment1='#' |
281 | comment2='' ;; |
282 | *) comment1='' |
283 | comment2='#' ;; |
284 | esac |
285 | |
286 | $spitshell >>Makefile <<!GROK!THIS! |
287 | |
288 | perly.h: perly.c |
289 | @ echo Dummy dependency for dumb parallel make |
290 | touch perly.h |
291 | |
292 | # I now supply perly.c with the kits, so the following section is |
ecfc5424 |
293 | # used only if you have byacc. |
a0d0e21e |
294 | |
295 | ${comment1}perly.c: perly.y perly.c.diff |
296 | ${comment1} @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict |
297 | ${comment1} \$(BYACC) -d perly.y |
298 | ${comment1} sh \$(shellflags) ./perly.fixer y.tab.c perly.c |
299 | ${comment1} mv y.tab.h perly.h |
300 | ${comment1} echo 'extern YYSTYPE yylval;' >>perly.h |
301 | |
ecfc5424 |
302 | # This version is used if you do not have byacc. |
a0d0e21e |
303 | ${comment2}perly.c: perly.y |
304 | ${comment2} touch perly.c |
305 | |
306 | !GROK!THIS! |
307 | |
308 | $spitshell >>Makefile <<'!NO!SUBS!' |
309 | # Extensions: |
310 | # Names added to $(dynamic_ext) or $(static_ext) will automatically |
311 | # get built. There should ordinarily be no need to change any of |
312 | # this part of makefile. |
313 | # |
314 | # The dummy dependency is a place holder in case $(dynamic_ext) or |
315 | # $(static_ext) is empty. |
316 | # |
317 | # DynaLoader may be needed for extensions that use Makefile.PL. |
318 | |
319 | $(DYNALOADER): miniperl preplibrary FORCE |
320 | @sh ext/util/make_ext static $@ |
321 | |
322 | d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE |
323 | @sh ext/util/make_ext dynamic $@ |
324 | |
325 | s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE |
326 | @sh ext/util/make_ext static $@ |
2304df62 |
327 | |
328 | clean: |
42793c05 |
329 | rm -f *.o *.a all perlmain.c |
a0d0e21e |
330 | rm -f perl.exp ext.libs ext/util/extlibist |
331 | -cd x2p; $(MAKE) clean |
332 | -cd pod; $(MAKE) clean |
42793c05 |
333 | @for x in $(dynamic_ext) $(static_ext) ; do \ |
334 | sh ext/util/make_ext clean $$x ; \ |
a0d0e21e |
335 | done |
ecfc5424 |
336 | rm -f perl suidperl miniperl $(perllib) |
2304df62 |
337 | |
338 | realclean: clean |
a0d0e21e |
339 | -cd x2p; $(MAKE) realclean |
42793c05 |
340 | @for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ |
341 | sh ext/util/make_ext realclean $$x ; \ |
a0d0e21e |
342 | done |
42793c05 |
343 | rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl |
a0d0e21e |
344 | rm -rf $(addedbyconf) |
345 | rm -f Makefile cflags makedepend makedir writemain |
42793c05 |
346 | rm -f config.h makefile makefile.old |
85e6fe83 |
347 | rm -f lib/Config.pm |
a0d0e21e |
348 | rm -rf lib/auto |
349 | rm -f h2ph h2ph.man c2ph pstruct |
350 | rm -rf .config |
2304df62 |
351 | |
ecfc5424 |
352 | clobber: realclean |
353 | rm -f config.sh cppstdin |
354 | |
355 | distclean: clobber |
356 | |
2304df62 |
357 | # The following lint has practically everything turned on. Unfortunately, |
358 | # you have to wade through a lot of mumbo jumbo that can't be suppressed. |
359 | # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message |
360 | # for that spot. |
361 | |
362 | lint: perly.c $(c) |
363 | lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz |
364 | |
a0d0e21e |
365 | makefile: Makefile |
366 | make depend |
367 | |
368 | # When done, touch perlmain.c so that it doesn't get remade each time. |
2304df62 |
369 | depend: makedepend |
370 | - test -f perly.h || cp /dev/null perly.h |
371 | ./makedepend |
372 | - test -s perly.h || /bin/rm -f perly.h |
a0d0e21e |
373 | - test -s perlmain.c && touch perlmain.c |
2304df62 |
374 | cd x2p; $(MAKE) depend |
375 | |
a0d0e21e |
376 | test: miniperl perl preplibrary $(dynamic_ext) |
2304df62 |
377 | - cd t && chmod +x TEST */*.t |
85e6fe83 |
378 | - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty |
2304df62 |
379 | |
85e6fe83 |
380 | clist: $(c) |
2304df62 |
381 | echo $(c) | tr ' ' '\012' >.clist |
382 | |
85e6fe83 |
383 | hlist: $(h) |
2304df62 |
384 | echo $(h) | tr ' ' '\012' >.hlist |
385 | |
85e6fe83 |
386 | shlist: $(sh) |
2304df62 |
387 | echo $(sh) | tr ' ' '\012' >.shlist |
388 | |
389 | # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE |
390 | # If this runs make out of memory, delete /usr/include lines. |
391 | !NO!SUBS! |
392 | |
85e6fe83 |
393 | $eunicefix Makefile |
2304df62 |
394 | case `pwd` in |
395 | *SH) |
85e6fe83 |
396 | $rm -f ../Makefile |
397 | ln Makefile ../Makefile |
2304df62 |
398 | ;; |
399 | esac |
400 | rm -f makefile |
a0d0e21e |
401 | |
402 | |