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 | |
a0d0e21e |
25 | : Configure sets byacc=byacc if byacc is not found. We reset it to '' |
26 | case "$byacc" in |
27 | ''|'byacc') byacc='';; |
85e6fe83 |
28 | esac |
29 | |
a0d0e21e |
30 | : Prepare dependency lists for Makefile. |
31 | dynamic_list=' ' |
32 | for f in $dynamic_ext; do |
33 | : the dependency named here will never exist |
34 | dynamic_list="$dynamic_list $f.$dlext" |
35 | done |
36 | |
37 | static_list=' ' |
38 | static_ai_list=' ' |
39 | for f in $static_ext; do |
40 | base=`echo "$f" | sed 's/.*\///'` |
41 | static_list="$static_list ext/$f/$base.a" |
42 | if test -f ext/$f/AutoInit.c; then |
43 | static_ai_list="$static_ai_list ext/$f/AutoInit.c" |
44 | fi |
45 | if test -f ext/$f/AutoInit.pl; then |
46 | static_ai_list="$static_ai_list ext/$f/AutoInit.pl" |
47 | fi |
48 | done |
49 | |
2304df62 |
50 | echo "Extracting Makefile (with variable substitutions)" |
a0d0e21e |
51 | $spitshell >Makefile <<'!NO!SUBS!' |
52 | # Makefile.SH |
85e6fe83 |
53 | # This file is derived from Makefile.SH. Any changes made here will |
54 | # be lost the next time you run Configure. |
55 | # Makefile is used to generate makefile. The only difference |
56 | # is that makefile has the dependencies filled in at the end. |
2304df62 |
57 | # |
2304df62 |
58 | # |
a0d0e21e |
59 | !NO!SUBS! |
2304df62 |
60 | |
a0d0e21e |
61 | $spitshell >>Makefile <<!GROK!THIS! |
2304df62 |
62 | # I now supply perly.c with the kits, so don't remake perly.c without byacc |
63 | BYACC = $byacc |
64 | CC = $cc |
65 | bin = $installbin |
66 | scriptdir = $scriptdir |
67 | privlib = $installprivlib |
68 | mansrc = $mansrc |
69 | manext = $manext |
70 | LDFLAGS = $ldflags |
71 | CLDFLAGS = $ldflags |
85e6fe83 |
72 | |
2304df62 |
73 | SMALL = $small |
74 | LARGE = $large $split |
75 | mallocsrc = $mallocsrc |
76 | mallocobj = $mallocobj |
85e6fe83 |
77 | LNS = $lns |
2304df62 |
78 | RMS = rm -f |
85e6fe83 |
79 | ranlib = $ranlib |
80 | |
81 | # The following are used to build and install shared libraries for |
82 | # dynamic loading. |
83 | LDDLFLAGS = $lddlflags |
84 | CCDLFLAGS = $ccdlflags |
85 | CCCDLFLAGS = $cccdlflags |
a0d0e21e |
86 | DLSUFFIX = .$dlext |
87 | |
88 | dynamic_ext = $dynamic_list |
89 | static_ext = $static_list |
90 | ext = \$(dynamic_ext) \$(static_ext) |
91 | static_ext_autoinit = $static_ai_list |
92 | DYNALOADER = ext/DynaLoader/DynaLoader.a |
2304df62 |
93 | |
94 | libs = $libs $cryptlib |
95 | |
96 | public = perl $suidperl |
97 | |
98 | shellflags = $shellflags |
99 | |
a0d0e21e |
100 | ## To use an alternate make, set \$altmake in config.sh. |
2304df62 |
101 | MAKE = ${altmake-make} |
102 | !GROK!THIS! |
103 | |
85e6fe83 |
104 | ## In the following dollars and backticks do not need the extra backslash. |
2304df62 |
105 | $spitshell >>Makefile <<'!NO!SUBS!' |
106 | |
a0d0e21e |
107 | CCCMD = `sh $(shellflags) cflags $(perllib) $@` |
2304df62 |
108 | |
109 | private = |
110 | |
a0d0e21e |
111 | scripts = |
2304df62 |
112 | |
a0d0e21e |
113 | manpages = perl.man |
2304df62 |
114 | |
115 | util = |
116 | |
85e6fe83 |
117 | sh = Makefile.SH cflags.SH embed_h.SH makedepend.SH makedir.SH writemain.SH |
2304df62 |
118 | |
2304df62 |
119 | h1 = EXTERN.h INTERN.h XSUB.h av.h config.h cop.h cv.h dosish.h |
a0d0e21e |
120 | h2 = embed.h form.h gv.h handy.h hv.h keywords.h mg.h op.h |
2304df62 |
121 | h3 = opcode.h patchlevel.h perl.h perly.h pp.h proto.h regcomp.h |
122 | h4 = regexp.h scope.h sv.h unixish.h util.h |
123 | h = $(h1) $(h2) $(h3) $(h4) |
124 | |
a0d0e21e |
125 | c1 = $(mallocsrc) av.c scope.c op.c doop.c doio.c dump.c hv.c mg.c |
126 | c2 = perl.c perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c |
2304df62 |
127 | c3 = gv.c sv.c taint.c toke.c util.c deb.c run.c |
128 | |
a0d0e21e |
129 | c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c |
2304df62 |
130 | |
a0d0e21e |
131 | obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o |
132 | obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o |
133 | obj3 = doop.o doio.o regexec.o taint.o deb.o |
2304df62 |
134 | |
85e6fe83 |
135 | obj = $(obj1) $(obj2) $(obj3) |
2304df62 |
136 | |
a0d0e21e |
137 | # Once perl has been Configure'd and built ok you build different |
138 | # perl variants (Debugging, Embedded, Multiplicity etc) by saying: |
139 | # make clean; make perllib=libperl<type>.a |
140 | # where <type> is some combination of 'd' and(or) 'e' or 'm'. |
141 | # See cflags to understand how this works. |
142 | # |
143 | # Eventually some form of 'make-a-perl' script will automate this |
144 | # together with linking a perl executable with any desired |
145 | # static modules. |
146 | perllib = libperl.a |
147 | |
2304df62 |
148 | lintflags = -hbvxac |
149 | |
a0d0e21e |
150 | addedbyconf = UU |
2304df62 |
151 | |
152 | # grrr |
153 | SHELL = /bin/sh |
154 | |
2304df62 |
155 | .c.o: |
156 | $(CCCMD) $*.c |
157 | |
a0d0e21e |
158 | all: makefile miniperl preplibrary $(public) $(dynamic_ext) |
159 | @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all |
160 | @echo " "; echo " Making docs"; cd pod; $(MAKE) all; |
85e6fe83 |
161 | |
162 | # Phony target to force checking subdirectories. |
163 | FORCE: |
164 | |
2304df62 |
165 | !NO!SUBS! |
85e6fe83 |
166 | |
a0d0e21e |
167 | : Now on to the rest of the Makefile. |
2304df62 |
168 | $spitshell >>Makefile <<'!NO!SUBS!' |
169 | # The $& notation tells Sequent machines that it can do a parallel make, |
170 | # and is harmless otherwise. |
171 | |
a0d0e21e |
172 | miniperl: $& miniperlmain.o $(perllib) |
173 | $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs) |
2304df62 |
174 | |
a0d0e21e |
175 | perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit) |
176 | sh writemain $(DYNALOADER) $(static_ext) > tmp |
177 | sh mv-if-diff tmp perlmain.c |
85e6fe83 |
178 | |
2304df62 |
179 | perlmain.o: perlmain.c |
85e6fe83 |
180 | |
a0d0e21e |
181 | # The file ext.libs is a list of libraries that must be linked in |
182 | # for static extensions, e.g. -lm -lgdbm, etc. The individual |
183 | # static extension Makefile's add to it. |
184 | ext.libs: $(static_ext) |
185 | -@test -f ext.libs || touch ext.libs |
85e6fe83 |
186 | |
a0d0e21e |
187 | perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
188 | $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
85e6fe83 |
189 | |
a0d0e21e |
190 | pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
191 | purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
2304df62 |
192 | |
a0d0e21e |
193 | quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
194 | quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
2304df62 |
195 | |
a0d0e21e |
196 | $(perllib): $& perl.o $(obj) |
197 | ar rcu $(perllib) perl.o $(obj) |
198 | @$(ranlib) $(perllib) |
2304df62 |
199 | |
200 | # This version, if specified in Configure, does ONLY those scripts which need |
201 | # set-id emulation. Suidperl must be setuid root. It contains the "taint" |
202 | # checks as well as the special code to validate that the script in question |
203 | # has been invoked correctly. |
204 | |
a0d0e21e |
205 | suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs |
206 | $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) |
2304df62 |
207 | |
208 | sperl.o: perl.c perly.h patchlevel.h $(h) |
209 | $(RMS) sperl.c |
85e6fe83 |
210 | $(LNS) perl.c sperl.c |
2304df62 |
211 | $(CCCMD) -DIAMSUID sperl.c |
212 | $(RMS) sperl.c |
213 | |
2304df62 |
214 | opcode.h: opcode.pl |
85e6fe83 |
215 | - perl opcode.pl |
2304df62 |
216 | |
217 | embed.h: embed_h.SH global.sym interp.sym |
218 | sh embed_h.SH |
219 | |
a0d0e21e |
220 | preplibrary: miniperl lib/Config.pm |
221 | @test -d lib/auto || mkdir lib/auto |
222 | @echo " AutoSplitting perl library" |
223 | @./miniperl -Ilib -e 'use AutoSplit; \ |
224 | autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm |
2304df62 |
225 | |
a0d0e21e |
226 | lib/Config.pm: config.sh miniperl |
227 | ./miniperl configpm |
2304df62 |
228 | |
229 | install: all |
230 | ./perl installperl |
a0d0e21e |
231 | !NO!SUBS! |
232 | |
233 | : Only print out the rules for running byacc if the user _has_ byacc. |
234 | : Otherwise, comment them out. Users who really know what they are |
235 | : doing can uncomment them and run yacc or bison or whatever. |
236 | : Configure sets byacc=byacc if byacc is not found. |
237 | case "$byacc" in |
238 | ''|'byacc') |
239 | comment1='#' |
240 | comment2='' ;; |
241 | *) comment1='' |
242 | comment2='#' ;; |
243 | esac |
244 | |
245 | $spitshell >>Makefile <<!GROK!THIS! |
246 | |
247 | perly.h: perly.c |
248 | @ echo Dummy dependency for dumb parallel make |
249 | touch perly.h |
250 | |
251 | # I now supply perly.c with the kits, so the following section is |
252 | # commented out if you don't have byacc. |
253 | |
254 | ${comment1}perly.c: perly.y perly.c.diff |
255 | ${comment1} @ echo 'Expect' 109 shift/reduce and 1 reduce/reduce conflict |
256 | ${comment1} \$(BYACC) -d perly.y |
257 | ${comment1} sh \$(shellflags) ./perly.fixer y.tab.c perly.c |
258 | ${comment1} mv y.tab.h perly.h |
259 | ${comment1} echo 'extern YYSTYPE yylval;' >>perly.h |
260 | |
261 | # This version is used only if you do not have byacc. |
262 | ${comment2}perly.c: perly.y |
263 | ${comment2} touch perly.c |
264 | |
265 | !GROK!THIS! |
266 | |
267 | $spitshell >>Makefile <<'!NO!SUBS!' |
268 | # Extensions: |
269 | # Names added to $(dynamic_ext) or $(static_ext) will automatically |
270 | # get built. There should ordinarily be no need to change any of |
271 | # this part of makefile. |
272 | # |
273 | # The dummy dependency is a place holder in case $(dynamic_ext) or |
274 | # $(static_ext) is empty. |
275 | # |
276 | # DynaLoader may be needed for extensions that use Makefile.PL. |
277 | |
278 | $(DYNALOADER): miniperl preplibrary FORCE |
279 | @sh ext/util/make_ext static $@ |
280 | |
281 | d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE |
282 | @sh ext/util/make_ext dynamic $@ |
283 | |
284 | s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE |
285 | @sh ext/util/make_ext static $@ |
2304df62 |
286 | |
287 | clean: |
42793c05 |
288 | rm -f *.o *.a all perlmain.c |
a0d0e21e |
289 | rm -f perl.exp ext.libs ext/util/extlibist |
290 | -cd x2p; $(MAKE) clean |
291 | -cd pod; $(MAKE) clean |
42793c05 |
292 | @for x in $(dynamic_ext) $(static_ext) ; do \ |
293 | sh ext/util/make_ext clean $$x ; \ |
a0d0e21e |
294 | done |
42793c05 |
295 | rm -f perl suidperl miniperl |
2304df62 |
296 | |
297 | realclean: clean |
a0d0e21e |
298 | -cd x2p; $(MAKE) realclean |
42793c05 |
299 | : could add: "-cd pod; $(MAKE) realclean" here and to pod/Makefile |
300 | @for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ |
301 | sh ext/util/make_ext realclean $$x ; \ |
a0d0e21e |
302 | done |
42793c05 |
303 | rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl |
a0d0e21e |
304 | rm -rf $(addedbyconf) |
305 | rm -f Makefile cflags makedepend makedir writemain |
42793c05 |
306 | rm -f config.h makefile makefile.old |
85e6fe83 |
307 | rm -f x2p/Makefile x2p/makefile x2p/makefile.old x2p/cflags |
308 | rm -f lib/Config.pm |
a0d0e21e |
309 | rm -rf lib/auto |
310 | rm -f h2ph h2ph.man c2ph pstruct |
311 | rm -rf .config |
2304df62 |
312 | |
313 | # The following lint has practically everything turned on. Unfortunately, |
314 | # you have to wade through a lot of mumbo jumbo that can't be suppressed. |
315 | # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message |
316 | # for that spot. |
317 | |
318 | lint: perly.c $(c) |
319 | lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz |
320 | |
a0d0e21e |
321 | makefile: Makefile |
322 | make depend |
323 | |
324 | # When done, touch perlmain.c so that it doesn't get remade each time. |
2304df62 |
325 | depend: makedepend |
326 | - test -f perly.h || cp /dev/null perly.h |
327 | ./makedepend |
328 | - test -s perly.h || /bin/rm -f perly.h |
a0d0e21e |
329 | - test -s perlmain.c && touch perlmain.c |
2304df62 |
330 | cd x2p; $(MAKE) depend |
331 | |
a0d0e21e |
332 | test: miniperl perl preplibrary $(dynamic_ext) |
2304df62 |
333 | - cd t && chmod +x TEST */*.t |
85e6fe83 |
334 | - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty |
2304df62 |
335 | |
85e6fe83 |
336 | clist: $(c) |
2304df62 |
337 | echo $(c) | tr ' ' '\012' >.clist |
338 | |
85e6fe83 |
339 | hlist: $(h) |
2304df62 |
340 | echo $(h) | tr ' ' '\012' >.hlist |
341 | |
85e6fe83 |
342 | shlist: $(sh) |
2304df62 |
343 | echo $(sh) | tr ' ' '\012' >.shlist |
344 | |
345 | # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE |
346 | # If this runs make out of memory, delete /usr/include lines. |
347 | !NO!SUBS! |
348 | |
85e6fe83 |
349 | $eunicefix Makefile |
2304df62 |
350 | case `pwd` in |
351 | *SH) |
85e6fe83 |
352 | $rm -f ../Makefile |
353 | ln Makefile ../Makefile |
2304df62 |
354 | ;; |
355 | esac |
356 | rm -f makefile |
a0d0e21e |
357 | |
358 | |