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